hotspot/src/share/vm/interpreter/templateInterpreter.cpp
changeset 2570 ecc7862946d4
parent 2534 08dac9ce0cd7
child 3600 27aa4477d039
--- a/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Mon Apr 20 14:48:03 2009 -0700
+++ b/hotspot/src/share/vm/interpreter/templateInterpreter.cpp	Tue Apr 21 23:21:04 2009 -0700
@@ -178,12 +178,14 @@
 #endif // !PRODUCT
 EntryPoint TemplateInterpreter::_return_entry[TemplateInterpreter::number_of_return_entries];
 EntryPoint TemplateInterpreter::_earlyret_entry;
+EntryPoint TemplateInterpreter::_return_unbox_entry;
 EntryPoint TemplateInterpreter::_deopt_entry [TemplateInterpreter::number_of_deopt_entries ];
 EntryPoint TemplateInterpreter::_continuation_entry;
 EntryPoint TemplateInterpreter::_safept_entry;
 
 address    TemplateInterpreter::_return_3_addrs_by_index[TemplateInterpreter::number_of_return_addrs];
 address    TemplateInterpreter::_return_5_addrs_by_index[TemplateInterpreter::number_of_return_addrs];
+address    TemplateInterpreter::_return_5_unbox_addrs_by_index[TemplateInterpreter::number_of_return_addrs];
 
 DispatchTable TemplateInterpreter::_active_table;
 DispatchTable TemplateInterpreter::_normal_table;
@@ -251,6 +253,22 @@
     }
   }
 
+  if (EnableInvokeDynamic) {
+    CodeletMark cm(_masm, "unboxing return entry points");
+    Interpreter::_return_unbox_entry =
+      EntryPoint(
+        generate_return_unbox_entry_for(btos, 5),
+        generate_return_unbox_entry_for(ctos, 5),
+        generate_return_unbox_entry_for(stos, 5),
+        generate_return_unbox_entry_for(atos, 5), // cast conversion
+        generate_return_unbox_entry_for(itos, 5),
+        generate_return_unbox_entry_for(ltos, 5),
+        generate_return_unbox_entry_for(ftos, 5),
+        generate_return_unbox_entry_for(dtos, 5),
+        Interpreter::_return_entry[5].entry(vtos) // no unboxing for void
+      );
+  }
+
   { CodeletMark cm(_masm, "earlyret entry points");
     Interpreter::_earlyret_entry =
       EntryPoint(
@@ -298,8 +316,11 @@
 
   for (int j = 0; j < number_of_states; j++) {
     const TosState states[] = {btos, ctos, stos, itos, ltos, ftos, dtos, atos, vtos};
-    Interpreter::_return_3_addrs_by_index[Interpreter::TosState_as_index(states[j])] = Interpreter::return_entry(states[j], 3);
-    Interpreter::_return_5_addrs_by_index[Interpreter::TosState_as_index(states[j])] = Interpreter::return_entry(states[j], 5);
+    int index = Interpreter::TosState_as_index(states[j]);
+    Interpreter::_return_3_addrs_by_index[index] = Interpreter::return_entry(states[j], 3);
+    Interpreter::_return_5_addrs_by_index[index] = Interpreter::return_entry(states[j], 5);
+    if (EnableInvokeDynamic)
+      Interpreter::_return_5_unbox_addrs_by_index[index] = Interpreter::return_unbox_entry(states[j], 5);
   }
 
   { CodeletMark cm(_masm, "continuation entry points");
@@ -526,6 +547,18 @@
 }
 
 
+address TemplateInterpreter::return_unbox_entry(TosState state, int length) {
+  assert(EnableInvokeDynamic, "");
+  if (state == vtos) {
+    // no unboxing to do, actually
+    return return_entry(state, length);
+  } else {
+    assert(length == 5, "unboxing entries generated for invokedynamic only");
+    return _return_unbox_entry.entry(state);
+  }
+}
+
+
 address TemplateInterpreter::deopt_entry(TosState state, int length) {
   guarantee(0 <= length && length < Interpreter::number_of_deopt_entries, "illegal length");
   return _deopt_entry[length].entry(state);