898
899 private:
900
901 StackGuardState _stack_guard_state;
902
903 // Precompute the limit of the stack as used in stack overflow checks.
904 // We load it from here to simplify the stack overflow check in assembly.
905 address _stack_overflow_limit;
906
907 // Compiler exception handling (NOTE: The _exception_oop is *NOT* the same as _pending_exception. It is
908 // used to temp. parsing values into and out of the runtime system during exception handling for compiled
909 // code)
910 volatile oop _exception_oop; // Exception thrown in compiled code
911 volatile address _exception_pc; // PC where exception happened
912 volatile address _exception_handler_pc; // PC for handler of exception
913 volatile int _is_method_handle_return; // true (== 1) if the current exception PC is a MethodHandle call site.
914
915 // support for JNI critical regions
916 jint _jni_active_critical; // count of entries into JNI critical region
917
918 // For deadlock detection.
919 int _depth_first_number;
920
921 // JVMTI PopFrame support
922 // This is set to popframe_pending to signal that top Java frame should be popped immediately
923 int _popframe_condition;
924
925 #ifndef PRODUCT
926 int _jmp_ring_index;
927 struct {
928 // We use intptr_t instead of address so debugger doesn't try and display strings
929 intptr_t _target;
930 intptr_t _instruction;
931 const char* _file;
932 int _line;
933 } _jmp_ring[ jump_ring_buffer_size ];
934 #endif /* PRODUCT */
935
936 #if INCLUDE_ALL_GCS
937 // Support for G1 barriers
1382 if (thread_from_jni_env->is_terminated()) {
1383 thread_from_jni_env->block_if_vm_exited();
1384 return NULL;
1385 } else {
1386 return thread_from_jni_env;
1387 }
1388 }
1389
1390 // JNI critical regions. These can nest.
1391 bool in_critical() { return _jni_active_critical > 0; }
1392 bool in_last_critical() { return _jni_active_critical == 1; }
1393 void enter_critical() { assert(Thread::current() == this ||
1394 Thread::current()->is_VM_thread() && SafepointSynchronize::is_synchronizing(),
1395 "this must be current thread or synchronizing");
1396 _jni_active_critical++; }
1397 void exit_critical() { assert(Thread::current() == this,
1398 "this must be current thread");
1399 _jni_active_critical--;
1400 assert(_jni_active_critical >= 0,
1401 "JNI critical nesting problem?"); }
1402
1403 // For deadlock detection
1404 int depth_first_number() { return _depth_first_number; }
1405 void set_depth_first_number(int dfn) { _depth_first_number = dfn; }
1406
1407 private:
1408 void set_monitor_chunks(MonitorChunk* monitor_chunks) { _monitor_chunks = monitor_chunks; }
1409
1410 public:
1411 MonitorChunk* monitor_chunks() const { return _monitor_chunks; }
1412 void add_monitor_chunk(MonitorChunk* chunk);
1413 void remove_monitor_chunk(MonitorChunk* chunk);
1414 bool in_deopt_handler() const { return _in_deopt_handler > 0; }
1415 void inc_in_deopt_handler() { _in_deopt_handler++; }
1416 void dec_in_deopt_handler() {
1417 assert(_in_deopt_handler > 0, "mismatched deopt nesting");
1418 if (_in_deopt_handler > 0) { // robustness
1419 _in_deopt_handler--;
1420 }
1421 }
|
898
899 private:
900
901 StackGuardState _stack_guard_state;
902
903 // Precompute the limit of the stack as used in stack overflow checks.
904 // We load it from here to simplify the stack overflow check in assembly.
905 address _stack_overflow_limit;
906
907 // Compiler exception handling (NOTE: The _exception_oop is *NOT* the same as _pending_exception. It is
908 // used to temp. parsing values into and out of the runtime system during exception handling for compiled
909 // code)
910 volatile oop _exception_oop; // Exception thrown in compiled code
911 volatile address _exception_pc; // PC where exception happened
912 volatile address _exception_handler_pc; // PC for handler of exception
913 volatile int _is_method_handle_return; // true (== 1) if the current exception PC is a MethodHandle call site.
914
915 // support for JNI critical regions
916 jint _jni_active_critical; // count of entries into JNI critical region
917
918 // Checked JNI: function name requires exception check
919 char* _pending_jni_exception_check_fn;
920
921 // For deadlock detection.
922 int _depth_first_number;
923
924 // JVMTI PopFrame support
925 // This is set to popframe_pending to signal that top Java frame should be popped immediately
926 int _popframe_condition;
927
928 #ifndef PRODUCT
929 int _jmp_ring_index;
930 struct {
931 // We use intptr_t instead of address so debugger doesn't try and display strings
932 intptr_t _target;
933 intptr_t _instruction;
934 const char* _file;
935 int _line;
936 } _jmp_ring[ jump_ring_buffer_size ];
937 #endif /* PRODUCT */
938
939 #if INCLUDE_ALL_GCS
940 // Support for G1 barriers
1385 if (thread_from_jni_env->is_terminated()) {
1386 thread_from_jni_env->block_if_vm_exited();
1387 return NULL;
1388 } else {
1389 return thread_from_jni_env;
1390 }
1391 }
1392
1393 // JNI critical regions. These can nest.
1394 bool in_critical() { return _jni_active_critical > 0; }
1395 bool in_last_critical() { return _jni_active_critical == 1; }
1396 void enter_critical() { assert(Thread::current() == this ||
1397 Thread::current()->is_VM_thread() && SafepointSynchronize::is_synchronizing(),
1398 "this must be current thread or synchronizing");
1399 _jni_active_critical++; }
1400 void exit_critical() { assert(Thread::current() == this,
1401 "this must be current thread");
1402 _jni_active_critical--;
1403 assert(_jni_active_critical >= 0,
1404 "JNI critical nesting problem?"); }
1405
1406 // Checked JNI, is the programmer required to check for exceptions, specify which function name
1407 bool is_pending_jni_exception_check() const { return _pending_jni_exception_check_fn != NULL; }
1408 void clear_pending_jni_exception_check() { _pending_jni_exception_check_fn = NULL; }
1409 const char* get_pending_jni_exception_check() const { return _pending_jni_exception_check_fn; }
1410 void set_pending_jni_exception_check(const char* fn_name) { _pending_jni_exception_check_fn = (char*) fn_name; }
1411
1412 // For deadlock detection
1413 int depth_first_number() { return _depth_first_number; }
1414 void set_depth_first_number(int dfn) { _depth_first_number = dfn; }
1415
1416 private:
1417 void set_monitor_chunks(MonitorChunk* monitor_chunks) { _monitor_chunks = monitor_chunks; }
1418
1419 public:
1420 MonitorChunk* monitor_chunks() const { return _monitor_chunks; }
1421 void add_monitor_chunk(MonitorChunk* chunk);
1422 void remove_monitor_chunk(MonitorChunk* chunk);
1423 bool in_deopt_handler() const { return _in_deopt_handler > 0; }
1424 void inc_in_deopt_handler() { _in_deopt_handler++; }
1425 void dec_in_deopt_handler() {
1426 assert(_in_deopt_handler > 0, "mismatched deopt nesting");
1427 if (_in_deopt_handler > 0) { // robustness
1428 _in_deopt_handler--;
1429 }
1430 }
|