Mercurial > hg > graal-jvmci-8
changeset 22465:b14500c9da22
documented JVMCI-specific _implicit_exception_pc and _alternate_call_target fields in JavaThread and prepared for them to be in a union
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 25 Aug 2015 14:34:50 +0200 |
parents | 3fb432661d59 |
children | 5e61ca976049 |
files | src/cpu/sparc/vm/sharedRuntime_sparc.cpp src/cpu/x86/vm/sharedRuntime_x86_64.cpp src/share/vm/runtime/javaCalls.cpp src/share/vm/runtime/thread.cpp src/share/vm/runtime/thread.hpp |
diffstat | 5 files changed, 27 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Tue Aug 25 13:56:32 2015 +0200 +++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp Tue Aug 25 14:34:50 2015 +0200 @@ -3542,6 +3542,7 @@ masm->block_comment("BEGIN JVMCI"); int implicit_exception_uncommon_trap_offset = __ offset() - start; __ ld_ptr(G2_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset()), O7); + DEBUG_ONLY(__ st(G0, Address(G2_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset())));) __ add(O7, -8, O7); int uncommon_trap_offset = __ offset() - start;
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Tue Aug 25 13:56:32 2015 +0200 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Tue Aug 25 14:34:50 2015 +0200 @@ -3397,6 +3397,7 @@ int implicit_exception_uncommon_trap_offset = __ pc() - start; __ pushptr(Address(r15_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset()))); + DEBUG_ONLY(__ movptr(Address(r15_thread, in_bytes(JavaThread::jvmci_implicit_exception_pc_offset())), (int32_t)NULL_WORD);) int uncommon_trap_offset = __ pc() - start;
--- a/src/share/vm/runtime/javaCalls.cpp Tue Aug 25 13:56:32 2015 +0200 +++ b/src/share/vm/runtime/javaCalls.cpp Tue Aug 25 14:34:50 2015 +0200 @@ -327,8 +327,9 @@ CHECK_UNHANDLED_OOPS_ONLY(thread->clear_unhandled_oops();) #if INCLUDE_JVMCI - nmethod* nm = args->alternative_target(); - if (nm == NULL) { + // Gets the nmethod (if any) that should be called instead of normal target + nmethod* alternative_target = args->alternative_target(); + if (alternative_target == NULL) { #endif // Verify the arguments @@ -402,9 +403,9 @@ } #if INCLUDE_JVMCI - if (nm != NULL) { - if (nm->is_alive()) { - thread->set_jvmci_alternate_call_target(nm->verified_entry_point()); + if (alternative_target != NULL) { + if (alternative_target->is_alive()) { + thread->set_jvmci_alternate_call_target(alternative_target->verified_entry_point()); entry_point = method->adapter()->get_i2c_entry(); } else { THROW(vmSymbols::jdk_internal_jvmci_code_InvalidInstalledCodeException());
--- a/src/share/vm/runtime/thread.cpp Tue Aug 25 13:56:32 2015 +0200 +++ b/src/share/vm/runtime/thread.cpp Tue Aug 25 14:34:50 2015 +0200 @@ -1488,8 +1488,10 @@ _pending_deoptimization = -1; _pending_failed_speculation = NULL; _pending_transfer_to_interpreter = false; - _jvmci_alternate_call_target = NULL; - _jvmci_implicit_exception_pc = NULL; + _jvmci._alternate_call_target = NULL; + // TODO: If _jvmci becomes a union, then this assignment + // should be converted to an assertion or guarantee + _jvmci._implicit_exception_pc = NULL; if (JVMCICounterSize > 0) { _jvmci_counters = NEW_C_HEAP_ARRAY(jlong, JVMCICounterSize, mtInternal); memset(_jvmci_counters, 0, sizeof(jlong) * JVMCICounterSize);
--- a/src/share/vm/runtime/thread.hpp Tue Aug 25 13:56:32 2015 +0200 +++ b/src/share/vm/runtime/thread.hpp Tue Aug 25 14:34:50 2015 +0200 @@ -921,9 +921,18 @@ oop _pending_failed_speculation; bool _pending_monitorenter; bool _pending_transfer_to_interpreter; - address _jvmci_alternate_call_target; - address _jvmci_implicit_exception_pc; // pc at which the most recent implicit exception occurred + // These fields are mutually exclusive in terms of live ranges + // so this could be a union instead of a struct. + struct { + // Communicates the pc at which the most recent implicit exception occurred + // from the signal handler to a deoptimization stub. + address _implicit_exception_pc; + // Communicates an alternative call target to an i2c stub from a JavaCall. + address _alternate_call_target; // + } _jvmci; + + // Support for high precision, thread sensitive counters in JVMCI compiled code. jlong* _jvmci_counters; public: @@ -1314,8 +1323,8 @@ void set_pending_deoptimization(int reason) { _pending_deoptimization = reason; } void set_pending_failed_speculation(oop failed_speculation) { _pending_failed_speculation = failed_speculation; } void set_pending_transfer_to_interpreter(bool b) { _pending_transfer_to_interpreter = b; } - void set_jvmci_alternate_call_target(address a) { _jvmci_alternate_call_target = a; } - void set_jvmci_implicit_exception_pc(address a) { _jvmci_implicit_exception_pc = a; } + void set_jvmci_alternate_call_target(address a) { assert(_jvmci._alternate_call_target == NULL, "must be"); _jvmci._alternate_call_target = a; } + void set_jvmci_implicit_exception_pc(address a) { assert(_jvmci._implicit_exception_pc == NULL, "must be"); _jvmci._implicit_exception_pc = a; } #endif // Exception handling for compiled methods @@ -1415,8 +1424,8 @@ static ByteSize pending_deoptimization_offset() { return byte_offset_of(JavaThread, _pending_deoptimization); } static ByteSize pending_monitorenter_offset() { return byte_offset_of(JavaThread, _pending_monitorenter); } static ByteSize pending_failed_speculation_offset() { return byte_offset_of(JavaThread, _pending_failed_speculation); } - static ByteSize jvmci_alternate_call_target_offset() { return byte_offset_of(JavaThread, _jvmci_alternate_call_target); } - static ByteSize jvmci_implicit_exception_pc_offset() { return byte_offset_of(JavaThread, _jvmci_implicit_exception_pc); } + static ByteSize jvmci_alternate_call_target_offset() { return byte_offset_of(JavaThread, _jvmci._alternate_call_target); } + static ByteSize jvmci_implicit_exception_pc_offset() { return byte_offset_of(JavaThread, _jvmci._implicit_exception_pc); } static ByteSize jvmci_counters_offset() { return byte_offset_of(JavaThread, _jvmci_counters ); } #endif static ByteSize exception_oop_offset() { return byte_offset_of(JavaThread, _exception_oop ); }