264 _has_async_exception = 0x00000001U, // there is a pending async exception 265 _critical_native_unlock = 0x00000002U, // Must call back to unlock JNI critical lock 266 267 _trace_flag = 0x00000004U // call tracing backend 268 }; 269 270 // various suspension related flags - atomically updated 271 // overloaded for async exception checking in check_special_condition_for_native_trans. 272 volatile uint32_t _suspend_flags; 273 274 private: 275 int _num_nested_signal; 276 277 DEBUG_ONLY(bool _suspendible_thread;) 278 279 public: 280 void enter_signal_handler() { _num_nested_signal++; } 281 void leave_signal_handler() { _num_nested_signal--; } 282 bool is_inside_signal_handler() const { return _num_nested_signal > 0; } 283 284 #ifdef ASSERT 285 void set_suspendible_thread() { 286 _suspendible_thread = true; 287 } 288 289 void clear_suspendible_thread() { 290 _suspendible_thread = false; 291 } 292 293 bool is_suspendible_thread() { return _suspendible_thread; } 294 #endif 295 296 private: 297 // Active_handles points to a block of handles 298 JNIHandleBlock* _active_handles; 299 300 // One-element thread local free list 301 JNIHandleBlock* _free_handle_block; 302 303 // Point to the last handle mark 1031 1032 private: 1033 1034 #if INCLUDE_JVMCI 1035 // The _pending_* fields below are used to communicate extra information 1036 // from an uncommon trap in JVMCI compiled code to the uncommon trap handler. 1037 1038 // Communicates the DeoptReason and DeoptAction of the uncommon trap 1039 int _pending_deoptimization; 1040 1041 // Specifies whether the uncommon trap is to bci 0 of a synchronized method 1042 // before the monitor has been acquired. 1043 bool _pending_monitorenter; 1044 1045 // Specifies if the DeoptReason for the last uncommon trap was Reason_transfer_to_interpreter 1046 bool _pending_transfer_to_interpreter; 1047 1048 // Guard for re-entrant call to JVMCIRuntime::adjust_comp_level 1049 bool _adjusting_comp_level; 1050 1051 // An id of a speculation that JVMCI compiled code can use to further describe and 1052 // uniquely identify the speculative optimization guarded by the uncommon trap 1053 long _pending_failed_speculation; 1054 1055 // These fields are mutually exclusive in terms of live ranges. 1056 union { 1057 // Communicates the pc at which the most recent implicit exception occurred 1058 // from the signal handler to a deoptimization stub. 1059 address _implicit_exception_pc; 1060 1061 // Communicates an alternative call target to an i2c stub from a JavaCall . 1062 address _alternate_call_target; 1063 } _jvmci; 1064 1065 // Support for high precision, thread sensitive counters in JVMCI compiled code. 1066 jlong* _jvmci_counters; 1067 1068 public: 1069 static jlong* _jvmci_old_thread_counters; 1070 static void collect_counters(typeArrayOop array); 1451 void set_vm_result (oop x) { _vm_result = x; } 1452 1453 Metadata* vm_result_2() const { return _vm_result_2; } 1454 void set_vm_result_2 (Metadata* x) { _vm_result_2 = x; } 1455 1456 MemRegion deferred_card_mark() const { return _deferred_card_mark; } 1457 void set_deferred_card_mark(MemRegion mr) { _deferred_card_mark = mr; } 1458 1459 #if INCLUDE_JVMCI 1460 int pending_deoptimization() const { return _pending_deoptimization; } 1461 long pending_failed_speculation() const { return _pending_failed_speculation; } 1462 bool adjusting_comp_level() const { return _adjusting_comp_level; } 1463 void set_adjusting_comp_level(bool b) { _adjusting_comp_level = b; } 1464 bool has_pending_monitorenter() const { return _pending_monitorenter; } 1465 void set_pending_monitorenter(bool b) { _pending_monitorenter = b; } 1466 void set_pending_deoptimization(int reason) { _pending_deoptimization = reason; } 1467 void set_pending_failed_speculation(long failed_speculation) { _pending_failed_speculation = failed_speculation; } 1468 void set_pending_transfer_to_interpreter(bool b) { _pending_transfer_to_interpreter = b; } 1469 void set_jvmci_alternate_call_target(address a) { assert(_jvmci._alternate_call_target == NULL, "must be"); _jvmci._alternate_call_target = a; } 1470 void set_jvmci_implicit_exception_pc(address a) { assert(_jvmci._implicit_exception_pc == NULL, "must be"); _jvmci._implicit_exception_pc = a; } 1471 #endif // INCLUDE_JVMCI 1472 1473 // Exception handling for compiled methods 1474 oop exception_oop() const { return _exception_oop; } 1475 address exception_pc() const { return _exception_pc; } 1476 address exception_handler_pc() const { return _exception_handler_pc; } 1477 bool is_method_handle_return() const { return _is_method_handle_return == 1; } 1478 1479 void set_exception_oop(oop o) { (void)const_cast<oop&>(_exception_oop = o); } 1480 void set_exception_pc(address a) { _exception_pc = a; } 1481 void set_exception_handler_pc(address a) { _exception_handler_pc = a; } 1482 void set_is_method_handle_return(bool value) { _is_method_handle_return = value ? 1 : 0; } 1483 1484 void clear_exception_oop_and_pc() { 1485 set_exception_oop(NULL); 1486 set_exception_pc(NULL); 1487 } 1488 1489 // Stack overflow support 1490 // | 264 _has_async_exception = 0x00000001U, // there is a pending async exception 265 _critical_native_unlock = 0x00000002U, // Must call back to unlock JNI critical lock 266 267 _trace_flag = 0x00000004U // call tracing backend 268 }; 269 270 // various suspension related flags - atomically updated 271 // overloaded for async exception checking in check_special_condition_for_native_trans. 272 volatile uint32_t _suspend_flags; 273 274 private: 275 int _num_nested_signal; 276 277 DEBUG_ONLY(bool _suspendible_thread;) 278 279 public: 280 void enter_signal_handler() { _num_nested_signal++; } 281 void leave_signal_handler() { _num_nested_signal--; } 282 bool is_inside_signal_handler() const { return _num_nested_signal > 0; } 283 284 // Determines if a heap allocation failure will be retried 285 // (e.g., by deoptimizing and re-executing in the interpreter). 286 // In this case, the failed allocation must raise 287 // Universe::out_of_memory_error_retry() and omit side effects 288 // such as JVMTI events and handling -XX:+HeapDumpOnOutOfMemoryError 289 // and -XX:OnOutOfMemoryError. 290 virtual bool in_retryable_allocation() const { return false; } 291 292 #ifdef ASSERT 293 void set_suspendible_thread() { 294 _suspendible_thread = true; 295 } 296 297 void clear_suspendible_thread() { 298 _suspendible_thread = false; 299 } 300 301 bool is_suspendible_thread() { return _suspendible_thread; } 302 #endif 303 304 private: 305 // Active_handles points to a block of handles 306 JNIHandleBlock* _active_handles; 307 308 // One-element thread local free list 309 JNIHandleBlock* _free_handle_block; 310 311 // Point to the last handle mark 1039 1040 private: 1041 1042 #if INCLUDE_JVMCI 1043 // The _pending_* fields below are used to communicate extra information 1044 // from an uncommon trap in JVMCI compiled code to the uncommon trap handler. 1045 1046 // Communicates the DeoptReason and DeoptAction of the uncommon trap 1047 int _pending_deoptimization; 1048 1049 // Specifies whether the uncommon trap is to bci 0 of a synchronized method 1050 // before the monitor has been acquired. 1051 bool _pending_monitorenter; 1052 1053 // Specifies if the DeoptReason for the last uncommon trap was Reason_transfer_to_interpreter 1054 bool _pending_transfer_to_interpreter; 1055 1056 // Guard for re-entrant call to JVMCIRuntime::adjust_comp_level 1057 bool _adjusting_comp_level; 1058 1059 // True if in a runtime call from compiled code that will deoptimize 1060 // and re-execute a failed heap allocation in the interpreter. 1061 bool _in_retryable_allocation; 1062 1063 // An id of a speculation that JVMCI compiled code can use to further describe and 1064 // uniquely identify the speculative optimization guarded by the uncommon trap 1065 long _pending_failed_speculation; 1066 1067 // These fields are mutually exclusive in terms of live ranges. 1068 union { 1069 // Communicates the pc at which the most recent implicit exception occurred 1070 // from the signal handler to a deoptimization stub. 1071 address _implicit_exception_pc; 1072 1073 // Communicates an alternative call target to an i2c stub from a JavaCall . 1074 address _alternate_call_target; 1075 } _jvmci; 1076 1077 // Support for high precision, thread sensitive counters in JVMCI compiled code. 1078 jlong* _jvmci_counters; 1079 1080 public: 1081 static jlong* _jvmci_old_thread_counters; 1082 static void collect_counters(typeArrayOop array); 1463 void set_vm_result (oop x) { _vm_result = x; } 1464 1465 Metadata* vm_result_2() const { return _vm_result_2; } 1466 void set_vm_result_2 (Metadata* x) { _vm_result_2 = x; } 1467 1468 MemRegion deferred_card_mark() const { return _deferred_card_mark; } 1469 void set_deferred_card_mark(MemRegion mr) { _deferred_card_mark = mr; } 1470 1471 #if INCLUDE_JVMCI 1472 int pending_deoptimization() const { return _pending_deoptimization; } 1473 long pending_failed_speculation() const { return _pending_failed_speculation; } 1474 bool adjusting_comp_level() const { return _adjusting_comp_level; } 1475 void set_adjusting_comp_level(bool b) { _adjusting_comp_level = b; } 1476 bool has_pending_monitorenter() const { return _pending_monitorenter; } 1477 void set_pending_monitorenter(bool b) { _pending_monitorenter = b; } 1478 void set_pending_deoptimization(int reason) { _pending_deoptimization = reason; } 1479 void set_pending_failed_speculation(long failed_speculation) { _pending_failed_speculation = failed_speculation; } 1480 void set_pending_transfer_to_interpreter(bool b) { _pending_transfer_to_interpreter = b; } 1481 void set_jvmci_alternate_call_target(address a) { assert(_jvmci._alternate_call_target == NULL, "must be"); _jvmci._alternate_call_target = a; } 1482 void set_jvmci_implicit_exception_pc(address a) { assert(_jvmci._implicit_exception_pc == NULL, "must be"); _jvmci._implicit_exception_pc = a; } 1483 1484 virtual bool in_retryable_allocation() const { return _in_retryable_allocation; } 1485 void set_in_retryable_allocation(bool b) { _in_retryable_allocation = b; } 1486 #endif // INCLUDE_JVMCI 1487 1488 // Exception handling for compiled methods 1489 oop exception_oop() const { return _exception_oop; } 1490 address exception_pc() const { return _exception_pc; } 1491 address exception_handler_pc() const { return _exception_handler_pc; } 1492 bool is_method_handle_return() const { return _is_method_handle_return == 1; } 1493 1494 void set_exception_oop(oop o) { (void)const_cast<oop&>(_exception_oop = o); } 1495 void set_exception_pc(address a) { _exception_pc = a; } 1496 void set_exception_handler_pc(address a) { _exception_handler_pc = a; } 1497 void set_is_method_handle_return(bool value) { _is_method_handle_return = value ? 1 : 0; } 1498 1499 void clear_exception_oop_and_pc() { 1500 set_exception_oop(NULL); 1501 set_exception_pc(NULL); 1502 } 1503 1504 // Stack overflow support 1505 // |