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

Reviewed-by: rkennke, dcubed, dholmes
This commit is contained in:
Robbin Ehn 2021-12-21 16:12:32 +00:00
parent 8c0bb53f5b
commit f7309060de
6 changed files with 33 additions and 4 deletions

View File

@ -420,9 +420,9 @@ void ShenandoahBarrierSetAssembler::load_reference_barrier(MacroAssembler* masm,
if (is_strong) {
if (is_narrow) {
__ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_strong_narrow), arg0, arg1);
__ super_call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_strong_narrow), arg0, arg1);
} else {
__ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_strong), arg0, arg1);
__ super_call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_strong), arg0, arg1);
}
} else if (is_weak) {
if (is_narrow) {
@ -433,7 +433,7 @@ void ShenandoahBarrierSetAssembler::load_reference_barrier(MacroAssembler* masm,
} else {
assert(is_phantom, "only remaining strength");
assert(!is_narrow, "phantom access cannot be narrow");
__ call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_phantom), arg0, arg1);
__ super_call_VM_leaf(CAST_FROM_FN_PTR(address, ShenandoahRuntime::load_reference_barrier_phantom), arg0, arg1);
}
#ifdef _LP64

View File

@ -445,3 +445,18 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M
return entry_point;
}
address TemplateInterpreterGenerator::generate_currentThread() {
address entry_point = __ pc();
__ movptr(rax, Address(r15_thread, JavaThread::threadObj_offset()));
__ resolve_oop_handle(rax, rscratch1);
__ pop(rcx);
__ mov(rsp, r13);
__ jmp(rcx);
return entry_point;
}

View File

@ -134,6 +134,9 @@ AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(const methodHan
case vmIntrinsics::_floatToRawIntBits: return java_lang_Float_floatToRawIntBits;
case vmIntrinsics::_longBitsToDouble: return java_lang_Double_longBitsToDouble;
case vmIntrinsics::_doubleToRawLongBits: return java_lang_Double_doubleToRawLongBits;
#ifdef AMD64
case vmIntrinsics::_currentThread: return java_lang_Thread_currentThread;
#endif
#endif // ZERO
case vmIntrinsics::_dsin: return java_lang_math_sin;
case vmIntrinsics::_dcos: return java_lang_math_cos;

View File

@ -90,6 +90,7 @@ class AbstractInterpreter: AllStatic {
java_lang_Float_floatToRawIntBits, // implementation of java.lang.Float.floatToRawIntBits()
java_lang_Double_longBitsToDouble, // implementation of java.lang.Double.longBitsToDouble()
java_lang_Double_doubleToRawLongBits, // implementation of java.lang.Double.doubleToRawLongBits()
java_lang_Thread_currentThread, // implementation of java.lang.Thread.currentThread()
number_of_method_entries,
invalid = -1
};

View File

@ -201,7 +201,9 @@ void TemplateInterpreterGenerator::generate_all() {
method_entry(java_lang_math_fmaF )
method_entry(java_lang_math_fmaD )
method_entry(java_lang_ref_reference_get)
#ifdef AMD64
method_entry(java_lang_Thread_currentThread)
#endif
AbstractInterpreter::initialize_method_handle_entries();
// all native method kinds (must be one contiguous block)
@ -431,6 +433,11 @@ address TemplateInterpreterGenerator::generate_method_entry(
: // fall thru
case Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer
: entry_point = generate_CRC32C_updateBytes_entry(kind); break;
#ifdef AMD64
case Interpreter::java_lang_Thread_currentThread
: entry_point = generate_currentThread(); break;
#endif
#ifdef IA32
// On x86_32 platforms, a special entry is generated for the following four methods.
// On other platforms the normal entry is used to enter these methods.

View File

@ -94,6 +94,9 @@ class TemplateInterpreterGenerator: public AbstractInterpreterGenerator {
address generate_CRC32_update_entry();
address generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind);
address generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind);
#ifdef AMD64
address generate_currentThread();
#endif
#ifdef IA32
address generate_Float_intBitsToFloat_entry();
address generate_Float_floatToRawIntBits_entry();