changeset 2233:ee660518caf7

Start implementing adapter_retype_raw
author Gary Benson <gbenson@redhat.com>
date Wed, 23 Feb 2011 14:52:11 +0000
parents 881a0e4117fa
children fafe1035a5f5
files src/cpu/zero/vm/cppInterpreter_zero.cpp src/cpu/zero/vm/cppInterpreter_zero.hpp
diffstat 2 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/zero/vm/cppInterpreter_zero.cpp	Wed Feb 23 12:47:59 2011 +0000
+++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp	Wed Feb 23 14:52:11 2011 +0000
@@ -663,6 +663,8 @@
   intptr_t *vmslots = stack->sp();
 
   bool direct_to_method = false;
+  BasicType src_rtype = T_ILLEGAL;
+  BasicType dst_rtype = T_ILLEGAL;
 
   MethodHandleEntry *entry = java_dyn_MethodHandle::vmentry(method_handle);
   MethodHandles::EntryKind entry_kind =
@@ -728,9 +730,11 @@
     break;
 
   case MethodHandles::_adapter_retype_raw:
-    // XXX Unimplemented();
+    src_rtype = result_type_of_handle(
+      java_dyn_MethodHandle::vmtarget(method_handle));
+    dst_rtype = result_type_of_handle(method_handle);
     break;
-    
+
   case MethodHandles::_adapter_check_cast:
     {
       int arg_slot = sun_dyn_AdapterMethodHandle::vmargslot(method_handle);
@@ -754,6 +758,7 @@
     ShouldNotReachHere();
   }
 
+  // Continue along the chain
   oop vmtarget = java_dyn_MethodHandle::vmtarget(method_handle);
   if (direct_to_method) {
     methodOop method = (methodOop) vmtarget;
@@ -764,6 +769,21 @@
     process_method_handle(vmtarget, THREAD);
   }
   // NB all oops now trashed
+
+  // Adapt the result type, if necessary
+  if (src_rtype != dst_rtype) {
+    tty->cr();
+    tty->print_cr("src_rtype = %s", type2name(src_rtype));
+    tty->print_cr("dst_rtype = %s", type2name(dst_rtype));
+    tty->cr();
+    Unimplemented();
+  }
+}
+
+BasicType CppInterpreter::result_type_of_handle(oop method_handle) {
+  oop method_type = java_dyn_MethodHandle::type(method_handle);
+  oop return_type = java_dyn_MethodType::rtype(method_type);
+  return java_lang_Class::as_BasicType(return_type, (klassOop *) NULL);
 }
 
 InterpreterFrame *InterpreterFrame::build(const methodOop method, TRAPS) {
--- a/src/cpu/zero/vm/cppInterpreter_zero.hpp	Wed Feb 23 12:47:59 2011 +0000
+++ b/src/cpu/zero/vm/cppInterpreter_zero.hpp	Wed Feb 23 14:52:11 2011 +0000
@@ -43,8 +43,9 @@
   static void main_loop(int recurse, TRAPS);
 
  private:
-  // Main part of method_handle_entry
+  // Helpers for method_handle_entry
   static void process_method_handle(oop method_handle, TRAPS);
+  static BasicType result_type_of_handle(oop method_handle);
 
  private:
   // Fast result type determination