RFR: 8253540: InterpreterRuntime::monitorexit should be a JRT_LEAF function [v2]

Coleen Phillimore coleenp at openjdk.java.net
Thu Sep 24 12:19:27 UTC 2020


On Wed, 23 Sep 2020 20:13:37 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> 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.
>
>> Ah, we have "elem->set_obj(NULL);" in InterpreterRuntime::monitorexit. So this should also cover the UseHeavyMonitors
>> case.
> 
> I found out the hard way that this line is needed :)

I pushed a revision that is what I think it should do.  If the monitor has been unlocked by JNI code, just like other
handing for JNI failures, like void ObjectSynchronizer::release_monitors_owned_by_thread, we should allow the code to
continue, and give an error if CheckJNICalls is true.

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

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


More information about the hotspot-dev mailing list