RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass* [v3]

Ioi Lam iklam at openjdk.org
Tue Sep 2 21:08:25 UTC 2025


On Tue, 2 Sep 2025 20:57:26 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Do we still need java_super ?
>
> There are a few places that use it. Maybe we should look at these again in the future.
> 
> 
> compiler dependencies:
> 
> ./share/code/dependencies.cpp:      for (InstanceKlass* super = k->java_super(); super != nullptr; super = super->java_super()) {
> ./share/code/dependencies.cpp:      _klass = _klass->java_super();
> 
> subklass and sibling:
> 
> ./share/oops/instanceKlass.cpp:    _current = _current->java_super(); // backtrack; no more sibling subclasses left
> ./share/oops/klass.cpp:  InstanceKlass* super = java_super();
> ./share/oops/klass.cpp:          && (super->java_super() == nullptr || !is_interface())),
> 
> Some general cases where you have a Klass but wants same super as in java.lang.Class::getSuperClass
> 
> ./share/oops/klassVtable.cpp:  InstanceKlass* super = _klass->java_super();
> ./share/prims/jni.cpp:  // Rules of Class.getSuperClass as implemented by KLass::java_super:
> ./share/prims/jni.cpp:  Klass* super = k->java_super();
> ./share/prims/jni.cpp:         "java_super computation depends on interface, array, other super");
> ./share/services/heapDumper.cpp:  InstanceKlass* java_super = k->java_super();
> ./share/services/heapDumper.cpp:  assert(java_super != nullptr, "checking");
> ./share/services/heapDumper.cpp:  writer->write_classID(java_super);

I changed to `hides`. There are mentions of both `shadows` and `hides` in our comments.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27037#discussion_r2317171136


More information about the hotspot-dev mailing list