RFR: 8369238: Allow virtual thread preemption on some common class initialization paths [v3]
David Holmes
dholmes at openjdk.org
Wed Oct 22 06:11:05 UTC 2025
On Mon, 20 Oct 2025 19:07:10 GMT, Patricio Chilano Mateo <pchilanomate at openjdk.org> wrote:
>> src/hotspot/share/oops/klass.hpp line 583:
>>
>>> 581: // initializes the klass
>>> 582: virtual void initialize(TRAPS);
>>> 583: virtual void initialize_preemptable(TRAPS);
>>
>> Can we not define these on `instanceKlass` instead of `klass`? Seems really odd to declare virtual methods for which the base class version should never be called (they should be pure virtuals in that case I would think?).
>
> Ok. Just to double check, casting to `InstanceKlass*` where we call `initialize_preemptable` for the `invokestatic` and `getstatic/putstatic` cases should be always safe right? I don’t see how we could get there for an `ArrayKlass`.
Hmmm seems there is an `objArrayKlass::initialize` (and an empty `typeArrayKlass::initialize`) but I don't know when such classes would be initialized. I would not expect them to be the target of invokestatic/getstatic/putstatic, nor for "new" but a "new array" would have to do the initialization of the bottom class (at least that is what `objArrayKlass::initialize` does) - and I don't think the current changes address that case. ??
Anyway leave the placement as-is.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27802#discussion_r2450537248
More information about the core-libs-dev
mailing list