changeset 2432:6f7a7dbb92b2

Add some missing unwinds to CppInterpreter::process_method_handle
author Gary Benson <gbenson@redhat.com>
date Fri, 25 Mar 2011 17:40:53 +0000
parents e8d2a791bf39
children 79a27a49c1fe
files src/cpu/zero/vm/cppInterpreter_zero.cpp
diffstat 1 files changed, 28 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/zero/vm/cppInterpreter_zero.cpp	Fri Mar 25 17:30:07 2011 +0000
+++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp	Fri Mar 25 17:40:53 2011 +0000
@@ -820,7 +820,13 @@
         java_lang_invoke_BoundMethodHandle::vmargslot(method_handle);
 
       // Create the new slot(s)
-      insert_vmslots(arg_slot, arg_slots, CHECK); // XXX unwind!
+      intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
+      insert_vmslots(arg_slot, arg_slots, THREAD);
+      if (HAS_PENDING_EXCEPTION) {
+        // all oops trashed
+        stack->set_sp(unwind_sp);
+        return;
+      }
       vmslots = stack->sp();
 
       // Store bound argument into new stack slot
@@ -882,7 +888,13 @@
       assert(num_slots > 0, "should be");
 
       // Create the new slot(s)
-      insert_vmslots(arg_slot, num_slots, CHECK); // XXX unwind!
+      intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
+      insert_vmslots(arg_slot, num_slots, THREAD);
+      if (HAS_PENDING_EXCEPTION) {
+        // all oops trashed
+        stack->set_sp(unwind_sp);
+        return;
+      }
       vmslots = stack->sp();
 
       // Duplicate the arguments
@@ -923,7 +935,13 @@
       int arg_slot =
         java_lang_invoke_AdapterMethodHandle::vmargslot(method_handle);
       int arg = VMSLOTS_INT(arg_slot);
-      insert_vmslots(arg_slot, 1, CHECK); // XXX unwind!
+      intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
+      insert_vmslots(arg_slot, 1, THREAD);
+      if (HAS_PENDING_EXCEPTION) {
+        // all oops trashed
+        stack->set_sp(unwind_sp);
+        return;
+      }
       vmslots = stack->sp();
       arg_slot++;
       SET_VMSLOTS_LONG(arg, arg_slot);
@@ -939,7 +957,13 @@
       jvalue arg_value;
       BasicType arg_type = java_lang_boxing_object::get_value(arg, &arg_value);
       if (arg_type == T_LONG || arg_type == T_DOUBLE) {
-        insert_vmslots(arg_slot, 1, CHECK); // XXX unwind!
+        intptr_t *unwind_sp = calculate_unwind_sp(stack, method_handle);
+        insert_vmslots(arg_slot, 1, THREAD);
+        if (HAS_PENDING_EXCEPTION) {
+          // all oops trashed
+          stack->set_sp(unwind_sp);
+          return;
+        }
         vmslots = stack->sp();
         arg_slot++;
       }