RFR: 8253540: InterpreterRuntime::monitorexit should be a JRT_LEAF function

Coleen Phillimore coleenp at openjdk.java.net
Wed Sep 23 19:43:41 UTC 2020


On Wed, 23 Sep 2020 19:27:51 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>>> Read the caller of this function.
>> 
>> I have and I have even started quoting caller code.
>
> Right, looks like the UseHeavyMonitors case in unlock_object misses the "Free entry" part.
> 
> I believe this is how it's supposed to work:
> - TemplateTable::monitorexit only uses unlock_object if the obj is not null and it is found in the monitor section on
>   stack.
> - unlock_object should clear the obj field on stack ("Free entry" on x86)
> - when calling monitorexit for the same unlocked obj, TemplateTable::monitorexit shouldn't find it on stack any more and
>   throw the exception
> 
> Ah, we have "elem->set_obj(NULL);" in InterpreterRuntime::monitorexit. So this should also cover the UseHeavyMonitors
> case.

The callers of unlock_object all check that the object is non-null and not already unlocked, otherwise they throw
NSME.  I haven't checked the non-x86 platforms recently to verify that, but that's how it should work. This should
really be refactored so that it's easier to tell.  But this shouldn't throw NSME inside of the InterpreterRuntime
function.

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

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


More information about the hotspot-runtime-dev mailing list