< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/util/MethodGenerator.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

@@ -29,11 +29,11 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Stack;
 
 
-import com.sun.org.apache.bcel.internal.Constants;
+import com.sun.org.apache.bcel.internal.Const;
 import com.sun.org.apache.bcel.internal.classfile.Field;
 import com.sun.org.apache.bcel.internal.classfile.Method;
 import com.sun.org.apache.bcel.internal.generic.ALOAD;
 import com.sun.org.apache.bcel.internal.generic.ASTORE;
 import com.sun.org.apache.bcel.internal.generic.BranchHandle;

@@ -53,11 +53,11 @@
 import com.sun.org.apache.bcel.internal.generic.INVOKESPECIAL;
 import com.sun.org.apache.bcel.internal.generic.INVOKESTATIC;
 import com.sun.org.apache.bcel.internal.generic.INVOKEVIRTUAL;
 import com.sun.org.apache.bcel.internal.generic.ISTORE;
 import com.sun.org.apache.bcel.internal.generic.Instruction;
-import com.sun.org.apache.bcel.internal.generic.InstructionConstants;
+import com.sun.org.apache.bcel.internal.generic.InstructionConst;
 import com.sun.org.apache.bcel.internal.generic.InstructionHandle;
 import com.sun.org.apache.bcel.internal.generic.InstructionList;
 import com.sun.org.apache.bcel.internal.generic.InstructionTargeter;
 import com.sun.org.apache.bcel.internal.generic.LocalVariableGen;
 import com.sun.org.apache.bcel.internal.generic.LocalVariableInstruction;

@@ -85,12 +85,10 @@
     private static final String START_ELEMENT_SIG
         = "(" + STRING_SIG + ")V";
     private static final String END_ELEMENT_SIG
         = START_ELEMENT_SIG;
 
-    private InstructionList _mapTypeSub;
-
     private static final int DOM_INDEX       = 1;
     private static final int ITERATOR_INDEX  = 2;
     private static final int HANDLER_INDEX   = 3;
 
     private static final int MAX_METHOD_SIZE = 65535;

@@ -1313,12 +1311,12 @@
         // Allocate instance of class in which we'll copy in or copy out locals
         // and make two copies:  last copy is used to invoke constructor;
         // other two are used for references to fields in the CopyLocals object
         InstructionHandle outlinedMethodCallSetup =
             oldMethCopyInIL.append(new NEW(cpg.addClass(argTypeName)));
-        oldMethCopyInIL.append(InstructionConstants.DUP);
-        oldMethCopyInIL.append(InstructionConstants.DUP);
+        oldMethCopyInIL.append(InstructionConst.DUP);
+        oldMethCopyInIL.append(InstructionConst.DUP);
         oldMethCopyInIL.append(
             new INVOKESPECIAL(cpg.addMethodref(argTypeName, "<init>", "()V")));
 
         // Generate code to invoke the new outlined method, and place the code
         // on oldMethCopyOutIL

@@ -1330,12 +1328,12 @@
                     new INVOKESTATIC(cpg.addMethodref(
                                           classGen.getClassName(),
                                           outlinedMethodName,
                                           outlinedMethodGen.getSignature())));
         } else {
-            oldMethCopyOutIL.append(InstructionConstants.THIS);
-            oldMethCopyOutIL.append(InstructionConstants.SWAP);
+            oldMethCopyOutIL.append(InstructionConst.THIS);
+            oldMethCopyOutIL.append(InstructionConst.SWAP);
             outlinedMethodRef =
                 oldMethCopyOutIL.append(
                     new INVOKEVIRTUAL(cpg.addMethodref(
                                           classGen.getClassName(),
                                           outlinedMethodName,

@@ -1477,11 +1475,11 @@
                                 // Generate code for the old method to store the
                                 // value of the local into the correct field in
                                 // CopyLocals prior to invocation of the
                                 // outlined method.
                                 oldMethCopyInIL.append(
-                                        InstructionConstants.DUP);
+                                        InstructionConst.DUP);
                                 InstructionHandle copyInLoad =
                                     oldMethCopyInIL.append(
                                         loadLocal(oldLocalVarIndex, varType));
                                 oldMethCopyInIL.append(new PUTFIELD(fieldRef));
 

@@ -1496,11 +1494,11 @@
                                 // Generate code for start of the outlined
                                 // method to copy the value from a field in
                                 // CopyLocals to the new local in the outlined
                                 // method
                                 newMethCopyInIL.append(
-                                        InstructionConstants.ALOAD_1);
+                                        InstructionConst.ALOAD_1);
                                 newMethCopyInIL.append(new GETFIELD(fieldRef));
                                 newMethCopyInIL.append(
                                         storeLocal(newLocalVarIndex, varType));
                             }
 

@@ -1508,21 +1506,21 @@
                                 // Generate code for the end of the outlined
                                 // method to copy the value from the new local
                                 // variable into a field in CopyLocals
                                 // method
                                 newMethCopyOutIL.append(
-                                        InstructionConstants.ALOAD_1);
+                                        InstructionConst.ALOAD_1);
                                 newMethCopyOutIL.append(
                                         loadLocal(newLocalVarIndex, varType));
                                 newMethCopyOutIL.append(new PUTFIELD(fieldRef));
 
                                 // Generate code to copy the value from a field
                                 // in CopyLocals into a local in the original
                                 // method following invocation of the outlined
                                 // method.
                                 oldMethCopyOutIL.append(
-                                        InstructionConstants.DUP);
+                                        InstructionConst.DUP);
                                 oldMethCopyOutIL.append(new GETFIELD(fieldRef));
                                 InstructionHandle copyOutStore =
                                     oldMethCopyOutIL.append(
                                         storeLocal(oldLocalVarIndex, varType));
 

