8059455: LambdaForm.prepare() does unnecessary work for cached LambdaForms
authorvlivanov
Thu, 23 Apr 2015 18:01:38 +0300
changeset 30035 b83ec0c9fd74
parent 30034 a0f26b338318
child 30036 3d4eb4503c18
8059455: LambdaForm.prepare() does unnecessary work for cached LambdaForms Reviewed-by: psandoz
jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Fri Apr 24 09:37:06 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java	Thu Apr 23 18:01:38 2015 +0300
@@ -631,7 +631,7 @@
      * as a sort of pre-invocation linkage step.)
      */
     public void prepare() {
-        if (COMPILE_THRESHOLD == 0) {
+        if (COMPILE_THRESHOLD == 0 && !isCompiled) {
             compileToBytecode();
         }
         if (this.vmentry != null) {
@@ -645,11 +645,11 @@
 
     /** Generate optimizable bytecode for this form. */
     MemberName compileToBytecode() {
-        MethodType invokerType = methodType();
-        assert(vmentry == null || vmentry.getMethodType().basicType().equals(invokerType));
         if (vmentry != null && isCompiled) {
             return vmentry;  // already compiled somehow
         }
+        MethodType invokerType = methodType();
+        assert(vmentry == null || vmentry.getMethodType().basicType().equals(invokerType));
         try {
             vmentry = InvokerBytecodeGenerator.generateCustomizedCode(this, invokerType);
             if (TRACE_INTERPRETER)