798 public:
799 int java_call_counter() { return _java_call_counter; }
800 void inc_java_call_counter() { _java_call_counter++; }
801 void dec_java_call_counter() {
802 assert(_java_call_counter > 0, "Invalid nesting of JavaCallWrapper");
803 _java_call_counter--;
804 }
805 private: // restore original namespace restriction
806 #endif // ifdef ASSERT
807
808 #ifndef PRODUCT
809 public:
810 enum {
811 jump_ring_buffer_size = 16
812 };
813 private: // restore original namespace restriction
814 #endif
815
816 JavaFrameAnchor _anchor; // Encapsulation of current java frame and it state
817
818 ThreadFunction _entry_point;
819
820 JNIEnv _jni_environment;
821
822 // Deopt support
823 DeoptResourceMark* _deopt_mark; // Holds special ResourceMark for deoptimization
824
825 intptr_t* _must_deopt_id; // id of frame that needs to be deopted once we
826 // transition out of native
827 CompiledMethod* _deopt_nmethod; // CompiledMethod that is currently being deoptimized
828 vframeArray* _vframe_array_head; // Holds the heap of the active vframeArrays
829 vframeArray* _vframe_array_last; // Holds last vFrameArray we popped
830 // Because deoptimization is lazy we must save jvmti requests to set locals
831 // in compiled frames until we deoptimize and we have an interpreter frame.
832 // This holds the pointer to array (yeah like there might be more than one) of
833 // description of compiled vframes that have locals that need to be updated.
834 GrowableArray<jvmtiDeferredLocalVariableSet*>* _deferred_locals_updates;
835
836 // Handshake value for fixing 6243940. We need a place for the i2c
837 // adapter to store the callee Method*. This value is NEVER live
1085 address saved_exception_pc() { return _saved_exception_pc; }
1086
1087
1088 ThreadFunction entry_point() const { return _entry_point; }
1089
1090 // Allocates a new Java level thread object for this thread. thread_name may be NULL.
1091 void allocate_threadObj(Handle thread_group, const char* thread_name, bool daemon, TRAPS);
1092
1093 // Last frame anchor routines
1094
1095 JavaFrameAnchor* frame_anchor(void) { return &_anchor; }
1096
1097 // last_Java_sp
1098 bool has_last_Java_frame() const { return _anchor.has_last_Java_frame(); }
1099 intptr_t* last_Java_sp() const { return _anchor.last_Java_sp(); }
1100
1101 // last_Java_pc
1102
1103 address last_Java_pc(void) { return _anchor.last_Java_pc(); }
1104
1105 // Safepoint support
1106 #if !(defined(PPC64) || defined(AARCH64))
1107 JavaThreadState thread_state() const { return _thread_state; }
1108 void set_thread_state(JavaThreadState s) { _thread_state = s; }
1109 #else
1110 // Use membars when accessing volatile _thread_state. See
1111 // Threads::create_vm() for size checks.
1112 inline JavaThreadState thread_state() const;
1113 inline void set_thread_state(JavaThreadState s);
1114 #endif
1115 ThreadSafepointState *safepoint_state() const { return _safepoint_state; }
1116 void set_safepoint_state(ThreadSafepointState *state) { _safepoint_state = state; }
1117 bool is_at_poll_safepoint() { return _safepoint_state->is_at_poll_safepoint(); }
1118
1119 // thread has called JavaThread::exit() or is terminated
1120 bool is_exiting() { return _terminated == _thread_exiting || is_terminated(); }
1121 // thread is terminated (no longer on the threads list); we compare
1122 // against the two non-terminated values so that a freed JavaThread
1123 // will also be considered terminated.
1124 bool is_terminated() { return _terminated != _not_terminated && _terminated != _thread_exiting; }
1537
1538 // For assembly stub generation
1539 static ByteSize threadObj_offset() { return byte_offset_of(JavaThread, _threadObj); }
1540 #ifndef PRODUCT
1541 static ByteSize jmp_ring_index_offset() { return byte_offset_of(JavaThread, _jmp_ring_index); }
1542 static ByteSize jmp_ring_offset() { return byte_offset_of(JavaThread, _jmp_ring); }
1543 #endif // PRODUCT
1544 static ByteSize jni_environment_offset() { return byte_offset_of(JavaThread, _jni_environment); }
1545 static ByteSize pending_jni_exception_check_fn_offset() {
1546 return byte_offset_of(JavaThread, _pending_jni_exception_check_fn);
1547 }
1548 static ByteSize last_Java_sp_offset() {
1549 return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_sp_offset();
1550 }
1551 static ByteSize last_Java_pc_offset() {
1552 return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_pc_offset();
1553 }
1554 static ByteSize frame_anchor_offset() {
1555 return byte_offset_of(JavaThread, _anchor);
1556 }
1557 static ByteSize callee_target_offset() { return byte_offset_of(JavaThread, _callee_target); }
1558 static ByteSize vm_result_offset() { return byte_offset_of(JavaThread, _vm_result); }
1559 static ByteSize vm_result_2_offset() { return byte_offset_of(JavaThread, _vm_result_2); }
1560 static ByteSize thread_state_offset() { return byte_offset_of(JavaThread, _thread_state); }
1561 static ByteSize saved_exception_pc_offset() { return byte_offset_of(JavaThread, _saved_exception_pc); }
1562 static ByteSize osthread_offset() { return byte_offset_of(JavaThread, _osthread); }
1563 #if INCLUDE_JVMCI
1564 static ByteSize pending_deoptimization_offset() { return byte_offset_of(JavaThread, _pending_deoptimization); }
1565 static ByteSize pending_monitorenter_offset() { return byte_offset_of(JavaThread, _pending_monitorenter); }
1566 static ByteSize pending_failed_speculation_offset() { return byte_offset_of(JavaThread, _pending_failed_speculation); }
1567 static ByteSize jvmci_alternate_call_target_offset() { return byte_offset_of(JavaThread, _jvmci._alternate_call_target); }
1568 static ByteSize jvmci_implicit_exception_pc_offset() { return byte_offset_of(JavaThread, _jvmci._implicit_exception_pc); }
1569 static ByteSize jvmci_counters_offset() { return byte_offset_of(JavaThread, _jvmci_counters); }
1570 #endif // INCLUDE_JVMCI
1571 static ByteSize exception_oop_offset() { return byte_offset_of(JavaThread, _exception_oop); }
1572 static ByteSize exception_pc_offset() { return byte_offset_of(JavaThread, _exception_pc); }
1573 static ByteSize exception_handler_pc_offset() { return byte_offset_of(JavaThread, _exception_handler_pc); }
1574 static ByteSize stack_overflow_limit_offset() { return byte_offset_of(JavaThread, _stack_overflow_limit); }
1575 static ByteSize is_method_handle_return_offset() { return byte_offset_of(JavaThread, _is_method_handle_return); }
1576 static ByteSize stack_guard_state_offset() { return byte_offset_of(JavaThread, _stack_guard_state); }
|
798 public:
799 int java_call_counter() { return _java_call_counter; }
800 void inc_java_call_counter() { _java_call_counter++; }
801 void dec_java_call_counter() {
802 assert(_java_call_counter > 0, "Invalid nesting of JavaCallWrapper");
803 _java_call_counter--;
804 }
805 private: // restore original namespace restriction
806 #endif // ifdef ASSERT
807
808 #ifndef PRODUCT
809 public:
810 enum {
811 jump_ring_buffer_size = 16
812 };
813 private: // restore original namespace restriction
814 #endif
815
816 JavaFrameAnchor _anchor; // Encapsulation of current java frame and it state
817
818 size_t _bytes_until_sample; // Thread local counter to determine when to sample
819 // allocations.
820
821 ThreadFunction _entry_point;
822
823 JNIEnv _jni_environment;
824
825 // Deopt support
826 DeoptResourceMark* _deopt_mark; // Holds special ResourceMark for deoptimization
827
828 intptr_t* _must_deopt_id; // id of frame that needs to be deopted once we
829 // transition out of native
830 CompiledMethod* _deopt_nmethod; // CompiledMethod that is currently being deoptimized
831 vframeArray* _vframe_array_head; // Holds the heap of the active vframeArrays
832 vframeArray* _vframe_array_last; // Holds last vFrameArray we popped
833 // Because deoptimization is lazy we must save jvmti requests to set locals
834 // in compiled frames until we deoptimize and we have an interpreter frame.
835 // This holds the pointer to array (yeah like there might be more than one) of
836 // description of compiled vframes that have locals that need to be updated.
837 GrowableArray<jvmtiDeferredLocalVariableSet*>* _deferred_locals_updates;
838
839 // Handshake value for fixing 6243940. We need a place for the i2c
840 // adapter to store the callee Method*. This value is NEVER live
1088 address saved_exception_pc() { return _saved_exception_pc; }
1089
1090
1091 ThreadFunction entry_point() const { return _entry_point; }
1092
1093 // Allocates a new Java level thread object for this thread. thread_name may be NULL.
1094 void allocate_threadObj(Handle thread_group, const char* thread_name, bool daemon, TRAPS);
1095
1096 // Last frame anchor routines
1097
1098 JavaFrameAnchor* frame_anchor(void) { return &_anchor; }
1099
1100 // last_Java_sp
1101 bool has_last_Java_frame() const { return _anchor.has_last_Java_frame(); }
1102 intptr_t* last_Java_sp() const { return _anchor.last_Java_sp(); }
1103
1104 // last_Java_pc
1105
1106 address last_Java_pc(void) { return _anchor.last_Java_pc(); }
1107
1108 // Bytes until next heap sample.
1109 size_t* bytes_until_sample() { return &_bytes_until_sample; }
1110
1111 // Safepoint support
1112 #if !(defined(PPC64) || defined(AARCH64))
1113 JavaThreadState thread_state() const { return _thread_state; }
1114 void set_thread_state(JavaThreadState s) { _thread_state = s; }
1115 #else
1116 // Use membars when accessing volatile _thread_state. See
1117 // Threads::create_vm() for size checks.
1118 inline JavaThreadState thread_state() const;
1119 inline void set_thread_state(JavaThreadState s);
1120 #endif
1121 ThreadSafepointState *safepoint_state() const { return _safepoint_state; }
1122 void set_safepoint_state(ThreadSafepointState *state) { _safepoint_state = state; }
1123 bool is_at_poll_safepoint() { return _safepoint_state->is_at_poll_safepoint(); }
1124
1125 // thread has called JavaThread::exit() or is terminated
1126 bool is_exiting() { return _terminated == _thread_exiting || is_terminated(); }
1127 // thread is terminated (no longer on the threads list); we compare
1128 // against the two non-terminated values so that a freed JavaThread
1129 // will also be considered terminated.
1130 bool is_terminated() { return _terminated != _not_terminated && _terminated != _thread_exiting; }
1543
1544 // For assembly stub generation
1545 static ByteSize threadObj_offset() { return byte_offset_of(JavaThread, _threadObj); }
1546 #ifndef PRODUCT
1547 static ByteSize jmp_ring_index_offset() { return byte_offset_of(JavaThread, _jmp_ring_index); }
1548 static ByteSize jmp_ring_offset() { return byte_offset_of(JavaThread, _jmp_ring); }
1549 #endif // PRODUCT
1550 static ByteSize jni_environment_offset() { return byte_offset_of(JavaThread, _jni_environment); }
1551 static ByteSize pending_jni_exception_check_fn_offset() {
1552 return byte_offset_of(JavaThread, _pending_jni_exception_check_fn);
1553 }
1554 static ByteSize last_Java_sp_offset() {
1555 return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_sp_offset();
1556 }
1557 static ByteSize last_Java_pc_offset() {
1558 return byte_offset_of(JavaThread, _anchor) + JavaFrameAnchor::last_Java_pc_offset();
1559 }
1560 static ByteSize frame_anchor_offset() {
1561 return byte_offset_of(JavaThread, _anchor);
1562 }
1563 static ByteSize bytes_until_sample_offset() { return byte_offset_of(JavaThread, _bytes_until_sample); }
1564 static ByteSize callee_target_offset() { return byte_offset_of(JavaThread, _callee_target); }
1565 static ByteSize vm_result_offset() { return byte_offset_of(JavaThread, _vm_result); }
1566 static ByteSize vm_result_2_offset() { return byte_offset_of(JavaThread, _vm_result_2); }
1567 static ByteSize thread_state_offset() { return byte_offset_of(JavaThread, _thread_state); }
1568 static ByteSize saved_exception_pc_offset() { return byte_offset_of(JavaThread, _saved_exception_pc); }
1569 static ByteSize osthread_offset() { return byte_offset_of(JavaThread, _osthread); }
1570 #if INCLUDE_JVMCI
1571 static ByteSize pending_deoptimization_offset() { return byte_offset_of(JavaThread, _pending_deoptimization); }
1572 static ByteSize pending_monitorenter_offset() { return byte_offset_of(JavaThread, _pending_monitorenter); }
1573 static ByteSize pending_failed_speculation_offset() { return byte_offset_of(JavaThread, _pending_failed_speculation); }
1574 static ByteSize jvmci_alternate_call_target_offset() { return byte_offset_of(JavaThread, _jvmci._alternate_call_target); }
1575 static ByteSize jvmci_implicit_exception_pc_offset() { return byte_offset_of(JavaThread, _jvmci._implicit_exception_pc); }
1576 static ByteSize jvmci_counters_offset() { return byte_offset_of(JavaThread, _jvmci_counters); }
1577 #endif // INCLUDE_JVMCI
1578 static ByteSize exception_oop_offset() { return byte_offset_of(JavaThread, _exception_oop); }
1579 static ByteSize exception_pc_offset() { return byte_offset_of(JavaThread, _exception_pc); }
1580 static ByteSize exception_handler_pc_offset() { return byte_offset_of(JavaThread, _exception_handler_pc); }
1581 static ByteSize stack_overflow_limit_offset() { return byte_offset_of(JavaThread, _stack_overflow_limit); }
1582 static ByteSize is_method_handle_return_offset() { return byte_offset_of(JavaThread, _is_method_handle_return); }
1583 static ByteSize stack_guard_state_offset() { return byte_offset_of(JavaThread, _stack_guard_state); }
|