Question re safepoints and monitors
Andrew Haley
aph at redhat.com
Thu Jan 12 03:53:39 PST 2012
This is re HS20 on Zero, but it might apply to any HotSpot port AFAIK.
We invoke Thread.stop on a thread. To do this, we need to wait for
the thread to reach a safepoint. So, thread->set_pending_exception()
is called, and SafepointSynchronize::_state is set to
SafepointSynchronize::_synchronizing.
The thread needs to acquire a lock, so it enters
InterpreterRuntime::monitorenter(). This does the safepoint check.
monitorenter() is marked IRT_ENTRY_NO_ASYNC, so it does not check for
pending async exceptions. Control returns from monitorenter and the
thread continues to execute Java. The async exception is not
processed.
As far as I can see, there is still a pending exception for this
thread but it won't be processed until something else causes the
thread to move to a safepoint. Is that right?
Thanks,
Andrew.
More information about the hotspot-dev
mailing list