On Sat, 7 Nov 2020 17:17:01 GMT, Daniel D. Daugherty <dcu...@openjdk.org> wrote:

>> src/hotspot/share/runtime/synchronizer.cpp line 136:
>> 
>>> 134: 
>>> 135:       // Honor block request.
>>> 136:       ThreadBlockInVM tbivm(self->as_Java_thread());
>> 
>> ThreadBlockInVM is generally used to wrap blocking code, not to cause the 
>> current thread to block (which it will do as a side-effect if a 
>> safepoint/handshake is requested). Surely this should just be call to 
>> `process_if_requested` (or the new `process_if_requested_with_exit_check`)?
>
> This kind of use of ThreadBlockInVM predates this changeset so while
> the location is new, then code style is old, very old... I'll hold off 
> changing
> this for now.

I'd rather see ThreadBlockInVM as the convention of allowing the thread to 
block if a safepoint is requested.  The calls like process_if_requested are 
becoming alphabet soup and keep changing, so having TBIVM is better in my 
opinion.
That said, this is a strange usage.  This code appears three times.  It should 
be a function like allow_safepoint_block(LogStream* ls, timer), with some 
comment above.  Then it's clear that it's checking for a safepoint in a loop 
that could take a long time and the logging is ancillary.

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

PR: https://git.openjdk.java.net/jdk/pull/642

Reply via email to