1347 |
1347 |
1348 handler_address = |
1348 handler_address = |
1349 force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc); |
1349 force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc); |
1350 |
1350 |
1351 if (handler_address == NULL) { |
1351 if (handler_address == NULL) { |
1352 Handle original_exception(thread, exception()); |
1352 bool recursive_exception = false; |
1353 handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true); |
1353 handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true, recursive_exception); |
1354 assert (handler_address != NULL, "must have compiled handler"); |
1354 assert (handler_address != NULL, "must have compiled handler"); |
1355 // Update the exception cache only when the unwind was not forced |
1355 // Update the exception cache only when the unwind was not forced |
1356 // and there didn't happen another exception during the computation of the |
1356 // and there didn't happen another exception during the computation of the |
1357 // compiled exception handler. |
1357 // compiled exception handler. Checking for exception oop equality is not |
1358 if (!force_unwind && original_exception() == exception()) { |
1358 // sufficient because some exceptions are pre-allocated and reused. |
|
1359 if (!force_unwind && !recursive_exception) { |
1359 nm->add_handler_for_exception_and_pc(exception,pc,handler_address); |
1360 nm->add_handler_for_exception_and_pc(exception,pc,handler_address); |
1360 } |
1361 } |
1361 } else { |
1362 } else { |
1362 assert(handler_address == SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true), "Must be the same"); |
1363 #ifdef ASSERT |
|
1364 bool recursive_exception = false; |
|
1365 address computed_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true, recursive_exception); |
|
1366 vmassert(recursive_exception || (handler_address == computed_address), "Handler address inconsistency: " PTR_FORMAT " != " PTR_FORMAT, |
|
1367 p2i(handler_address), p2i(computed_address)); |
|
1368 #endif |
1363 } |
1369 } |
1364 } |
1370 } |
1365 |
1371 |
1366 thread->set_exception_pc(pc); |
1372 thread->set_exception_pc(pc); |
1367 thread->set_exception_handler_pc(handler_address); |
1373 thread->set_exception_handler_pc(handler_address); |