RFR: 8264731: Introduce InstanceKlass::method_at_itable_or_null()

David Holmes dholmes at openjdk.java.net
Tue Apr 6 02:56:31 UTC 2021


On Mon, 5 Apr 2021 17:40:58 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:

> Introduce `InstanceKlass::method_at_itable_or_null()` - a non-throwing variant of `InstanceKlass::method_at_itable()` that implements interface method selection. 
> 
> As a cleanup, rewrite `InstanceKlass::method_at_itable()` on top of `InstanceKlass::method_at_itable_or_null()`.
> 
> Testing: 
> * [x] hs-tier1 - hs-tier6

Hi Vladimir,

Seems okay in principle. I assume more callers of the new API are in the pipeline?

I have one suggested changed that would have made the code much much clearer to me.

Thanks,
David

src/hotspot/share/oops/instanceKlass.cpp line 3154:

> 3152: 
> 3153: Method* InstanceKlass::method_at_itable(InstanceKlass* holder, int index, TRAPS) {
> 3154:   bool itable_entry_found; // out parameter

I was very confused about the logic in this code until I realized that itable_entry_found is actually an indicator as to whether or not the current class implements the interface represented by holder, and not an indicator of whether or not a method was found. It would be much clearer to me if this variable were renamed something like implements_interface.

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

Marked as reviewed by dholmes (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/3344


More information about the hotspot-runtime-dev mailing list