RFR: 8231269: CompileTask::is_unloaded is slow due to JNIHandles type checks [v6]

Aleksey Shipilev shade at openjdk.org
Tue Apr 29 15:07:50 UTC 2025


On Tue, 29 Apr 2025 09:18:59 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Ok, thanks for checking! Good to know there's no existing bug.
>> 
>> What I had in mind is as follows:
>> 
>> InstanceKlass* holder = method->method_holder();
>> if (holder->class_loader_data()->is_permanent_class_loader_data()) {
>>   return nullptr; // method holder class can't be unloaded
>> } else {
>>   // Normal class, return the holder that would block unloading.
>>   // This would be either classloader oop for non-hidden classes,
>>   // or Java mirror oop for hidden classes.
>>   assert(holder->klass_holder() != nullptr, "");
>>   return holder->klass_holder();
>> }
>> 
>> 
>> IMO it makes the check more precise and, at the same time, communicates the intent better. What do you think?
>
> Yes, OK, let's do a variant of that. Committed. I'll re-run test to see if there are any surprises about these asserts.

Testing is still green, no surprises.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24018#discussion_r2066776548


More information about the hotspot-compiler-dev mailing list