changeset 2240:6eab6cdd502d

Got it :)
author Gary Benson <gbenson@redhat.com>
date Thu, 24 Feb 2011 16:10:10 +0000
parents 857b5dc555e5
children 0a4a1b39d32f
files src/cpu/zero/vm/cppInterpreter_zero.cpp
diffstat 1 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/zero/vm/cppInterpreter_zero.cpp	Thu Feb 24 16:02:38 2011 +0000
+++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp	Thu Feb 24 16:10:10 2011 +0000
@@ -624,14 +624,14 @@
   JavaThread *thread = (JavaThread *) THREAD;
   ZeroStack *stack = thread->zero_stack();
 #ifdef ASSERT
-  {
+  /* XXX {
     ResourceMark rm;
     tty->print_cr(">>> %s", method->name_and_sig_as_C_string());
-  }
+  } XXX */
   int initial_frame_size = top_frame_size_words(thread);
   int argument_slots = method->size_of_parameters();
+#endif // ASSERT
   int result_slots = type2size[result_type_of(method)];
-#endif // ASSERT
   intptr_t *vmslots = stack->sp();
   
   // Find the MethodType
@@ -662,13 +662,20 @@
 
   // invokeExact
   process_method_handle(method_handle, THREAD);
+  if (HAS_PENDING_EXCEPTION)
+    result_slots = 0;
+
+  // Pop the method handle argument, which inconveniently will
+  // be underneath the result being returned if one is present
+  intptr_t result[2];
+  for (int i = 0; i < result_slots; i++)
+    result[i] = stack->pop();
+  stack->pop(); 
+  for (int i = result_slots - 1; i >= 0; i--)
+    stack->push(result[i]);
 
 #ifdef ASSERT
-  tty->print_cr("<<<");
-  if (HAS_PENDING_EXCEPTION)
-    result_slots = 0;
-  assert(result_slots == 0, "unimplemented");
-  stack->set_sp(stack->sp() + 1); // the method handle argument
+  // XXXtty->print_cr("<<<");
   // Check
   int final_frame_size = top_frame_size_words(thread);
   if (final_frame_size != initial_frame_size - argument_slots + result_slots) {