RFR: 8369238: Allow virtual thread preemption on some common class initialization paths [v10]

Patricio Chilano Mateo pchilanomate at openjdk.org
Thu Oct 30 15:54:22 UTC 2025


On Thu, 30 Oct 2025 07:34:52 GMT, Richard Reingruber <rrich at openjdk.org> wrote:

>> We can get here from a preemptable path if initialization of the klass failed: https://github.com/pchilano/jdk/blob/c7d6f5c5220a93653dea37488d238a76e2ad627d/src/hotspot/share/oops/instanceKlass.cpp#L1292
>> Also from here at linking step: https://github.com/pchilano/jdk/blob/c7d6f5c5220a93653dea37488d238a76e2ad627d/src/hotspot/share/oops/instanceKlass.cpp#L970.
>> The klass of the exception might need to be initialized, so without this `NoPreemptMark` the thread could be preempted while trying to initialize it. The problem is that this method is called here https://github.com/pchilano/jdk/blob/c7d6f5c5220a93653dea37488d238a76e2ad627d/src/hotspot/share/utilities/exceptions.cpp#L372, which will continue executing and possibly make an upcall to Java. We could potentially change these methods to identify a `PreemptedException` and use the `CHECK` macros to return, but I think it is simpler to disable preemption for these cases.
>
> I'm a correct that at line 348 "the *exception* is propagated we might make an upcall to" you are referring to an `PreemptedException`? You could change the comment to distinguish this one with the exception being created better.

Yes, I updated the comment to make the distinction clearer.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27802#discussion_r2478637299


More information about the core-libs-dev mailing list