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

Clean up duplicate basic array type statics in Universe

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 12
    • Fix Version/s: 12
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b09

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: