hotspot/src/share/vm/prims/methodHandles.hpp
changeset 5055 743f38c6e179
parent 5050 47ecd86932ce
child 5416 5f6377fcfd3e
--- a/hotspot/src/share/vm/prims/methodHandles.hpp	Wed Mar 17 16:40:25 2010 -0700
+++ b/hotspot/src/share/vm/prims/methodHandles.hpp	Thu Mar 18 09:56:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2008-2010 Sun Microsystems, Inc.  All Rights Reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -137,6 +137,43 @@
     _entries[ek] = me;
   }
 
+  // Some adapter helper functions.
+  static void get_ek_bound_mh_info(EntryKind ek, BasicType& arg_type, int& arg_mask, int& arg_slots) {
+    switch (ek) {
+    case _bound_int_mh        : // fall-thru
+    case _bound_int_direct_mh : arg_type = T_INT;    arg_mask = _INSERT_INT_MASK;  break;
+    case _bound_long_mh       : // fall-thru
+    case _bound_long_direct_mh: arg_type = T_LONG;   arg_mask = _INSERT_LONG_MASK; break;
+    case _bound_ref_mh        : // fall-thru
+    case _bound_ref_direct_mh : arg_type = T_OBJECT; arg_mask = _INSERT_REF_MASK;  break;
+    default: ShouldNotReachHere();
+    }
+    arg_slots = type2size[arg_type];
+  }
+
+  static void get_ek_adapter_opt_swap_rot_info(EntryKind ek, int& swap_bytes, int& rotate) {
+    int swap_slots = 0;
+    switch (ek) {
+    case _adapter_opt_swap_1:     swap_slots = 1; rotate =  0; break;
+    case _adapter_opt_swap_2:     swap_slots = 2; rotate =  0; break;
+    case _adapter_opt_rot_1_up:   swap_slots = 1; rotate =  1; break;
+    case _adapter_opt_rot_1_down: swap_slots = 1; rotate = -1; break;
+    case _adapter_opt_rot_2_up:   swap_slots = 2; rotate =  1; break;
+    case _adapter_opt_rot_2_down: swap_slots = 2; rotate = -1; break;
+    default: ShouldNotReachHere();
+    }
+    // Return the size of the stack slots to move in bytes.
+    swap_bytes = swap_slots * Interpreter::stackElementSize();
+  }
+
+  static int get_ek_adapter_opt_spread_info(EntryKind ek) {
+    switch (ek) {
+    case _adapter_opt_spread_0: return  0;
+    case _adapter_opt_spread_1: return  1;
+    default                   : return -1;
+    }
+  }
+
   static methodOop raise_exception_method() {
     oop rem = JNIHandles::resolve(_raise_exception_method);
     assert(rem == NULL || rem->is_method(), "");
@@ -392,13 +429,13 @@
   static void insert_arg_slots(MacroAssembler* _masm,
                                RegisterOrConstant arg_slots,
                                int arg_mask,
-                               Register rax_argslot,
-                               Register rbx_temp, Register rdx_temp);
+                               Register argslot_reg,
+                               Register temp_reg, Register temp2_reg);
 
   static void remove_arg_slots(MacroAssembler* _masm,
                                RegisterOrConstant arg_slots,
-                               Register rax_argslot,
-                               Register rbx_temp, Register rdx_temp);
+                               Register argslot_reg,
+                               Register temp_reg, Register temp2_reg);
 };