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

incorrect comment in SystemDictionary::load_shared_class

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b122
    • CPU:
      generic
    • OS:
      generic

      Description

      See this version of systemDictionary.cpp

      http://hg.openjdk.java.net/jdk9/jdk9/hotspot/file/ee069fd4b66b/src/share/vm/classfile/systemDictionary.cpp#l1220

      instanceKlassHandle SystemDictionary::load_shared_class(instanceKlassHandle ik,
                                                              Handle class_loader,
                                                              Handle protection_domain, TRAPS) {
        if (ik.not_null()) {
          instanceKlassHandle nh = instanceKlassHandle(); // null Handle
          Symbol* class_name = ik->name();

          // Found the class, now load the superclass and interfaces. If they
          // are shared, add them to the main system dictionary and reset
          // their hierarchy references (supers, subs, and interfaces).

          if (ik->super() != NULL) {
            Symbol* cn = ik->super()->name();
            Klass *s = resolve_super_or_fail(class_name, cn,
                                             class_loader, protection_domain, true, CHECK_(nh));
            if (s != ik->super()) {
              // The dynamically resolved super class is not the same as the one we used during dump time,
              // so we cannot use ik.
              return nh;
            }
          }

          Array<Klass*>* interfaces = ik->local_interfaces();
          int num_interfaces = interfaces->length();
          for (int index = 0; index < num_interfaces; index++) {
            Klass* k = interfaces->at(index);

            // Note: can not use InstanceKlass::cast here because
            // interfaces' InstanceKlass's C++ vtbls haven't been
            // reinitialized yet (they will be once the interface classes
            // are loaded)
            Symbol* name = k->name();
            Klass* i = resolve_super_or_fail(class_name, name, class_loader, protection_domain, false, CHECK_(nh));
            if (k != i) {
              // The dynamically resolved interface class is not the same as the one we used during dump time,
              // so we cannot use ik.
              return nh;
            }
          }

      The "// Found the class ..." comment is wrong and unclear. There is no "resetting their hierarchy references" happening here.

        Attachments

          Activity

            People

            • Assignee:
              iklam Ioi Lam
              Reporter:
              iklam Ioi Lam
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: