8198826: -XX:+VerifyStack fails with fatal error: ExceptionMark constructor expects no pending exceptions
authorthartmann
Fri, 02 Mar 2018 11:06:51 +0100
changeset 49324 e6fbaf07192f
parent 49323 565336327354
child 49325 8308de3f2573
8198826: -XX:+VerifyStack fails with fatal error: ExceptionMark constructor expects no pending exceptions Summary: Save and restore pending exception while executing stack verification code at deoptimization. Reviewed-by: kvn, dholmes
src/hotspot/share/runtime/deoptimization.cpp
test/hotspot/jtreg/compiler/uncommontrap/TestDeoptOOM.java
--- a/src/hotspot/share/runtime/deoptimization.cpp	Fri Mar 02 10:09:08 2018 +0100
+++ b/src/hotspot/share/runtime/deoptimization.cpp	Fri Mar 02 11:06:51 2018 +0100
@@ -56,6 +56,7 @@
 #include "runtime/vframeArray.hpp"
 #include "runtime/vframe_hp.hpp"
 #include "utilities/events.hpp"
+#include "utilities/preserveException.hpp"
 #include "utilities/xmlstream.hpp"
 
 #if INCLUDE_JVMCI
@@ -648,6 +649,8 @@
 #ifndef PRODUCT
   if (VerifyStack) {
     ResourceMark res_mark;
+    // Clear pending exception to not break verification code (restored afterwards)
+    PRESERVE_EXCEPTION_MARK;
 
     thread->validate_frame_layout();
 
--- a/test/hotspot/jtreg/compiler/uncommontrap/TestDeoptOOM.java	Fri Mar 02 10:09:08 2018 +0100
+++ b/test/hotspot/jtreg/compiler/uncommontrap/TestDeoptOOM.java	Fri Mar 02 11:06:51 2018 +0100
@@ -23,10 +23,10 @@
 
 /*
  * @test
- * @bug 6898462
+ * @bug 6898462 8198826
  * @summary failed reallocations of scalar replaced objects during deoptimization causes crash
  *
- * @run main/othervm -XX:-BackgroundCompilation -Xmx128M
+ * @run main/othervm -XX:-BackgroundCompilation -Xmx128M -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyStack
  *      -XX:CompileCommand=exclude,compiler.uncommontrap.TestDeoptOOM::main
  *      -XX:CompileCommand=exclude,compiler.uncommontrap.TestDeoptOOM::m9_1
  *      compiler.uncommontrap.TestDeoptOOM