RFR: 8266017: Refactor the *klass::array_klass_impl code to separate the non-exception-throwing API

David Holmes david.holmes at oracle.com
Tue Apr 27 21:05:18 UTC 2021


On 28/04/2021 6:50 am, Ioi Lam wrote:
> On Tue, 27 Apr 2021 12:46:56 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
> 
>>> We currently have array_klass() and array_klass_or_null(), where the former can throw exceptions and the latter can not. But they both delegate to:
>>>
>>> array_klass_impl(bool or_null, TRAPS)
>>>
>>> which combines both the exception-throwing and non-exception-throwing code into one method declared with TRAPS. To make progress with the change of TRAPS to JavaThread (JDK-8252685) we need to separate these code paths into distinct methods.
>>>
>>> Testing: tiers 1-3 (in progress)
>>>
>>> Thanks,
>>> David
>>
>> src/hotspot/share/oops/klass.hpp line 525:
>>
>>> 523:   virtual Klass* array_klass_impl(TRAPS);
>>> 524:   virtual Klass* array_klass_or_null_impl(int rank);
>>> 525:   virtual Klass* array_klass_or_null_impl();
>>
>> I think you should make these pure virtual functions (=0) and remove the bodies in klass.cpp.
> 
> I think now we can get rid of the `array_klass_or_null_impl()` function altogether. Instead, `array_klass_or_null` should be declared as `virtual ... = 0` in `Klass` and implemented by the concrete subclasses.

Yes I think you are right - no need to inherit the top-level delegating 
functions and override the impl functions, when we can just override the 
top-level functions and delete all the impl functions. I'll give that a 
whirl.

Thanks for looking at this Ioi and Coleen!

David

> -------------
> 
> PR: https://git.openjdk.java.net/jdk/pull/3711
> 


More information about the hotspot-runtime-dev mailing list