Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8209958

Clean up duplicate basic array type statics in Universe

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 12
    • 12
    • hotspot
    • None
    • b09

      Klass* Universe::_boolArrayKlassObj = NULL;
      Klass* Universe::_byteArrayKlassObj = NULL;
      Klass* Universe::_charArrayKlassObj = NULL;
      Klass* Universe::_intArrayKlassObj = NULL;
      Klass* Universe::_shortArrayKlassObj = NULL;
      Klass* Universe::_longArrayKlassObj = NULL;
      Klass* Universe::_singleArrayKlassObj = NULL;
      Klass* Universe::_doubleArrayKlassObj = NULL;
      Klass* Universe::_typeArrayKlassObjs[T_VOID+1] = { NULL /*, NULL...*/ };
      Klass* Universe::_objectArrayKlassObj = NULL;

      There are loops in universe.cpp look like the iterate over null items.

      metaspace_pointers_do:
        for (int i = 0; i < T_VOID+1; i++) {
          it->push(&_typeArrayKlassObjs[i]);
        }

      serialize:
          for (int i = 0; i < T_VOID+1; i++) {
            if (_typeArrayKlassObjs[i] != NULL) {
              assert(i >= T_BOOLEAN, "checking");
              f->do_ptr((void**)&_typeArrayKlassObjs[i]);
            } else if (do_all) {
              f->do_ptr((void**)&_typeArrayKlassObjs[i]);
            }

      typeArrayKlassObj[T_OBJECT] appears uninitialized.

        f->do_ptr((void**)&_singleArrayKlassObj);
      singleArrayKlassObj is for T_FLOAT

      And the basic_type_pointers_do, serialize, metaspace_pointers_do walk _{type}ArrayKlassObj individually.

      There's no typeArrayKlassObj for T_ARRAY but it is covered in the range of for loops.

      Suggest removing the individual _{type}ArrayKlassObj and have the functions
      Klass* boolArrayKlassObj() { return typeArrayKlassObj[T_BOOLEAN]; }
      for example.

            coleenp Coleen Phillimore
            coleenp Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: