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

[lworld] Support for multi-dimensional value arrays is incomplete

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: repo-valhalla
    • Fix Version/s: None
    • Component/s: hotspot
    • Labels:

      Description

      Implementation of value arrays has changed the semantic of the _bottom_klass field in ObjArrayKlass:

      Initial semantic was described in the comments:

      Klass* _bottom_klass; // The one-dimensional type (InstanceKlass or TypeArrayKlass)

      The implementation of value arrays has introduced a third case: _bottom_klass can now store a ValueArrayKlass instance.

      Many of the codes using bottom_klass() have not been updated yet to handle this third case.

      For instance:

      bool InstanceKlass::is_same_class_package(const Klass* class2) const {
        oop classloader1 = this->class_loader();
        PackageEntry* classpkg1 = this->package();
        if (class2->is_objArray_klass()) {
          class2 = ObjArrayKlass::cast(class2)->bottom_klass();
        }

        oop classloader2;
        PackageEntry* classpkg2;
        if (class2->is_instance_klass()) {
          classloader2 = class2->class_loader();
          classpkg2 = class2->package();
        } else {
          assert(class2->is_typeArray_klass(), "should be type array");
          classloader2 = NULL;
          classpkg2 = NULL;
        }



      or


      void LinkResolver::check_klass_accessability(Klass* ref_klass, Klass* sel_klass,
                                                   bool fold_type_to_class, TRAPS) {
        Klass* base_klass = sel_klass;
        if (fold_type_to_class) {
          if (sel_klass->is_objArray_klass()) {
            base_klass = ObjArrayKlass::cast(sel_klass)->bottom_klass();
          }
          // The element type could be a typeArray - we only need the access
          // check if it is an reference to another class.
          if (!base_klass->is_instance_klass()) {
            return; // no relevant check to do
          }
        }


      or

      static bool is_always_visible_class(oop mirror) {
        Klass* klass = java_lang_Class::as_Klass(mirror);
        if (klass->is_objArray_klass()) {
          klass = ObjArrayKlass::cast(klass)->bottom_klass(); // check element type
        }
        if (klass->is_typeArray_klass()) {
          return true; // primitive array
        }
        assert(klass->is_instance_klass(), "%s", klass->external_name());
        return klass->is_public() &&
               (InstanceKlass::cast(klass)->is_same_class_package(SystemDictionary::Object_klass()) || // java.lang
                InstanceKlass::cast(klass)->is_same_class_package(SystemDictionary::MethodHandle_klass())); // java.lang.invoke
      }


      All usages of the _bottom_klass field of ObjArrayKlass should be revisited, and the logic extended to handle the new third case if needed.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dsimms David Simms
                Reporter:
                fparain Frederic Parain
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: