diff src/share/vm/ci/bcEscapeAnalyzer.cpp @ 6266:1d7922586cf6

7023639: JSR 292 method handle invocation needs a fast path for compiled code 6984705: JSR 292 method handle creation should not go through JNI Summary: remove assembly code for JDK 7 chained method handles Reviewed-by: jrose, twisti, kvn, mhaupt Contributed-by: John Rose <john.r.rose@oracle.com>, Christian Thalinger <christian.thalinger@oracle.com>, Michael Haupt <michael.haupt@oracle.com>
author twisti
date Tue, 24 Jul 2012 10:51:00 -0700
parents 5ed8f599a788
children 7f813940ac35
line wrap: on
line diff
--- a/src/share/vm/ci/bcEscapeAnalyzer.cpp	Mon Jul 23 13:04:59 2012 -0700
+++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp	Tue Jul 24 10:51:00 2012 -0700
@@ -238,9 +238,11 @@
 
   // some methods are obviously bindable without any type checks so
   // convert them directly to an invokespecial.
-  if (target->is_loaded() && !target->is_abstract() &&
-      target->can_be_statically_bound() && code == Bytecodes::_invokevirtual) {
-    code = Bytecodes::_invokespecial;
+  if (target->is_loaded() && !target->is_abstract() && target->can_be_statically_bound()) {
+    switch (code) {
+    case Bytecodes::_invokevirtual:  code = Bytecodes::_invokespecial;  break;
+    case Bytecodes::_invokehandle:   code = Bytecodes::_invokestatic;   break;
+    }
   }
 
   // compute size of arguments
@@ -866,7 +868,12 @@
         { bool will_link;
           ciMethod* target = s.get_method(will_link);
           ciKlass* holder = s.get_declared_method_holder();
-          invoke(state, s.cur_bc(), target, holder);
+          // Push appendix argument, if one.
+          if (s.has_appendix()) {
+            state.apush(unknown_obj);
+          }
+          // Pass in raw bytecode because we need to see invokehandle instructions.
+          invoke(state, s.cur_bc_raw(), target, holder);
           ciType* return_type = target->return_type();
           if (!return_type->is_primitive_type()) {
             state.apush(unknown_obj);