diff --git a/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp b/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp index 5a6ee1de1db..66a35e6e3b4 100644 --- a/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp @@ -1442,6 +1442,17 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) { return entry_point; } +// Method entry for java.lang.Thread.currentThread +address TemplateInterpreterGenerator::generate_currentThread() { + address entry_point = __ pc(); + + __ ld(x10, Address(xthread, JavaThread::vthread_offset())); + __ resolve_oop_handle(x10, t0, t1); + __ ret(); + + return entry_point; +} + //----------------------------------------------------------------------------- // Exceptions diff --git a/src/hotspot/share/interpreter/abstractInterpreter.cpp b/src/hotspot/share/interpreter/abstractInterpreter.cpp index 97a658e509a..4a795d4ec54 100644 --- a/src/hotspot/share/interpreter/abstractInterpreter.cpp +++ b/src/hotspot/share/interpreter/abstractInterpreter.cpp @@ -133,7 +133,7 @@ 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; -#if defined(AMD64) || defined(AARCH64) +#if defined(AMD64) || defined(AARCH64) || defined(RISCV64) case vmIntrinsics::_currentThread: return java_lang_Thread_currentThread; #endif #endif // ZERO diff --git a/src/hotspot/share/interpreter/templateInterpreterGenerator.cpp b/src/hotspot/share/interpreter/templateInterpreterGenerator.cpp index a460cac90bb..18732a8dfcd 100644 --- a/src/hotspot/share/interpreter/templateInterpreterGenerator.cpp +++ b/src/hotspot/share/interpreter/templateInterpreterGenerator.cpp @@ -201,7 +201,7 @@ void TemplateInterpreterGenerator::generate_all() { method_entry(java_lang_math_fmaF ) method_entry(java_lang_math_fmaD ) method_entry(java_lang_ref_reference_get) -#if defined(AMD64) || defined(AARCH64) +#if defined(AMD64) || defined(AARCH64) || defined(RISCV64) method_entry(java_lang_Thread_currentThread) #endif AbstractInterpreter::initialize_method_handle_entries(); @@ -433,7 +433,7 @@ address TemplateInterpreterGenerator::generate_method_entry( : // fall thru case Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer : entry_point = generate_CRC32C_updateBytes_entry(kind); break; -#if defined(AMD64) || defined(AARCH64) +#if defined(AMD64) || defined(AARCH64) || defined(RISCV64) case Interpreter::java_lang_Thread_currentThread : entry_point = generate_currentThread(); break; #endif diff --git a/src/hotspot/share/interpreter/templateInterpreterGenerator.hpp b/src/hotspot/share/interpreter/templateInterpreterGenerator.hpp index e57c6c65450..df9fb5276b3 100644 --- a/src/hotspot/share/interpreter/templateInterpreterGenerator.hpp +++ b/src/hotspot/share/interpreter/templateInterpreterGenerator.hpp @@ -94,7 +94,7 @@ 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); -#if defined(AMD64) || defined(AARCH64) +#if defined(AMD64) || defined(AARCH64) || defined(RISCV64) address generate_currentThread(); #endif #ifdef IA32