changeset 2221:cafe64e5bd30

Getting somewhere?
author Gary Benson <gbenson@redhat.com>
date Wed, 16 Feb 2011 13:53:11 +0000
parents 35b11ba82a71
children cf905f6ef379
files src/cpu/zero/vm/cppInterpreter_zero.cpp
diffstat 1 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/zero/vm/cppInterpreter_zero.cpp	Wed Feb 16 10:58:07 2011 +0000
+++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp	Wed Feb 16 13:53:11 2011 +0000
@@ -610,26 +610,28 @@
   return 0;
 }
 
+#define VMSLOTS_SLOT(offset)    ((intptr_t*)&vmslot0[-(offset)])
+#define VMSLOTS_OBJECT(offset)  ((oop)vmslot0[-(offset)])
+
 int CppInterpreter::method_handle_entry(methodOop method,
                                         intptr_t UNUSED, TRAPS) {
   JavaThread *thread = (JavaThread *) THREAD;
   ZeroStack *stack = thread->zero_stack();
-  int max_locals = method->size_of_parameters();
-  intptr_t *locals = stack->sp() + (max_locals - 1);
 
-  // Get the MethodType
+  // Find the MethodType
   address p = (address) method;
   for (jint* pc = method->method_type_offsets_chain(); (*pc) != -1; pc++) {
     p = *(address*)(p + (*pc));
   }
   oop method_type = (oop) p;
 
-  // Get the MethodHandle
+  // Locate the argument slots
   oop mtform = java_dyn_MethodType::form(method_type);
   int vmslots = java_dyn_MethodTypeForm::vmslots(mtform);
-  vmslots--; // XXX why why why?
-  assert(vmslots >= 0 && vmslots < max_locals, "should be");
-  oop method_handle = LOCALS_OBJECT(vmslots);
+  intptr_t *vmslot0 = stack->sp();
+
+  // The MethodHandle is in the slot after the arguments
+  oop method_handle = VMSLOTS_OBJECT(-1);
 
   // Compare the method type against that of the receiver
   oop mhtype = java_dyn_MethodHandle::type(method_handle);
@@ -647,9 +649,6 @@
 
   // invokeExact
   while (true) {
-    tty->print("method_handle = ");
-    method_handle->print_on(tty);
-
     MethodHandleEntry *mhentry = java_dyn_MethodHandle::vmentry(method_handle);
     MethodHandles::EntryKind entry_kind =
       (MethodHandles::EntryKind) (((intptr_t) mhentry) & 0xffffffff);
@@ -678,13 +677,16 @@
         if (HAS_PENDING_EXCEPTION)
           break;
         stack->alloc(arg_slots * wordSize);
-        max_locals += arg_slots;
+
+        // Shuffle everything up
+        Unimplemented();
 
         // Store bound argument into new stack slot
         oop arg = sun_dyn_BoundMethodHandle::argument(method_handle);
         if (arg_type == T_OBJECT) {
           assert(arg_slots == 1, "should be");
-          SET_LOCALS_OBJECT(arg, max_locals - arg_slots);
+          //SET_LOCALS_OBJECT(arg, max_locals - arg_slots);
+          Unimplemented();
         }
         else {
           Unimplemented();
@@ -696,6 +698,7 @@
             (methodOop) java_dyn_MethodHandle::vmtarget(method_handle);
           address entry_point = method->from_interpreted_entry();
           Interpreter::invoke_method(method, entry_point, THREAD);
+          // NB all oops trashed!
           return 0; // No deoptimized frames on the stack
         }
         else {