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

Coleen Phillimore coleenp at openjdk.java.net
Wed Sep 23 19:22:50 UTC 2020


On Wed, 23 Sep 2020 17:27:08 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Changes requested by dcubed (Reviewer).
>
> The review invite says this:
> 
>> That the monitor has already been unlocked, or is a null stacklock
>> monitor has been already checked in the caller
> 
> so I also need to go look at the caller contexts.
> 
> Update: So I went and took a look and very quickly found this:
> 
> src/hotspot/cpu/x86/interp_masm_x86.cpp:
> 
> void InterpreterMacroAssembler::unlock_object(Register lock_reg) {
>   assert(lock_reg == LP64_ONLY(c_rarg1) NOT_LP64(rdx),
>          "The argument is only for looks. It must be c_rarg1");
>   
>   if (UseHeavyMonitors) {
>     call_VM(noreg,
>             CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorexit),
>             lock_reg);
>   } else {
> 
> So when -XX:+UseHeavyMonitors is used, we make a direct call
> to InterpreterRuntime::monitorexit() without checking the lock_reg
> parameter at all.

Read the caller of this function.

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

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


More information about the hotspot-runtime-dev mailing list