(original) (raw)
--- old/src/share/vm/runtime/thread.hpp 2015-09-16 15:19:10.000000000 -0700 +++ new/src/share/vm/runtime/thread.hpp 2015-09-16 15:19:09.000000000 -0700 @@ -329,6 +329,9 @@ virtual bool is_Named_thread() const { return false; } virtual bool is_Worker_thread() const { return false; } + // Can this thread make Java upcalls + virtual bool can_call_java() const { return false; } + // Casts virtual WorkerThread* as_Worker_thread() const { return NULL; } @@ -892,6 +895,43 @@ private: +#if INCLUDE_JVMCI + // The _pending_* fields below are used to communicate extra information + // from an uncommon trap in JVMCI compiled code to the uncommon trap handler. + + // Communicates the DeoptReason and DeoptAction of the uncommon trap + int _pending_deoptimization; + + // An object that JVMCI compiled code can use to further describe and + // uniquely identify the speculative optimization guarded by the uncommon trap + oop _pending_failed_speculation; + + // Specifies whether the uncommon trap is to bci 0 of a synchronized method + // before the monitor has been acquired. + bool _pending_monitorenter; + + // Specifies if the DeoptReason for the last uncommon trap was Reason_transfer_to_interpreter + bool _pending_transfer_to_interpreter; + + // These fields are mutually exclusive in terms of live ranges. + union { + // 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: + static jlong* _jvmci_old_thread_counters; + static void collect_counters(typeArrayOop array); + private: +#endif + StackGuardState _stack_guard_state; // Precompute the limit of the stack as used in stack overflow checks. @@ -906,6 +946,7 @@ volatile address _exception_handler_pc; // PC for handler of exception volatile int _is_method_handle_return; // true (== 1) if the current exception PC is a MethodHandle call site. + private: // support for JNI critical regions jint _jni_active_critical; // count of entries into JNI critical region @@ -993,6 +1034,7 @@ // Testers virtual bool is_Java_thread() const { return true; } + virtual bool can_call_java() const { return true; } // Thread chain operations JavaThread* next() const { return _next; } @@ -1251,6 +1293,18 @@ MemRegion deferred_card_mark() const { return _deferred_card_mark; } void set_deferred_card_mark(MemRegion mr) { _deferred_card_mark = mr; } +#if INCLUDE_JVMCI + int pending_deoptimization() const { return _pending_deoptimization; } + oop pending_failed_speculation() const { return _pending_failed_speculation; } + bool has_pending_monitorenter() const { return _pending_monitorenter; } + void set_pending_monitorenter(bool b) { _pending_monitorenter = b; } + 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) { 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 oop exception_oop() const { return _exception_oop; } address exception_pc() const { return _exception_pc; } @@ -1351,6 +1405,14 @@ static ByteSize thread_state_offset() { return byte_offset_of(JavaThread, _thread_state); } static ByteSize saved_exception_pc_offset() { return byte_offset_of(JavaThread, _saved_exception_pc); } static ByteSize osthread_offset() { return byte_offset_of(JavaThread, _osthread); } +#if INCLUDE_JVMCI + 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_counters_offset() { return byte_offset_of(JavaThread, _jvmci_counters); } +#endif static ByteSize exception_oop_offset() { return byte_offset_of(JavaThread, _exception_oop); } static ByteSize exception_pc_offset() { return byte_offset_of(JavaThread, _exception_pc); } static ByteSize exception_handler_pc_offset() { return byte_offset_of(JavaThread, _exception_handler_pc); } @@ -1820,8 +1882,11 @@ CompilerThread(CompileQueue* queue, CompilerCounters* counters); bool is_Compiler_thread() const { return true; } - // Hide this compiler thread from external view. - bool is_hidden_from_external_view() const { return true; } + + virtual bool can_call_java() const; + + // Hide native compiler threads from external view. + bool is_hidden_from_external_view() const { return !can_call_java(); } void set_compiler(AbstractCompiler* c) { _compiler = c; } AbstractCompiler* compiler() const { return _compiler; }