@@ -1665,11 +1663,11 @@
             ih = ih.getNext();
 
         }
 
         // POP the reference to the CopyLocals object from the stack
-        oldMethCopyOutIL.append(InstructionConstants.POP);
+        oldMethCopyOutIL.append(InstructionConst.POP);
 
         // Now that the generation of the outlined code is complete, update
         // the old local variables with new start and end ranges, as required.
         Iterator revisedLocalVarStartPairIter = revisedLocalVarStart.entrySet()
                                                                     .iterator();

@@ -1706,11 +1704,11 @@
         oldMethodIL.insert(first, oldMethCopyOutIL);
 
         // Insert the copying code into the outlined method
         newIL.insert(newMethCopyInIL);
         newIL.append(newMethCopyOutIL);
-        newIL.append(InstructionConstants.RETURN);
+        newIL.append(InstructionConst.RETURN);
 
         // Discard instructions in outlineable chunk from old method
         try {
             oldMethodIL.delete(first, last);
         } catch (TargetLostException e) {

@@ -1997,42 +1995,42 @@
             Instruction inst = ih.getInstruction();
 
             switch (inst.getOpcode()) {
                 // Instructions that may have 16-bit or 32-bit branch targets.
                 // The size of the branch offset might increase by two bytes.
-                case Constants.GOTO:
-                case Constants.JSR:
+                case Const.GOTO:
+                case Const.JSR:
                     maxOffsetChange = maxOffsetChange + 2;
                     break;
                 // Instructions that contain padding for alignment purposes
                 // Up to three bytes of padding might be needed.  For greater
                 // accuracy, we should be able to discount any padding already
                 // added to these instructions by InstructionList.setPosition(),
                 // their APIs do not expose that information.
-                case Constants.TABLESWITCH:
-                case Constants.LOOKUPSWITCH:
+                case Const.TABLESWITCH:
+                case Const.LOOKUPSWITCH:
                     maxOffsetChange = maxOffsetChange + 3;
                     break;
                 // Instructions that might be rewritten by this method as a
                 // conditional branch followed by an unconditional branch.
                 // The unconditional branch would require five bytes.
-                case Constants.IF_ACMPEQ:
-                case Constants.IF_ACMPNE:
-                case Constants.IF_ICMPEQ:
-                case Constants.IF_ICMPGE:
-                case Constants.IF_ICMPGT:
-                case Constants.IF_ICMPLE:
-                case Constants.IF_ICMPLT:
-                case Constants.IF_ICMPNE:
-                case Constants.IFEQ:
-                case Constants.IFGE:
-                case Constants.IFGT:
-                case Constants.IFLE:
-                case Constants.IFLT:
-                case Constants.IFNE:
-                case Constants.IFNONNULL:
-                case Constants.IFNULL:
+                case Const.IF_ACMPEQ:
+                case Const.IF_ACMPNE:
+                case Const.IF_ICMPEQ:
+                case Const.IF_ICMPGE:
+                case Const.IF_ICMPGT:
+                case Const.IF_ICMPLE:
+                case Const.IF_ICMPLT:
+                case Const.IF_ICMPNE:
+                case Const.IFEQ:
+                case Const.IFGE:
+                case Const.IFGT:
+                case Const.IFLE:
+                case Const.IFLT:
+                case Const.IFNE:
+                case Const.IFNONNULL:
+                case Const.IFNULL:
                     maxOffsetChange = maxOffsetChange + 5;
                     break;
             }
         }
 

@@ -2075,11 +2073,11 @@
 
                     // If the original IF was the last instruction in
                     // InstructionList, add a new no-op to act as the target
                     // of the new IF
                     if (nextHandle == null) {
-                        nextHandle = il.append(gotoHandle, NOP);
+                        nextHandle = il.append(gotoHandle, InstructionConst.NOP);
                     }
 
                     // Make the new IF instruction branch around the GOTO
                     invertedIfHandle.updateTarget(target, nextHandle);
 
< prev index next >