RFR: 8278793: Interpreter(x64) intrinsify Thread.currentThread()

Roman Kennke rkennke at openjdk.java.net
Fri Dec 17 09:57:25 UTC 2021


On Tue, 14 Dec 2021 15:08:54 GMT, Robbin Ehn <rehn at openjdk.org> wrote:

> Please consider this enhancement.
> This makes Thread.currentThread() eight times faster on my box when running in interpreter.
> 
> Passes t1-t4
> 
> As suggested I added a related fix to Shenandoah.
> Shenandoah LB was using InterpreterMacroAssembler version of call_VM_leaf_base (it's virtual).
> The interpreter version adds a check on last_sp, since the intrinsic is not setting up a new frame, this check is faulty.
> Other GC seems to always use the base version, so let's use the base version in Shenandoah also.
> No issues found when locally running gc/shenandoah.

Hi Robbin,
Looks mostly good, one small comment.

src/hotspot/cpu/x86/templateInterpreterGenerator_x86_64.cpp line 456:

> 454:   // Only IN_HEAP loads require a thread_tmp register
> 455:   __ access_load_at(T_OBJECT, IN_NATIVE, rax,
> 456:                     Address(rscratch2, 0), rscratch1, noreg);

I don't like the hardcoded 0 here. You should use MacroAssembler::resolve_oop_handle() instead. (That has the 0 too, I believe this should be changed to a constant like OopHandle::obj_offset_in_bytes() or so, but that is another story.)

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

Changes requested by rkennke (Reviewer).

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


More information about the hotspot-dev mailing list