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

[lworld][c1] implement handling of unloaded value classes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • repo-valhalla
    • hotspot

      When a named class is not yet loaded, ciEnv::get_klass_by_name_impl() drops the 'Q' prefix and creates an unloaded version of ciInstanceKlass:

      http://hg.openjdk.java.net/valhalla/valhalla/file/8f8d2ccfdc40/src/hotspot/share/ci/ciEnv.cpp#l507

        if (i > 0 && sym->byte_at(i) == 'Q') {
          // An unloaded array class of value types is an ObjArrayKlass, an
          // unloaded value type class is an InstanceKlass. For consistency,
          // make the signature of the unloaded array of value type use L
          // rather than Q.
          char *new_name = CURRENT_THREAD_ENV->name_buffer(sym->utf8_length()+1);
          strncpy(new_name, (char*)sym->base(), sym->utf8_length());
          new_name[i] = 'L';
          new_name[sym->utf8_length()] = '\0';
          return get_unloaded_klass(accessing_klass, ciSymbol::make(new_name));
        }

      Later, when "Q"-aware bytecodes such as aaload is compiled by C1, we no longer know that we're dealing with a value klass. Example:

      int test() {
          V[] a = new V[1]; // V is not yet loaded when this is compiled
          return a[0].field;
      }

      The fix is for ciEnv::get_klass_by_name_impl() to return an unloaded version of ciValueKlass when the 'Q" prefix is specified.
             

            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: