src/share/vm/runtime/deoptimization.cpp

Print this page




1374     }
1375   }
1376 }
1377 
1378 
1379 void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int index) {
1380   EXCEPTION_MARK;
1381   load_class_by_index(constant_pool, index, THREAD);
1382   if (HAS_PENDING_EXCEPTION) {
1383     // Exception happened during classloading. We ignore the exception here, since it
1384     // is going to be rethrown since the current activation is going to be deoptimized and
1385     // the interpreter will re-execute the bytecode.
1386     CLEAR_PENDING_EXCEPTION;
1387     // Class loading called java code which may have caused a stack
1388     // overflow. If the exception was thrown right before the return
1389     // to the runtime the stack is no longer guarded. Reguard the
1390     // stack otherwise if we return to the uncommon trap blob and the
1391     // stack bang causes a stack overflow we crash.
1392     assert(THREAD->is_Java_thread(), "only a java thread can be here");
1393     JavaThread* thread = (JavaThread*)THREAD;
1394     bool guard_pages_enabled = thread->stack_yellow_zone_enabled();
1395     if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack();
1396     assert(guard_pages_enabled, "stack banging in uncommon trap blob may cause crash");
1397   }
1398 }
1399 
1400 JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint trap_request)) {
1401   HandleMark hm;
1402 
1403   // uncommon_trap() is called at the beginning of the uncommon trap
1404   // handler. Note this fact before we start generating temporary frames
1405   // that can confuse an asynchronous stack walker. This counter is
1406   // decremented at the end of unpack_frames().
1407   thread->inc_in_deopt_handler();
1408 
1409   // We need to update the map if we have biased locking.
1410 #if INCLUDE_JVMCI
1411   // JVMCI might need to get an exception from the stack, which in turn requires the register map to be valid
1412   RegisterMap reg_map(thread, true);
1413 #else
1414   RegisterMap reg_map(thread, UseBiasedLocking);




1374     }
1375   }
1376 }
1377 
1378 
1379 void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int index) {
1380   EXCEPTION_MARK;
1381   load_class_by_index(constant_pool, index, THREAD);
1382   if (HAS_PENDING_EXCEPTION) {
1383     // Exception happened during classloading. We ignore the exception here, since it
1384     // is going to be rethrown since the current activation is going to be deoptimized and
1385     // the interpreter will re-execute the bytecode.
1386     CLEAR_PENDING_EXCEPTION;
1387     // Class loading called java code which may have caused a stack
1388     // overflow. If the exception was thrown right before the return
1389     // to the runtime the stack is no longer guarded. Reguard the
1390     // stack otherwise if we return to the uncommon trap blob and the
1391     // stack bang causes a stack overflow we crash.
1392     assert(THREAD->is_Java_thread(), "only a java thread can be here");
1393     JavaThread* thread = (JavaThread*)THREAD;
1394     bool guard_pages_enabled = thread->stack_guards_enabled();
1395     if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack();
1396     assert(guard_pages_enabled, "stack banging in uncommon trap blob may cause crash");
1397   }
1398 }
1399 
1400 JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* thread, jint trap_request)) {
1401   HandleMark hm;
1402 
1403   // uncommon_trap() is called at the beginning of the uncommon trap
1404   // handler. Note this fact before we start generating temporary frames
1405   // that can confuse an asynchronous stack walker. This counter is
1406   // decremented at the end of unpack_frames().
1407   thread->inc_in_deopt_handler();
1408 
1409   // We need to update the map if we have biased locking.
1410 #if INCLUDE_JVMCI
1411   // JVMCI might need to get an exception from the stack, which in turn requires the register map to be valid
1412   RegisterMap reg_map(thread, true);
1413 #else
1414   RegisterMap reg_map(thread, UseBiasedLocking);