changeset 24119:c7f35230907d

When rethrowing exceptions at deopt, fetch the exception after rematerialization
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Tue, 04 Apr 2017 09:36:50 -0700
parents 3ce198ad35a6
children 23201e47b032
files src/share/vm/runtime/deoptimization.cpp
diffstat 1 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/runtime/deoptimization.cpp	Mon Apr 03 14:47:25 2017 +0200
+++ b/src/share/vm/runtime/deoptimization.cpp	Tue Apr 04 09:36:50 2017 -0700
@@ -218,19 +218,6 @@
   assert(vf->is_compiled_frame(), "Wrong frame type");
   chunk->push(compiledVFrame::cast(vf));
 
-  ScopeDesc* trap_scope = chunk->at(0)->scope();
-  Handle exceptionObject;
-  if (trap_scope->rethrow_exception()) {
-    if (PrintDeoptimizationDetails) {
-      tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", trap_scope->method()->method_holder()->name()->as_C_string(), trap_scope->method()->name()->as_C_string(), trap_scope->bci());
-    }
-    GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
-    guarantee(expressions != NULL && expressions->length() > 0, "must have exception to throw");
-    ScopeValue* topOfStack = expressions->top();
-    exceptionObject = StackValue::create_stack_value(&deoptee, &map, topOfStack)->get_obj();
-    assert(exceptionObject() != NULL, "exception oop can not be null");
-  }
-
   bool realloc_failures = false;
 
 #if defined(COMPILER2) || INCLUDE_JVMCI
@@ -324,6 +311,19 @@
 #endif // INCLUDE_JVMCI
 #endif // COMPILER2 || INCLUDE_JVMCI
 
+  ScopeDesc* trap_scope = chunk->at(0)->scope();
+  Handle exceptionObject;
+  if (trap_scope->rethrow_exception()) {
+    if (PrintDeoptimizationDetails) {
+      tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", trap_scope->method()->method_holder()->name()->as_C_string(), trap_scope->method()->name()->as_C_string(), trap_scope->bci());
+    }
+    GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
+    guarantee(expressions != NULL && expressions->length() > 0, "must have exception to throw");
+    ScopeValue* topOfStack = expressions->top();
+    exceptionObject = StackValue::create_stack_value(&deoptee, &map, topOfStack)->get_obj();
+    guarantee(exceptionObject() != NULL, "exception oop can not be null");
+  }
+
   // Ensure that no safepoint is taken after pointers have been stored
   // in fields of rematerialized objects.  If a safepoint occurs from here on
   // out the java state residing in the vframeArray will be missed.