mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8371306: JDK-8367002 behavior might not match existing HotSpot behavior.
Reviewed-by: thartmann, dholmes
This commit is contained in:
parent
2139c8c6e6
commit
a1e8694109
@ -809,6 +809,8 @@ address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc,
|
||||
// determine handler bci, if any
|
||||
EXCEPTION_MARK;
|
||||
|
||||
Handle orig_exception(THREAD, exception());
|
||||
|
||||
int handler_bci = -1;
|
||||
int scope_depth = 0;
|
||||
if (!force_unwind) {
|
||||
@ -830,7 +832,7 @@ address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc,
|
||||
// thrown (bugs 4307310 and 4546590). Set "exception" reference
|
||||
// argument to ensure that the correct exception is thrown (4870175).
|
||||
recursive_exception_occurred = true;
|
||||
exception = Handle(THREAD, PENDING_EXCEPTION);
|
||||
exception.replace(PENDING_EXCEPTION);
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
if (handler_bci >= 0) {
|
||||
bci = handler_bci;
|
||||
@ -859,8 +861,10 @@ address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc,
|
||||
|
||||
// If the compiler did not anticipate a recursive exception, resulting in an exception
|
||||
// thrown from the catch bci, then the compiled exception handler might be missing.
|
||||
// This is rare. Just deoptimize and let the interpreter handle it.
|
||||
// This is rare. Just deoptimize and let the interpreter rethrow the original
|
||||
// exception at the original bci.
|
||||
if (t == nullptr && recursive_exception_occurred) {
|
||||
exception.replace(orig_exception()); // restore original exception
|
||||
bool make_not_entrant = false;
|
||||
return Deoptimization::deoptimize_for_missing_exception_handler(nm, make_not_entrant);
|
||||
}
|
||||
|
||||
@ -46,6 +46,7 @@ super class IllegalAccessInCatch
|
||||
idiv;
|
||||
endtry t0;
|
||||
ireturn;
|
||||
catch t0 java/lang/IllegalAccessError;
|
||||
catch t0 jdk/internal/agent/AgentConfigurationError; // loadable but not accessible from unnamed module
|
||||
stack_frame_type full;
|
||||
stack_map class java/lang/Throwable;
|
||||
|
||||
@ -64,6 +64,11 @@ public class TestAccessErrorInCatch {
|
||||
}
|
||||
|
||||
private static int invoke(MethodHandle mh) throws Throwable {
|
||||
return (int) mh.invokeExact();
|
||||
int expected = 1;
|
||||
int ret = (int) mh.invokeExact();
|
||||
if (ret != expected) {
|
||||
throw new RuntimeException("Returned " + ret + " but expected " + expected);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user