diff --git a/src/hotspot/share/opto/doCall.cpp b/src/hotspot/share/opto/doCall.cpp index 91bb743618b..5533b19897b 100644 --- a/src/hotspot/share/opto/doCall.cpp +++ b/src/hotspot/share/opto/doCall.cpp @@ -1059,14 +1059,19 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) { assert(!stopped(), "you should return if you finish the chain"); // Oops, need to call into the VM to resolve the klasses at runtime. - // Note: This call must not deoptimize, since it is not a real at this bci! kill_dead_locals(); - make_runtime_call(RC_NO_LEAF | RC_MUST_THROW, - OptoRuntime::rethrow_Type(), - OptoRuntime::rethrow_stub(), - nullptr, nullptr, - ex_node); + { PreserveReexecuteState preexecs(this); + // When throwing an exception, set the reexecute flag for deoptimization. + // This is mostly needed to pass -XX:+VerifyStack sanity checks. + jvms()->set_should_reexecute(true); + + make_runtime_call(RC_NO_LEAF | RC_MUST_THROW, + OptoRuntime::rethrow_Type(), + OptoRuntime::rethrow_stub(), + nullptr, nullptr, + ex_node); + } // Rethrow is a pure call, no side effects, only a result. // The result cannot be allocated, so we use I_O diff --git a/test/hotspot/jtreg/compiler/exceptions/TestAccessErrorInCatch.java b/test/hotspot/jtreg/compiler/exceptions/TestAccessErrorInCatch.java index 46541d76016..44cfd60cf38 100644 --- a/test/hotspot/jtreg/compiler/exceptions/TestAccessErrorInCatch.java +++ b/test/hotspot/jtreg/compiler/exceptions/TestAccessErrorInCatch.java @@ -23,16 +23,18 @@ /* * @test - * @bug 8367002 + * @bug 8367002 8370766 * @summary Compilers might not generate handlers for recursive exceptions * * @compile IllegalAccessInCatch.jasm * @run main/othervm -Xbatch * -XX:CompileCommand=compileonly,IllegalAccessInCatch*::test + * -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyStack * -XX:-TieredCompilation * TestAccessErrorInCatch * @run main/othervm -Xbatch * -XX:CompileCommand=compileonly,IllegalAccessInCatch*::test + * -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyStack * -XX:TieredStopAtLevel=3 * TestAccessErrorInCatch */