summaryrefslogtreecommitdiff
path: root/src/proguard/optimize/peephole
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2012-02-27 18:34:24 -0800
committerYing Wang <wangying@google.com>2012-02-27 18:34:24 -0800
commit9f606f95f03a75961498803e24bee6799a7c0885 (patch)
treea45f4d74feda9b76277a0c9ced55ad15d82248a1 /src/proguard/optimize/peephole
parentcfead78069f3dc32998dc118ee08cab3867acea2 (diff)
downloadproguard-9f606f95f03a75961498803e24bee6799a7c0885.tar.gz
This reverts commit cfead78069f3dc32998dc118ee08cab3867acea2. Bug: 6079915
Diffstat (limited to 'src/proguard/optimize/peephole')
-rw-r--r--src/proguard/optimize/peephole/BranchTargetFinder.java28
-rw-r--r--src/proguard/optimize/peephole/ClassFinalizer.java2
-rw-r--r--src/proguard/optimize/peephole/ClassMerger.java57
-rw-r--r--src/proguard/optimize/peephole/GotoCommonCodeReplacer.java2
-rw-r--r--src/proguard/optimize/peephole/GotoGotoReplacer.java7
-rw-r--r--src/proguard/optimize/peephole/GotoReturnReplacer.java2
-rw-r--r--src/proguard/optimize/peephole/HorizontalClassMerger.java2
-rw-r--r--src/proguard/optimize/peephole/InstructionSequenceConstants.java1233
-rw-r--r--src/proguard/optimize/peephole/InstructionSequenceReplacer.java164
-rw-r--r--src/proguard/optimize/peephole/InstructionSequencesReplacer.java2
-rw-r--r--src/proguard/optimize/peephole/MemberPrivatizer.java2
-rw-r--r--src/proguard/optimize/peephole/MethodFinalizer.java2
-rw-r--r--src/proguard/optimize/peephole/MethodInliner.java120
-rw-r--r--src/proguard/optimize/peephole/NopRemover.java2
-rw-r--r--src/proguard/optimize/peephole/PeepholeOptimizer.java2
-rw-r--r--src/proguard/optimize/peephole/ReachableCodeMarker.java9
-rw-r--r--src/proguard/optimize/peephole/RetargetedInnerClassAttributeRemover.java44
-rw-r--r--src/proguard/optimize/peephole/TargetClassChanger.java62
-rw-r--r--src/proguard/optimize/peephole/UnreachableCodeRemover.java2
-rw-r--r--src/proguard/optimize/peephole/UnreachableExceptionRemover.java2
-rw-r--r--src/proguard/optimize/peephole/VariableShrinker.java2
-rw-r--r--src/proguard/optimize/peephole/VerticalClassMerger.java2
22 files changed, 214 insertions, 1536 deletions
diff --git a/src/proguard/optimize/peephole/BranchTargetFinder.java b/src/proguard/optimize/peephole/BranchTargetFinder.java
index 7e5a11f..8f650bb 100644
--- a/src/proguard/optimize/peephole/BranchTargetFinder.java
+++ b/src/proguard/optimize/peephole/BranchTargetFinder.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -29,8 +29,6 @@ import proguard.classfile.instruction.*;
import proguard.classfile.instruction.visitor.InstructionVisitor;
import proguard.classfile.util.SimplifiedVisitor;
-import java.util.Arrays;
-
/**
* This AttributeVisitor finds all instruction offsets, branch targets, and
* exception targets in the CodeAttribute objects that it visits.
@@ -314,19 +312,25 @@ implements AttributeVisitor,
initializationOffsets = new int[codeLength];
// Reset the arrays.
- Arrays.fill(subroutineStarts, 0, codeLength, NONE);
- Arrays.fill(subroutineEnds, 0, codeLength, NONE);
- Arrays.fill(creationOffsets, 0, codeLength, NONE);
- Arrays.fill(initializationOffsets, 0, codeLength, NONE);
+ for (int index = 0; index < codeLength; index++)
+ {
+ subroutineStarts[index] = NONE;
+ subroutineEnds[index] = NONE;
+ creationOffsets[index] = NONE;
+ initializationOffsets[index] = NONE;
+ }
}
else
{
// Reset the arrays.
- Arrays.fill(instructionMarks, 0, codeLength, (short)0);
- Arrays.fill(subroutineStarts, 0, codeLength, NONE);
- Arrays.fill(subroutineEnds, 0, codeLength, NONE);
- Arrays.fill(creationOffsets, 0, codeLength, NONE);
- Arrays.fill(initializationOffsets, 0, codeLength, NONE);
+ for (int index = 0; index < codeLength; index++)
+ {
+ instructionMarks[index] = 0;
+ subroutineStarts[index] = NONE;
+ subroutineEnds[index] = NONE;
+ creationOffsets[index] = NONE;
+ initializationOffsets[index] = NONE;
+ }
instructionMarks[codeLength] = 0;
}
diff --git a/src/proguard/optimize/peephole/ClassFinalizer.java b/src/proguard/optimize/peephole/ClassFinalizer.java
index 063f254..b5e54f8 100644
--- a/src/proguard/optimize/peephole/ClassFinalizer.java
+++ b/src/proguard/optimize/peephole/ClassFinalizer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/optimize/peephole/ClassMerger.java b/src/proguard/optimize/peephole/ClassMerger.java
index 4971cab..1e1a950 100644
--- a/src/proguard/optimize/peephole/ClassMerger.java
+++ b/src/proguard/optimize/peephole/ClassMerger.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -21,7 +21,6 @@
package proguard.optimize.peephole;
import proguard.classfile.*;
-import proguard.classfile.constant.ClassConstant;
import proguard.classfile.constant.visitor.*;
import proguard.classfile.editor.*;
import proguard.classfile.util.*;
@@ -60,8 +59,6 @@ implements ClassVisitor,
private final boolean mergeInterfacesAggressively;
private final ClassVisitor extraClassVisitor;
- private final MemberVisitor fieldOptimizationInfoCopier = new FieldOptimizationInfoCopier();
-
/**
* Creates a new ClassMerger that will merge classes into the given target
@@ -154,7 +151,7 @@ implements ClassVisitor,
// infinite recursion.
(programClass.getAccessFlags() & ClassConstants.INTERNAL_ACC_ANNOTATTION) == 0 &&
- // Only merge classes if we can change the access permissions, or
+ // Only merge classes if we can change the access permissioms, or
// if they are in the same package, or
// if they are public and don't contain or invoke package visible
// class members.
@@ -238,12 +235,11 @@ implements ClassVisitor,
targetClass.u2accessFlags =
((targetAccessFlags &
sourceAccessFlags) &
- (ClassConstants.INTERNAL_ACC_INTERFACE |
+ (ClassConstants.INTERNAL_ACC_INTERFACE |
ClassConstants.INTERNAL_ACC_ABSTRACT)) |
((targetAccessFlags |
sourceAccessFlags) &
- (ClassConstants.INTERNAL_ACC_PUBLIC |
- ClassConstants.INTERNAL_ACC_SUPER |
+ (ClassConstants.INTERNAL_ACC_PUBLIC |
ClassConstants.INTERNAL_ACC_ANNOTATTION |
ClassConstants.INTERNAL_ACC_ENUM));
@@ -264,7 +260,7 @@ implements ClassVisitor,
// Copy over the class members.
MemberAdder memberAdder =
- new MemberAdder(targetClass, fieldOptimizationInfoCopier);
+ new MemberAdder(targetClass);
programClass.fieldsAccept(memberAdder);
programClass.methodsAccept(memberAdder);
@@ -340,8 +336,10 @@ implements ClassVisitor,
// Visit all superclasses and interfaces, collecting the ones that have
// static initializers.
clazz.hierarchyAccept(true, true, true, false,
- new StaticInitializerContainingClassFilter(
- new ClassCollector(set)));
+ new NamedMethodVisitor(ClassConstants.INTERNAL_METHOD_NAME_CLINIT,
+ ClassConstants.INTERNAL_METHOD_TYPE_INIT,
+ new MemberToClassVisitor(
+ new ClassCollector(set))));
return set;
}
@@ -370,19 +368,12 @@ implements ClassVisitor,
*/
private Set caughtSuperClasses(Clazz clazz)
{
- // Don't bother if this isn't an exception at all.
- if (!clazz.extends_(ClassConstants.INTERNAL_NAME_JAVA_LANG_THROWABLE))
- {
- return Collections.EMPTY_SET;
- }
-
- // Visit all superclasses, collecting the ones that are caught
- // (plus java.lang.Object, in the current implementation).
Set set = new HashSet();
+ // Visit all superclasses, collecting the ones that are caught.
clazz.hierarchyAccept(true, true, false, false,
new CaughtClassFilter(
- new ClassCollector(set)));
+ new ClassCollector(set)));
return set;
}
@@ -547,30 +538,4 @@ implements ClassVisitor,
targetClass = clazz;
}
}
-
-
- /**
- * This MemberVisitor copies field optimization info from copied fields.
- */
- private static class FieldOptimizationInfoCopier
- extends SimplifiedVisitor
- implements MemberVisitor
- {
- public void visitProgramField(ProgramClass programClass, ProgramField programField)
- {
- // Copy the optimization info from the field that was just copied.
- ProgramField copiedField = (ProgramField)programField.getVisitorInfo();
- Object info = copiedField.getVisitorInfo();
-
- programField.setVisitorInfo(info instanceof FieldOptimizationInfo ?
- new FieldOptimizationInfo((FieldOptimizationInfo)info) :
- info);
- }
-
-
- public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- {
- // Linked methods share their optimization info.
- }
- }
} \ No newline at end of file
diff --git a/src/proguard/optimize/peephole/GotoCommonCodeReplacer.java b/src/proguard/optimize/peephole/GotoCommonCodeReplacer.java
index 0dd93b1..4833275 100644
--- a/src/proguard/optimize/peephole/GotoCommonCodeReplacer.java
+++ b/src/proguard/optimize/peephole/GotoCommonCodeReplacer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/optimize/peephole/GotoGotoReplacer.java b/src/proguard/optimize/peephole/GotoGotoReplacer.java
index d05d7b6..7d7e66c 100644
--- a/src/proguard/optimize/peephole/GotoGotoReplacer.java
+++ b/src/proguard/optimize/peephole/GotoGotoReplacer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -84,9 +84,8 @@ implements InstructionVisitor
int branchOffset = branchInstruction.branchOffset;
int targetOffset = offset + branchOffset;
- if (branchOffset != 0 &&
- branchOffset != branchInstruction.length(offset) &&
- !codeAttributeEditor.isModified(offset) &&
+ if (branchOffset != branchInstruction.length(offset) &&
+ !codeAttributeEditor.isModified(offset) &&
!codeAttributeEditor.isModified(targetOffset))
{
Instruction targetInstruction =
diff --git a/src/proguard/optimize/peephole/GotoReturnReplacer.java b/src/proguard/optimize/peephole/GotoReturnReplacer.java
index cafda92..5c3eb77 100644
--- a/src/proguard/optimize/peephole/GotoReturnReplacer.java
+++ b/src/proguard/optimize/peephole/GotoReturnReplacer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/optimize/peephole/HorizontalClassMerger.java b/src/proguard/optimize/peephole/HorizontalClassMerger.java
index d12c2c0..a37b9a5 100644
--- a/src/proguard/optimize/peephole/HorizontalClassMerger.java
+++ b/src/proguard/optimize/peephole/HorizontalClassMerger.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/optimize/peephole/InstructionSequenceConstants.java b/src/proguard/optimize/peephole/InstructionSequenceConstants.java
index eb24061..b33204b 100644
--- a/src/proguard/optimize/peephole/InstructionSequenceConstants.java
+++ b/src/proguard/optimize/peephole/InstructionSequenceConstants.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -20,179 +20,81 @@
*/
package proguard.optimize.peephole;
-import proguard.classfile.*;
import proguard.classfile.constant.*;
import proguard.classfile.instruction.*;
-import proguard.classfile.visitor.ClassPrinter;
+import proguard.classfile.util.InstructionSequenceMatcher;
/**
* This class contains a set of instruction sequences and their suggested
* replacements.
*
* @see InstructionSequencesReplacer
- * @see InstructionSequenceReplacer
* @author Eric Lafortune
*/
public class InstructionSequenceConstants
{
- private static final int X = InstructionSequenceReplacer.X;
- private static final int Y = InstructionSequenceReplacer.Y;
- private static final int Z = InstructionSequenceReplacer.Z;
+ public static final int X = InstructionSequenceMatcher.X;
+ public static final int Y = InstructionSequenceMatcher.Y;
+ public static final int Z = InstructionSequenceMatcher.Z;
- private static final int A = InstructionSequenceReplacer.A;
- private static final int B = InstructionSequenceReplacer.B;
- private static final int C = InstructionSequenceReplacer.C;
- private static final int D = InstructionSequenceReplacer.D;
+ public static final int A = InstructionSequenceMatcher.A;
+ public static final int B = InstructionSequenceMatcher.B;
+ public static final int C = InstructionSequenceMatcher.C;
+ public static final int D = InstructionSequenceMatcher.D;
- private static final int STRING_A_LENGTH = InstructionSequenceReplacer.STRING_A_LENGTH;
- private static final int BOOLEAN_A_STRING = InstructionSequenceReplacer.BOOLEAN_A_STRING;
- private static final int CHAR_A_STRING = InstructionSequenceReplacer.CHAR_A_STRING;
- private static final int INT_A_STRING = InstructionSequenceReplacer.INT_A_STRING;
- private static final int LONG_A_STRING = InstructionSequenceReplacer.LONG_A_STRING;
- private static final int FLOAT_A_STRING = InstructionSequenceReplacer.FLOAT_A_STRING;
- private static final int DOUBLE_A_STRING = InstructionSequenceReplacer.DOUBLE_A_STRING;
- private static final int STRING_A_STRING = InstructionSequenceReplacer.STRING_A_STRING;
- private static final int BOOLEAN_B_STRING = InstructionSequenceReplacer.BOOLEAN_B_STRING;
- private static final int CHAR_B_STRING = InstructionSequenceReplacer.CHAR_B_STRING;
- private static final int INT_B_STRING = InstructionSequenceReplacer.INT_B_STRING;
- private static final int LONG_B_STRING = InstructionSequenceReplacer.LONG_B_STRING;
- private static final int FLOAT_B_STRING = InstructionSequenceReplacer.FLOAT_B_STRING;
- private static final int DOUBLE_B_STRING = InstructionSequenceReplacer.DOUBLE_B_STRING;
- private static final int STRING_B_STRING = InstructionSequenceReplacer.STRING_B_STRING;
- private static final int I_32768 = 0;
- private static final int I_65536 = 1;
- private static final int I_16777216 = 2;
+ private static final int I_32768 = 0;
+ private static final int I_65536 = 1;
+ private static final int I_16777216 = 2;
// private static final int I_0x000000ff
- private static final int I_0x0000ff00 = 3;
- private static final int I_0x00ff0000 = 4;
- private static final int I_0xff000000 = 5;
- private static final int I_0x0000ffff = 6;
- private static final int I_0xffff0000 = 7;
+ private static final int I_0x0000ff00 = 3;
+ private static final int I_0x00ff0000 = 4;
+ private static final int I_0xff000000 = 5;
+ private static final int I_0x0000ffff = 6;
+ private static final int I_0xffff0000 = 7;
- private static final int L_M1 = 8;
- private static final int L_2 = 9;
- private static final int L_4 = 10;
- private static final int L_8 = 11;
- private static final int L_16 = 12;
- private static final int L_32 = 13;
- private static final int L_64 = 14;
- private static final int L_128 = 15;
- private static final int L_256 = 16;
- private static final int L_512 = 17;
- private static final int L_1024 = 18;
- private static final int L_2048 = 19;
- private static final int L_4096 = 20;
- private static final int L_8192 = 21;
- private static final int L_16384 = 22;
- private static final int L_32768 = 23;
- private static final int L_65536 = 24;
- private static final int L_16777216 = 25;
- private static final int L_4294967296 = 26;
+ private static final int L_M1 = 8;
+ private static final int L_2 = 9;
+ private static final int L_4 = 10;
+ private static final int L_8 = 11;
+ private static final int L_16 = 12;
+ private static final int L_32 = 13;
+ private static final int L_64 = 14;
+ private static final int L_128 = 15;
+ private static final int L_256 = 16;
+ private static final int L_512 = 17;
+ private static final int L_1024 = 18;
+ private static final int L_2048 = 19;
+ private static final int L_4096 = 20;
+ private static final int L_8192 = 21;
+ private static final int L_16384 = 22;
+ private static final int L_32768 = 23;
+ private static final int L_65536 = 24;
+ private static final int L_16777216 = 25;
+ private static final int L_4294967296 = 26;
- private static final int L_0x00000000ffffffff = 27;
- private static final int L_0xffffffff00000000 = 28;
+ private static final int L_0x00000000ffffffff = 27;
+ private static final int L_0xffffffff00000000 = 28;
- private static final int F_M1 = 29;
+ private static final int F_M1 = 29;
- private static final int D_M1 = 30;
+ private static final int D_M1 = 30;
- private static final int STRING_EMPTY = 31;
+ private static final int FIELD_I = 31;
+ private static final int FIELD_L = 32;
+ private static final int FIELD_F = 33;
+ private static final int FIELD_D = 34;
- private static final int FIELD_I = 32;
- private static final int FIELD_L = 33;
- private static final int FIELD_F = 34;
- private static final int FIELD_D = 35;
+ private static final int NAME_AND_TYPE_I = 35;
+ private static final int NAME_AND_TYPE_L = 36;
+ private static final int NAME_AND_TYPE_F = 37;
+ private static final int NAME_AND_TYPE_D = 38;
- private static final int METHOD_STRING_EQUALS = 36;
- private static final int METHOD_STRING_LENGTH = 37;
- private static final int METHOD_STRINGBUFFER_INIT = 38;
- private static final int METHOD_STRINGBUFFER_INIT_STRING = 39;
- private static final int METHOD_STRINGBUFFER_APPEND_BOOLEAN = 40;
- private static final int METHOD_STRINGBUFFER_APPEND_CHAR = 41;
- private static final int METHOD_STRINGBUFFER_APPEND_INTEGER = 42;
- private static final int METHOD_STRINGBUFFER_APPEND_LONG = 43;
- private static final int METHOD_STRINGBUFFER_APPEND_FLOAT = 44;
- private static final int METHOD_STRINGBUFFER_APPEND_DOUBLE = 45;
- private static final int METHOD_STRINGBUFFER_APPEND_STRING = 46;
- private static final int METHOD_STRINGBUFFER_LENGTH = 47;
- private static final int METHOD_STRINGBUFFER_TOSTRING = 48;
- private static final int METHOD_STRINGBUILDER_INIT = 49;
- private static final int METHOD_STRINGBUILDER_INIT_STRING = 50;
- private static final int METHOD_STRINGBUILDER_APPEND_BOOLEAN = 51;
- private static final int METHOD_STRINGBUILDER_APPEND_CHAR = 52;
- private static final int METHOD_STRINGBUILDER_APPEND_INTEGER = 53;
- private static final int METHOD_STRINGBUILDER_APPEND_LONG = 54;
- private static final int METHOD_STRINGBUILDER_APPEND_FLOAT = 55;
- private static final int METHOD_STRINGBUILDER_APPEND_DOUBLE = 56;
- private static final int METHOD_STRINGBUILDER_APPEND_STRING = 57;
- private static final int METHOD_STRINGBUILDER_LENGTH = 58;
- private static final int METHOD_STRINGBUILDER_TOSTRING = 59;
-
- private static final int CLASS_STRING = 60;
- private static final int CLASS_STRINGBUFFER = 61;
- private static final int CLASS_STRINGBUILDER = 62;
-
- private static final int NAME_AND_TYPE_I = 63;
- private static final int NAME_AND_TYPE_L = 64;
- private static final int NAME_AND_TYPE_F = 65;
- private static final int NAME_AND_TYPE_D = 66;
-
- private static final int NAME_AND_TYPE_EQUALS = 67;
- private static final int NAME_AND_TYPE_LENGTH = 68;
- private static final int NAME_AND_TYPE_INIT = 69;
- private static final int NAME_AND_TYPE_INIT_STRING = 70;
- private static final int NAME_AND_TYPE_APPEND_Z_STRINGBUFFER = 71;
- private static final int NAME_AND_TYPE_APPEND_C_STRINGBUFFER = 72;
- private static final int NAME_AND_TYPE_APPEND_I_STRINGBUFFER = 73;
- private static final int NAME_AND_TYPE_APPEND_J_STRINGBUFFER = 74;
- private static final int NAME_AND_TYPE_APPEND_F_STRINGBUFFER = 75;
- private static final int NAME_AND_TYPE_APPEND_D_STRINGBUFFER = 76;
- private static final int NAME_AND_TYPE_APPEND_STRING_STRINGBUFFER = 77;
- private static final int NAME_AND_TYPE_APPEND_Z_STRINGBUILDER = 78;
- private static final int NAME_AND_TYPE_APPEND_C_STRINGBUILDER = 79;
- private static final int NAME_AND_TYPE_APPEND_I_STRINGBUILDER = 80;
- private static final int NAME_AND_TYPE_APPEND_J_STRINGBUILDER = 81;
- private static final int NAME_AND_TYPE_APPEND_F_STRINGBUILDER = 82;
- private static final int NAME_AND_TYPE_APPEND_D_STRINGBUILDER = 83;
- private static final int NAME_AND_TYPE_APPEND_STRING_STRINGBUILDER = 84;
- private static final int NAME_AND_TYPE_TOSTRING = 85;
-
- private static final int UTF8_EMPTY = 86;
- private static final int UTF8_I = 87;
- private static final int UTF8_L = 88;
- private static final int UTF8_F = 89;
- private static final int UTF8_D = 90;
- private static final int UTF8_STRING = 91;
- private static final int UTF8_STRINGBUFFER = 92;
- private static final int UTF8_STRINGBUILDER = 93;
- private static final int UTF8_EQUALS = 94;
- private static final int UTF8_OBJECT_Z = 95;
- private static final int UTF8_LENGTH = 96;
- private static final int UTF8__I = 97;
- private static final int UTF8_INIT = 98;
- private static final int UTF8__VOID = 99;
- private static final int UTF8_STRING_VOID = 100;
- private static final int UTF8_TOSTRING = 101;
- private static final int UTF8__STRING = 102;
- private static final int UTF8_APPEND = 103;
- private static final int UTF8_Z_STRINGBUFFER = 104;
- private static final int UTF8_C_STRINGBUFFER = 105;
- private static final int UTF8_I_STRINGBUFFER = 106;
- private static final int UTF8_J_STRINGBUFFER = 107;
- private static final int UTF8_F_STRINGBUFFER = 108;
- private static final int UTF8_D_STRINGBUFFER = 109;
- private static final int UTF8_STRING_STRINGBUFFER = 110;
- private static final int UTF8_Z_STRINGBUILDER = 111;
- private static final int UTF8_C_STRINGBUILDER = 112;
- private static final int UTF8_I_STRINGBUILDER = 113;
- private static final int UTF8_J_STRINGBUILDER = 114;
- private static final int UTF8_F_STRINGBUILDER = 115;
- private static final int UTF8_D_STRINGBUILDER = 116;
- private static final int UTF8_STRING_STRINGBUILDER = 117;
-
- private static final int SENTINEL = 118;
+ private static final int TYPE_I = 39;
+ private static final int TYPE_L = 40;
+ private static final int TYPE_F = 41;
+ private static final int TYPE_D = 42;
public static final Constant[] CONSTANTS = new Constant[]
@@ -234,100 +136,23 @@ public class InstructionSequenceConstants
new DoubleConstant(-1d),
- new StringConstant(UTF8_EMPTY, null, null),
-
new FieldrefConstant(X, NAME_AND_TYPE_I, null, null),
new FieldrefConstant(X, NAME_AND_TYPE_L, null, null),
new FieldrefConstant(X, NAME_AND_TYPE_F, null, null),
new FieldrefConstant(X, NAME_AND_TYPE_D, null, null),
- new MethodrefConstant(CLASS_STRING, NAME_AND_TYPE_EQUALS, null, null),
- new MethodrefConstant(CLASS_STRING, NAME_AND_TYPE_LENGTH, null, null),
- new MethodrefConstant(CLASS_STRINGBUFFER, NAME_AND_TYPE_INIT, null, null),
- new MethodrefConstant(CLASS_STRINGBUFFER, NAME_AND_TYPE_INIT_STRING, null, null),
- new MethodrefConstant(CLASS_STRINGBUFFER, NAME_AND_TYPE_APPEND_Z_STRINGBUFFER, null, null),
- new MethodrefConstant(CLASS_STRINGBUFFER, NAME_AND_TYPE_APPEND_C_STRINGBUFFER, null, null),
- new MethodrefConstant(CLASS_STRINGBUFFER, NAME_AND_TYPE_APPEND_I_STRINGBUFFER, null, null),
- new MethodrefConstant(CLASS_STRINGBUFFER, NAME_AND_TYPE_APPEND_J_STRINGBUFFER, null, null),
- new MethodrefConstant(CLASS_STRINGBUFFER, NAME_AND_TYPE_APPEND_F_STRINGBUFFER, null, null),
- new MethodrefConstant(CLASS_STRINGBUFFER, NAME_AND_TYPE_APPEND_D_STRINGBUFFER, null, null),
- new MethodrefConstant(CLASS_STRINGBUFFER, NAME_AND_TYPE_APPEND_STRING_STRINGBUFFER, null, null),
- new MethodrefConstant(CLASS_STRINGBUFFER, NAME_AND_TYPE_LENGTH, null, null),
- new MethodrefConstant(CLASS_STRINGBUFFER, NAME_AND_TYPE_TOSTRING, null, null),
- new MethodrefConstant(CLASS_STRINGBUILDER, NAME_AND_TYPE_INIT, null, null),
- new MethodrefConstant(CLASS_STRINGBUILDER, NAME_AND_TYPE_INIT_STRING, null, null),
- new MethodrefConstant(CLASS_STRINGBUILDER, NAME_AND_TYPE_APPEND_Z_STRINGBUILDER, null, null),
- new MethodrefConstant(CLASS_STRINGBUILDER, NAME_AND_TYPE_APPEND_C_STRINGBUILDER, null, null),
- new MethodrefConstant(CLASS_STRINGBUILDER, NAME_AND_TYPE_APPEND_I_STRINGBUILDER, null, null),
- new MethodrefConstant(CLASS_STRINGBUILDER, NAME_AND_TYPE_APPEND_J_STRINGBUILDER, null, null),
- new MethodrefConstant(CLASS_STRINGBUILDER, NAME_AND_TYPE_APPEND_F_STRINGBUILDER, null, null),
- new MethodrefConstant(CLASS_STRINGBUILDER, NAME_AND_TYPE_APPEND_D_STRINGBUILDER, null, null),
- new MethodrefConstant(CLASS_STRINGBUILDER, NAME_AND_TYPE_APPEND_STRING_STRINGBUILDER, null, null),
- new MethodrefConstant(CLASS_STRINGBUILDER, NAME_AND_TYPE_LENGTH, null, null),
- new MethodrefConstant(CLASS_STRINGBUILDER, NAME_AND_TYPE_TOSTRING, null, null),
-
- new ClassConstant(UTF8_STRING, null),
- new ClassConstant(UTF8_STRINGBUFFER, null),
- new ClassConstant(UTF8_STRINGBUILDER, null),
-
- new NameAndTypeConstant(Y, UTF8_I),
- new NameAndTypeConstant(Y, UTF8_L),
- new NameAndTypeConstant(Y, UTF8_F),
- new NameAndTypeConstant(Y, UTF8_D),
- new NameAndTypeConstant(UTF8_EQUALS, UTF8_OBJECT_Z),
- new NameAndTypeConstant(UTF8_LENGTH, UTF8__I),
- new NameAndTypeConstant(UTF8_INIT, UTF8__VOID),
- new NameAndTypeConstant(UTF8_INIT, UTF8_STRING_VOID),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_Z_STRINGBUFFER),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_C_STRINGBUFFER),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_I_STRINGBUFFER),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_J_STRINGBUFFER),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_F_STRINGBUFFER),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_D_STRINGBUFFER),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_STRING_STRINGBUFFER),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_Z_STRINGBUILDER),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_C_STRINGBUILDER),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_I_STRINGBUILDER),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_J_STRINGBUILDER),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_F_STRINGBUILDER),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_D_STRINGBUILDER),
- new NameAndTypeConstant(UTF8_APPEND, UTF8_STRING_STRINGBUILDER),
- new NameAndTypeConstant(UTF8_TOSTRING, UTF8__STRING),
+ new NameAndTypeConstant(Y, TYPE_I),
+ new NameAndTypeConstant(Y, TYPE_L),
+ new NameAndTypeConstant(Y, TYPE_F),
+ new NameAndTypeConstant(Y, TYPE_D),
- new Utf8Constant(""),
new Utf8Constant("I"),
new Utf8Constant("J"),
new Utf8Constant("F"),
new Utf8Constant("D"),
- new Utf8Constant(ClassConstants.INTERNAL_NAME_JAVA_LANG_STRING),
- new Utf8Constant(ClassConstants.INTERNAL_NAME_JAVA_LANG_STRING_BUFFER),
- new Utf8Constant(ClassConstants.INTERNAL_NAME_JAVA_LANG_STRING_BUILDER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_EQUALS),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_EQUALS),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_LENGTH),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_LENGTH),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_INIT),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_INIT),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_STRING_VOID),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_TOSTRING),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_TOSTRING),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_NAME_APPEND),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_BOOLEAN_STRING_BUFFER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_CHAR_STRING_BUFFER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_INT_STRING_BUFFER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_LONG_STRING_BUFFER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_FLOAT_STRING_BUFFER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_DOUBLE_STRING_BUFFER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_STRING_STRING_BUFFER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_BOOLEAN_STRING_BUILDER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_CHAR_STRING_BUILDER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_INT_STRING_BUILDER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_LONG_STRING_BUILDER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_FLOAT_STRING_BUILDER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_DOUBLE_STRING_BUILDER),
- new Utf8Constant(ClassConstants.INTERNAL_METHOD_TYPE_STRING_STRING_BUILDER),
};
+
public static final Instruction[][][] VARIABLE = new Instruction[][][]
{
{ // nop = nothing
@@ -412,7 +237,7 @@ public class InstructionSequenceConstants
{ // a = a = nothing
{
new VariableInstruction(InstructionConstants.OP_ALOAD, X),
- new VariableInstruction(InstructionConstants.OP_ASTORE, X),
+ new SimpleInstruction(InstructionConstants.OP_POP),
},{
// Nothing.
},
@@ -557,12 +382,12 @@ public class InstructionSequenceConstants
},
{ // c * i = i * c
{
- new SimpleInstruction(InstructionConstants.OP_SIPUSH, A),
+ new SimpleInstruction(InstructionConstants.OP_ICONST_0, A),
new VariableInstruction(InstructionConstants.OP_ILOAD, X),
new SimpleInstruction(InstructionConstants.OP_IMUL),
},{
new VariableInstruction(InstructionConstants.OP_ILOAD, X),
- new SimpleInstruction(InstructionConstants.OP_SIPUSH, A),
+ new SimpleInstruction(InstructionConstants.OP_ICONST_0, A),
new SimpleInstruction(InstructionConstants.OP_IMUL),
},
},
@@ -723,7 +548,7 @@ public class InstructionSequenceConstants
{ // i = i + c = i += c
{
new VariableInstruction(InstructionConstants.OP_ILOAD, X),
- new SimpleInstruction(InstructionConstants.OP_SIPUSH, A),
+ new SimpleInstruction(InstructionConstants.OP_ICONST_0, A),
new SimpleInstruction(InstructionConstants.OP_IADD),
new VariableInstruction(InstructionConstants.OP_ISTORE, X),
},{
@@ -826,23 +651,22 @@ public class InstructionSequenceConstants
// Nothing.
},
},
- // Not valid for -0.0.
-// { // ... + 0f = ...
-// {
-// new SimpleInstruction(InstructionConstants.OP_FCONST_0),
-// new SimpleInstruction(InstructionConstants.OP_FADD),
-// },{
-// // Nothing.
-// },
-// },
-// { // ... + 0d = ...
-// {
-// new SimpleInstruction(InstructionConstants.OP_DCONST_0),
-// new SimpleInstruction(InstructionConstants.OP_DADD),
-// },{
-// // Nothing.
-// },
-// },
+ { // ... + 0f = ...
+ {
+ new SimpleInstruction(InstructionConstants.OP_FCONST_0),
+ new SimpleInstruction(InstructionConstants.OP_FADD),
+ },{
+ // Nothing.
+ },
+ },
+ { // ... + 0d = ...
+ {
+ new SimpleInstruction(InstructionConstants.OP_DCONST_0),
+ new SimpleInstruction(InstructionConstants.OP_DADD),
+ },{
+ // Nothing.
+ },
+ },
{ // ... - 0 = ...
{
new SimpleInstruction(InstructionConstants.OP_ICONST_0),
@@ -1248,8 +1072,7 @@ public class InstructionSequenceConstants
new SimpleInstruction(InstructionConstants.OP_FNEG),
},
},
- // Not valid for -0.0 and for NaN.
-// { // ... * 0f = 0f
+// { // ... * 0f = 0f (or NaN)
// {
// new SimpleInstruction(InstructionConstants.OP_FCONST_0),
// new SimpleInstruction(InstructionConstants.OP_FMUL),
@@ -1274,8 +1097,7 @@ public class InstructionSequenceConstants
new SimpleInstruction(InstructionConstants.OP_DNEG),
},
},
- // Not valid for -0.0 and for NaN.
-// { // ... * 0d = 0d
+// { // ... * 0d = 0d (or NaN)
// {
// new SimpleInstruction(InstructionConstants.OP_DCONST_0),
// new SimpleInstruction(InstructionConstants.OP_DMUL),
@@ -1682,7 +1504,6 @@ public class InstructionSequenceConstants
new SimpleInstruction(InstructionConstants.OP_ICONST_0),
},
},
- // Not valid for negative values.
// { // ... % 2 = ... & 0x1
// {
// new SimpleInstruction(InstructionConstants.OP_ICONST_2),
@@ -3527,898 +3348,4 @@ public class InstructionSequenceConstants
// },
// }
};
-
- public static final Instruction[][][] STRING = new Instruction[][][]
- {
- { // "...".equals("...") = true
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRING_EQUALS),
- },{
- new SimpleInstruction(InstructionConstants.OP_ICONST_1),
- },
- },
- { // "...".length() = ...
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRING_LENGTH),
- },{
- new SimpleInstruction(InstructionConstants.OP_SIPUSH, STRING_A_LENGTH),
- },
- },
-
- { // new StringBuffer("...").toString() = "..." (ignoring identity)
- {
- new ConstantInstruction(InstructionConstants.OP_NEW, CLASS_STRINGBUFFER),
- new SimpleInstruction(InstructionConstants.OP_DUP),
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_TOSTRING),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- },
- },
- { // new StringBuffer("...").length() = length
- {
- new ConstantInstruction(InstructionConstants.OP_NEW, CLASS_STRINGBUFFER),
- new SimpleInstruction(InstructionConstants.OP_DUP),
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_LENGTH),
- },{
- new SimpleInstruction(InstructionConstants.OP_SIPUSH, STRING_A_LENGTH),
- },
- },
- { // StringBuffer#append("") = nothing
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_EMPTY),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },{
- // Nothing.
- },
- },
- { // new StringBuffer().append(Z) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_BOOLEAN),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, BOOLEAN_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer().append(C) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_CHAR),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, CHAR_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer().append(Cc) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT),
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_CHAR),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, CHAR_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer().append(I) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_INTEGER),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, INT_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer().append(Ic) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT),
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_INTEGER),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, INT_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer().append(J) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT),
- new SimpleInstruction(InstructionConstants.OP_LCONST_0, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_LONG),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, LONG_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer().append(Jc) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT),
- new ConstantInstruction(InstructionConstants.OP_LDC2_W, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_LONG),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, LONG_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer().append(F) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT),
- new SimpleInstruction(InstructionConstants.OP_FCONST_0, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_FLOAT),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, FLOAT_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer().append(Fc) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT),
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_FLOAT),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, FLOAT_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer().append(D) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT),
- new SimpleInstruction(InstructionConstants.OP_DCONST_0, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_DOUBLE),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, DOUBLE_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer().append(Dc) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT),
- new ConstantInstruction(InstructionConstants.OP_LDC2_W, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_DOUBLE),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, DOUBLE_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer().append("...") = new StringBuffer("......")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT),
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer("...").append(Z) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_BOOLEAN),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | BOOLEAN_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer("...").append(C) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_CHAR),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | CHAR_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer("...").append(Cc) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_CHAR),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | CHAR_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer("...").append(I) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_INTEGER),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | INT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer("...").append(Ic) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_INTEGER),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | INT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer("...").append(J) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new SimpleInstruction(InstructionConstants.OP_LCONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_LONG),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | LONG_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer("...").append(Jc) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC2_W, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_LONG),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | LONG_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer("...").append(F) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new SimpleInstruction(InstructionConstants.OP_FCONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_FLOAT),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | FLOAT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer("...").append(Fc) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_FLOAT),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | FLOAT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer("...").append(D) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new SimpleInstruction(InstructionConstants.OP_DCONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_DOUBLE),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | DOUBLE_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer("...").append(Dc) = new StringBuffer("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC2_W, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_DOUBLE),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | DOUBLE_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // new StringBuffer("...").append("...") = new StringBuffer("......")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | STRING_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUFFER_INIT_STRING),
- },
- },
- { // StringBuffer#append("...").append(Z) = StringBuffer#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_BOOLEAN),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | BOOLEAN_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },
- },
- { // StringBuffer#append("...").append(C) = StringBuffer#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_CHAR),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | CHAR_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },
- },
- { // StringBuffer#append("...").append(Cc) = StringBuffer#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_CHAR),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | CHAR_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },
- },
- { // StringBuffer#append("...").append(I) = StringBuffer#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_INTEGER),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | INT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },
- },
- { // StringBuffer#append("...").append(Ic) = StringBuffer#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_INTEGER),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | INT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },
- },
- { // StringBuffer#append("...").append(J) = StringBuffer#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- new SimpleInstruction(InstructionConstants.OP_LCONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_LONG),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | LONG_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },
- },
- { // StringBuffer#append("...").append(Jc) = StringBuffer#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC2_W, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_LONG),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | LONG_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },
- },
- { // StringBuffer#append("...").append(F) = StringBuffer#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- new SimpleInstruction(InstructionConstants.OP_FCONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_FLOAT),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | FLOAT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },
- },
- { // StringBuffer#append("...").append(Fc) = StringBuffer#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_FLOAT),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | FLOAT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },
- },
- { // StringBuffer#append("...").append(D) = StringBuffer#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- new SimpleInstruction(InstructionConstants.OP_DCONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_DOUBLE),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | DOUBLE_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },
- },
- { // StringBuffer#append("...").append(Dc) = StringBuffer#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC2_W, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_DOUBLE),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | DOUBLE_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },
- },
- { // StringBuffer#append("...").append("...") = StringBuffer#append("......")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | STRING_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUFFER_APPEND_STRING),
- },
- },
-
- { // new StringBuilder("...").toString() = "..." (ignoring identity)
- {
- new ConstantInstruction(InstructionConstants.OP_NEW, CLASS_STRINGBUILDER),
- new SimpleInstruction(InstructionConstants.OP_DUP),
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_TOSTRING),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- },
- },
- { // new StringBuilder("...").length() = length
- {
- new ConstantInstruction(InstructionConstants.OP_NEW, CLASS_STRINGBUILDER),
- new SimpleInstruction(InstructionConstants.OP_DUP),
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_LENGTH),
- },{
- new SimpleInstruction(InstructionConstants.OP_SIPUSH, STRING_A_LENGTH),
- },
- },
- { // StringBuilder#append("") = nothing
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_EMPTY),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },{
- // Nothing.
- },
- },
- { // new StringBuilder().append(Z) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_BOOLEAN),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, BOOLEAN_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder().append(C) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_CHAR),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, CHAR_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder().append(Cc) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT),
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_CHAR),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, CHAR_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder().append(I) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_INTEGER),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, INT_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder().append(Ic) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT),
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_INTEGER),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, INT_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder().append(J) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT),
- new SimpleInstruction(InstructionConstants.OP_LCONST_0, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_LONG),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, LONG_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder().append(Jc) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT),
- new ConstantInstruction(InstructionConstants.OP_LDC2_W, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_LONG),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, LONG_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder().append(F) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT),
- new SimpleInstruction(InstructionConstants.OP_FCONST_0, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_FLOAT),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, FLOAT_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder().append(Fc) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT),
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_FLOAT),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, FLOAT_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder().append(D) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT),
- new SimpleInstruction(InstructionConstants.OP_DCONST_0, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_DOUBLE),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, DOUBLE_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder().append(Dc) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT),
- new ConstantInstruction(InstructionConstants.OP_LDC2_W, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_DOUBLE),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, DOUBLE_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder().append("...") = new StringBuilder("......")
- {
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT),
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder("...").append(Z) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_BOOLEAN),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | BOOLEAN_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder("...").append(C) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_CHAR),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | CHAR_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder("...").append(Cc) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_CHAR),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | CHAR_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder("...").append(I) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_INTEGER),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | INT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder("...").append(Ic) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_INTEGER),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | INT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder("...").append(J) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new SimpleInstruction(InstructionConstants.OP_LCONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_LONG),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | LONG_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder("...").append(Jc) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC2_W, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_LONG),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | LONG_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder("...").append(F) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new SimpleInstruction(InstructionConstants.OP_FCONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_FLOAT),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | FLOAT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder("...").append(Fc) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_FLOAT),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | FLOAT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder("...").append(D) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new SimpleInstruction(InstructionConstants.OP_DCONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_DOUBLE),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | DOUBLE_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder("...").append(Dc) = new StringBuilder("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC2_W, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_DOUBLE),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | DOUBLE_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // new StringBuilder("...").append("...") = new StringBuilder("......")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | STRING_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKESPECIAL, METHOD_STRINGBUILDER_INIT_STRING),
- },
- },
- { // StringBuilder#append("...").append(Z) = StringBuilder#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_BOOLEAN),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | BOOLEAN_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },
- },
- { // StringBuilder#append("...").append(C) = StringBuilder#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_CHAR),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | CHAR_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },
- },
- { // StringBuilder#append("...").append(Cc) = StringBuilder#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_CHAR),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | CHAR_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },
- },
- { // StringBuilder#append("...").append(I) = StringBuilder#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- new SimpleInstruction(InstructionConstants.OP_ICONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_INTEGER),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | INT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },
- },
- { // StringBuilder#append("...").append(Ic) = StringBuilder#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_INTEGER),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | INT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },
- },
- { // StringBuilder#append("...").append(J) = StringBuilder#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- new SimpleInstruction(InstructionConstants.OP_LCONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_LONG),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | LONG_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },
- },
- { // StringBuilder#append("...").append(Jc) = StringBuilder#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC2_W, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_LONG),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | LONG_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },
- },
- { // StringBuilder#append("...").append(F) = StringBuilder#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- new SimpleInstruction(InstructionConstants.OP_FCONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_FLOAT),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | FLOAT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },
- },
- { // StringBuilder#append("...").append(Fc) = StringBuilder#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_FLOAT),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | FLOAT_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },
- },
- { // StringBuilder#append("...").append(D) = StringBuilder#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- new SimpleInstruction(InstructionConstants.OP_DCONST_0, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_DOUBLE),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | DOUBLE_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },
- },
- { // StringBuilder#append("...").append(Dc) = StringBuilder#append("....")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC2_W, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_DOUBLE),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | DOUBLE_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },
- },
- { // StringBuilder#append("...").append("...") = StringBuilder#append("......")
- {
- new ConstantInstruction(InstructionConstants.OP_LDC, A),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- new ConstantInstruction(InstructionConstants.OP_LDC, B),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },{
- new ConstantInstruction(InstructionConstants.OP_LDC, STRING_A_STRING | STRING_B_STRING),
- new ConstantInstruction(InstructionConstants.OP_INVOKEVIRTUAL, METHOD_STRINGBUILDER_APPEND_STRING),
- },
- },
- };
-
- /*
- static
- {
- ProgramClass clazz = new ProgramClass();
- clazz.constantPool = CONSTANTS;
-
- ClassPrinter printer = new ClassPrinter();
-
- for (int index = 0; index < CONSTANTS.length; index++)
- {
- System.out.print("["+index+"] ");
- try
- {
- CONSTANTS[index].accept(clazz, printer);
- }
- catch (Exception e)
- {
- System.out.println("("+e.getClass().getName()+")");
- }
- }
-
- if (CONSTANTS.length != SENTINEL)
- {
- throw new IllegalStateException("Constants length ["+CONSTANTS.length+"] different from number of constant names ["+SENTINEL+"]");
- }
-
- Instruction[] instructions = STRING[2][0];
-
- for (int index = 0; index < instructions.length; index++)
- {
- Instruction instruction = instructions[index];
- try
- {
- instruction.accept(clazz, null, null, index, new ClassPrinter());
- }
- catch (Exception e)
- {
- //System.out.println(" "+instruction.toString(offset));
- }
- }
- }
- //*/
-}
+} \ No newline at end of file
diff --git a/src/proguard/optimize/peephole/InstructionSequenceReplacer.java b/src/proguard/optimize/peephole/InstructionSequenceReplacer.java
index be65b53..bce06e2 100644
--- a/src/proguard/optimize/peephole/InstructionSequenceReplacer.java
+++ b/src/proguard/optimize/peephole/InstructionSequenceReplacer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -22,9 +22,9 @@ package proguard.optimize.peephole;
import proguard.classfile.*;
import proguard.classfile.attribute.CodeAttribute;
-import proguard.classfile.constant.*;
+import proguard.classfile.constant.Constant;
import proguard.classfile.constant.visitor.ConstantVisitor;
-import proguard.classfile.editor.*;
+import proguard.classfile.editor.CodeAttributeEditor;
import proguard.classfile.instruction.*;
import proguard.classfile.instruction.visitor.InstructionVisitor;
import proguard.classfile.util.*;
@@ -42,48 +42,10 @@ extends SimplifiedVisitor
implements InstructionVisitor,
ConstantVisitor
{
- /*
- public static boolean DEBUG = true;
- /*/
private static final boolean DEBUG = false;
- //*/
-
- public static final int X = InstructionSequenceMatcher.X;
- public static final int Y = InstructionSequenceMatcher.Y;
- public static final int Z = InstructionSequenceMatcher.Z;
-
- public static final int A = InstructionSequenceMatcher.A;
- public static final int B = InstructionSequenceMatcher.B;
- public static final int C = InstructionSequenceMatcher.C;
- public static final int D = InstructionSequenceMatcher.D;
-
- private static final int BOOLEAN_STRING = 0x1;
- private static final int CHAR_STRING = 0x2;
- private static final int INT_STRING = 0x3;
- private static final int LONG_STRING = 0x4;
- private static final int FLOAT_STRING = 0x5;
- private static final int DOUBLE_STRING = 0x6;
- private static final int STRING_STRING = 0x7;
-
- public static final int STRING_A_LENGTH = 0x20000000;
- public static final int BOOLEAN_A_STRING = 0x20000001;
- public static final int CHAR_A_STRING = 0x20000002;
- public static final int INT_A_STRING = 0x20000003;
- public static final int LONG_A_STRING = 0x20000004;
- public static final int FLOAT_A_STRING = 0x20000005;
- public static final int DOUBLE_A_STRING = 0x20000006;
- public static final int STRING_A_STRING = 0x20000007;
- public static final int BOOLEAN_B_STRING = 0x20000010;
- public static final int CHAR_B_STRING = 0x20000020;
- public static final int INT_B_STRING = 0x20000030;
- public static final int LONG_B_STRING = 0x20000040;
- public static final int FLOAT_B_STRING = 0x20000050;
- public static final int DOUBLE_B_STRING = 0x20000060;
- public static final int STRING_B_STRING = 0x20000070;
private final InstructionSequenceMatcher instructionSequenceMatcher;
- private final Constant[] patternConstants;
private final Instruction[] replacementInstructions;
private final BranchTargetFinder branchTargetFinder;
private final CodeAttributeEditor codeAttributeEditor;
@@ -139,7 +101,6 @@ implements InstructionVisitor,
InstructionVisitor extraInstructionVisitor)
{
this.instructionSequenceMatcher = new InstructionSequenceMatcher(patternConstants, patternInstructions);
- this.patternConstants = patternConstants;
this.replacementInstructions = replacementInstructions;
this.branchTargetFinder = branchTargetFinder;
this.codeAttributeEditor = codeAttributeEditor;
@@ -179,7 +140,7 @@ implements InstructionVisitor,
for (int index = 0; index < replacementInstructions.length; index++)
{
int matchedOffset = instructionSequenceMatcher.matchedInstructionOffset(index);
- System.out.println(" "+replacementInstructionFactory.create(clazz, index).shrink().toString(matchedOffset));
+ System.out.println(" "+replacementInstructionFactory.create(index).shrink().toString(matchedOffset));
}
}
@@ -187,7 +148,7 @@ implements InstructionVisitor,
for (int index = 0; index < replacementInstructions.length; index++)
{
codeAttributeEditor.replaceInstruction(instructionSequenceMatcher.matchedInstructionOffset(index),
- replacementInstructionFactory.create(clazz, index).shrink());
+ replacementInstructionFactory.create(index).shrink());
}
// Delete any remaining instructions in the from sequence.
@@ -243,10 +204,10 @@ implements InstructionVisitor,
* Creates the replacement instruction for the given index in the
* instruction sequence.
*/
- public Instruction create(Clazz clazz, int index)
+ public Instruction create(int index)
{
// Create the instruction.
- replacementInstructions[index].accept(clazz,
+ replacementInstructions[index].accept(null,
null,
null,
instructionSequenceMatcher.matchedInstructionOffset(index),
@@ -263,7 +224,7 @@ implements InstructionVisitor,
{
replacementInstruction =
new SimpleInstruction(simpleInstruction.opcode,
- matchedArgument(clazz, simpleInstruction.constant));
+ instructionSequenceMatcher.matchedArgument(simpleInstruction.constant));
}
@@ -280,8 +241,7 @@ implements InstructionVisitor,
{
replacementInstruction =
new ConstantInstruction(constantInstruction.opcode,
- matchedConstantIndex((ProgramClass)clazz,
- constantInstruction.constantIndex),
+ instructionSequenceMatcher.matchedConstantIndex(constantInstruction.constantIndex),
instructionSequenceMatcher.matchedArgument(constantInstruction.constant));
}
@@ -290,8 +250,7 @@ implements InstructionVisitor,
{
replacementInstruction =
new BranchInstruction(branchInstruction.opcode,
- instructionSequenceMatcher.matchedBranchOffset(offset,
- branchInstruction.branchOffset));
+ instructionSequenceMatcher.matchedBranchOffset(offset, branchInstruction.branchOffset));
}
@@ -302,8 +261,7 @@ implements InstructionVisitor,
instructionSequenceMatcher.matchedBranchOffset(offset, tableSwitchInstruction.defaultOffset),
instructionSequenceMatcher.matchedArgument(tableSwitchInstruction.lowCase),
instructionSequenceMatcher.matchedArgument(tableSwitchInstruction.highCase),
- instructionSequenceMatcher.matchedJumpOffsets(offset,
- tableSwitchInstruction.jumpOffsets));
+ instructionSequenceMatcher.matchedJumpOffsets(offset, tableSwitchInstruction.jumpOffsets));
}
@@ -316,105 +274,5 @@ implements InstructionVisitor,
instructionSequenceMatcher.matchedArguments(lookUpSwitchInstruction.cases),
instructionSequenceMatcher.matchedJumpOffsets(offset, lookUpSwitchInstruction.jumpOffsets));
}
-
-
- /**
- * Returns the matched argument for the given pattern argument.
- */
- private int matchedArgument(Clazz clazz, int argument)
- {
- // Special case: do we have to compute the string length?
- if (argument == STRING_A_LENGTH)
- {
- // Return the string length.
- return clazz.getStringString(instructionSequenceMatcher.matchedArgument(A)).length();
- }
-
- // Otherwise, just return the matched argument.
- return instructionSequenceMatcher.matchedArgument(argument);
- }
-
-
- /**
- * Returns the matched or newly created constant index for the given
- * pattern constant index.
- */
- private int matchedConstantIndex(ProgramClass programClass, int constantIndex)
- {
- // Special case: do we have to create a concatenated string?
- if (constantIndex >= BOOLEAN_A_STRING &&
- constantIndex <= (STRING_A_STRING | STRING_B_STRING))
- {
- // Create a new string constant and return its index.
- return new ConstantPoolEditor(programClass).addStringConstant(
- argumentAsString(programClass, constantIndex & 0xf, A) +
- argumentAsString(programClass, (constantIndex >>> 4) & 0xf, B),
- null,
- null);
- }
-
- int matchedConstantIndex =
- instructionSequenceMatcher.matchedConstantIndex(constantIndex);
-
- // Do we have a matched constant index?
- if (matchedConstantIndex > 0)
- {
- // Return its index.
- return matchedConstantIndex;
- }
-
- // Otherwise, we still have to create a new constant.
- // This currently only works for constants without any wildcards.
- ProgramClass dummyClass = new ProgramClass();
- dummyClass.constantPool = patternConstants;
-
- return new ConstantAdder(programClass).addConstant(dummyClass, constantIndex);
- }
-
-
- private String argumentAsString(ProgramClass programClass,
- int valueType,
- int argument)
- {
- switch (valueType)
- {
- case BOOLEAN_STRING:
- return Boolean.toString((instructionSequenceMatcher.wasConstant(argument) ?
- ((IntegerConstant)(programClass.getConstant(instructionSequenceMatcher.matchedConstantIndex(argument)))).getValue() :
- instructionSequenceMatcher.matchedArgument(argument)) != 0);
-
- case CHAR_STRING:
- return Character.toString((char)(instructionSequenceMatcher.wasConstant(argument) ?
- ((IntegerConstant)(programClass.getConstant(instructionSequenceMatcher.matchedConstantIndex(argument)))).getValue() :
- instructionSequenceMatcher.matchedArgument(argument)));
-
- case INT_STRING:
- return Integer.toString(instructionSequenceMatcher.wasConstant(argument) ?
- ((IntegerConstant)(programClass.getConstant(instructionSequenceMatcher.matchedConstantIndex(argument)))).getValue() :
- instructionSequenceMatcher.matchedArgument(argument));
-
- case LONG_STRING:
- return Long.toString(instructionSequenceMatcher.wasConstant(argument) ?
- ((LongConstant)(programClass.getConstant(instructionSequenceMatcher.matchedConstantIndex(argument)))).getValue() :
- instructionSequenceMatcher.matchedArgument(argument));
-
- case FLOAT_STRING:
- return Float.toString(instructionSequenceMatcher.wasConstant(argument) ?
- ((FloatConstant)(programClass.getConstant(instructionSequenceMatcher.matchedConstantIndex(argument)))).getValue() :
- instructionSequenceMatcher.matchedArgument(argument));
-
- case DOUBLE_STRING:
- return Double.toString(instructionSequenceMatcher.wasConstant(argument) ?
- ((DoubleConstant)(programClass.getConstant(instructionSequenceMatcher.matchedConstantIndex(argument)))).getValue() :
- instructionSequenceMatcher.matchedArgument(argument));
-
- case STRING_STRING:
- return
- programClass.getStringString(instructionSequenceMatcher.matchedConstantIndex(argument));
-
- default:
- return "";
- }
- }
}
}
diff --git a/src/proguard/optimize/peephole/InstructionSequencesReplacer.java b/src/proguard/optimize/peephole/InstructionSequencesReplacer.java
index 72fc334..f12b51a 100644
--- a/src/proguard/optimize/peephole/InstructionSequencesReplacer.java
+++ b/src/proguard/optimize/peephole/InstructionSequencesReplacer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/optimize/peephole/MemberPrivatizer.java b/src/proguard/optimize/peephole/MemberPrivatizer.java
index 254e968..55b2f31 100644
--- a/src/proguard/optimize/peephole/MemberPrivatizer.java
+++ b/src/proguard/optimize/peephole/MemberPrivatizer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/optimize/peephole/MethodFinalizer.java b/src/proguard/optimize/peephole/MethodFinalizer.java
index 140a114..af1811b 100644
--- a/src/proguard/optimize/peephole/MethodFinalizer.java
+++ b/src/proguard/optimize/peephole/MethodFinalizer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/optimize/peephole/MethodInliner.java b/src/proguard/optimize/peephole/MethodInliner.java
index 8857202..55f9ccb 100644
--- a/src/proguard/optimize/peephole/MethodInliner.java
+++ b/src/proguard/optimize/peephole/MethodInliner.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -29,10 +29,10 @@ import proguard.classfile.editor.*;
import proguard.classfile.instruction.*;
import proguard.classfile.instruction.visitor.InstructionVisitor;
import proguard.classfile.util.*;
-import proguard.classfile.visitor.*;
+import proguard.classfile.visitor.MemberVisitor;
import proguard.optimize.info.*;
-import java.util.*;
+import java.util.Stack;
/**
* This AttributeVisitor inlines short methods or methods that are only invoked
@@ -48,7 +48,7 @@ implements AttributeVisitor,
MemberVisitor
{
private static final int MAXIMUM_INLINED_CODE_LENGTH = Integer.parseInt(System.getProperty("maximum.inlined.code.length", "8"));
- private static final int MAXIMUM_RESULTING_CODE_LENGTH_JSE = Integer.parseInt(System.getProperty("maximum.resulting.code.length", "7000"));
+ private static final int MAXIMUM_RESULTING_CODE_LENGTH_JSE = Integer.parseInt(System.getProperty("maximum.resulting.code.length", "8000"));
private static final int MAXIMUM_RESULTING_CODE_LENGTH_JME = Integer.parseInt(System.getProperty("maximum.resulting.code.length", "2000"));
private static final int MAXIMUM_CODE_EXPANSION = 2;
private static final int MAXIMUM_EXTRA_CODE_LENGTH = 128;
@@ -138,42 +138,6 @@ implements AttributeVisitor,
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
{
- // TODO: Remove this when the method inliner has stabilized.
- // Catch any unexpected exceptions from the actual visiting method.
- try
- {
- // Process the code.
- visitCodeAttribute0(clazz, method, codeAttribute);
- }
- catch (RuntimeException ex)
- {
- System.err.println("Unexpected error while inlining method:");
- System.err.println(" Target class = ["+targetClass.getName()+"]");
- System.err.println(" Target method = ["+targetMethod.getName(targetClass)+targetMethod.getDescriptor(targetClass)+"]");
- if (inlining)
- {
- System.err.println(" Inlined class = ["+clazz.getName()+"]");
- System.err.println(" Inlined method = ["+method.getName(clazz)+method.getDescriptor(clazz)+"]");
- }
- System.err.println(" Exception = ["+ex.getClass().getName()+"] ("+ex.getMessage()+")");
- System.err.println("Not inlining this method");
-
- if (DEBUG)
- {
- targetMethod.accept(targetClass, new ClassPrinter());
- if (inlining)
- {
- method.accept(clazz, new ClassPrinter());
- }
-
- throw ex;
- }
- }
- }
-
-
- public void visitCodeAttribute0(Clazz clazz, Method method, CodeAttribute codeAttribute)
- {
if (!inlining)
{
// codeAttributeComposer.DEBUG = DEBUG =
@@ -341,12 +305,12 @@ implements AttributeVisitor,
// Copy the instructions.
codeAttribute.instructionsAccept(clazz, method, this);
- // Append a label just after the code.
- codeAttributeComposer.appendLabel(codeAttribute.u4codeLength);
-
// Copy the exceptions.
codeAttribute.exceptionsAccept(clazz, method, exceptionInfoAdder);
+ // Append a label just after the code.
+ codeAttributeComposer.appendLabel(codeAttribute.u4codeLength);
+
codeAttributeComposer.endCodeFragment();
}
@@ -493,42 +457,42 @@ implements AttributeVisitor,
if (// Only inline the method if it is private, static, or final.
(accessFlags & (ClassConstants.INTERNAL_ACC_PRIVATE |
ClassConstants.INTERNAL_ACC_STATIC |
- ClassConstants.INTERNAL_ACC_FINAL)) != 0 &&
+ ClassConstants.INTERNAL_ACC_FINAL)) != 0 &&
// Only inline the method if it is not synchronized, etc.
(accessFlags & (ClassConstants.INTERNAL_ACC_SYNCHRONIZED |
ClassConstants.INTERNAL_ACC_NATIVE |
ClassConstants.INTERNAL_ACC_INTERFACE |
- ClassConstants.INTERNAL_ACC_ABSTRACT)) == 0 &&
+ ClassConstants.INTERNAL_ACC_ABSTRACT)) == 0 &&
// Don't inline an <init> method, except in an <init> method in the
// same class.
// (!programMethod.getName(programClass).equals(ClassConstants.INTERNAL_METHOD_NAME_INIT) ||
// (programClass.equals(targetClass) &&
// targetMethod.getName(targetClass).equals(ClassConstants.INTERNAL_METHOD_NAME_INIT))) &&
- !programMethod.getName(programClass).equals(ClassConstants.INTERNAL_METHOD_NAME_INIT) &&
+ !programMethod.getName(programClass).equals(ClassConstants.INTERNAL_METHOD_NAME_INIT) &&
// Don't inline a method into itself.
(!programMethod.equals(targetMethod) ||
- !programClass.equals(targetClass)) &&
+ !programClass.equals(targetClass)) &&
// Only inline the method if it isn't recursing.
- !inliningMethods.contains(programMethod) &&
+ !inliningMethods.contains(programMethod) &&
// Only inline the method if its target class has at least the
// same version number as the source class, in order to avoid
// introducing incompatible constructs.
- targetClass.u4version >= programClass.u4version &&
+ targetClass.u4version >= programClass.u4version &&
// Only inline the method if it doesn't invoke a super method, or if
// it is in the same class.
(!SuperInvocationMarker.invokesSuperMethods(programMethod) ||
- programClass.equals(targetClass)) &&
+ programClass.equals(targetClass)) &&
// Only inline the method if it doesn't branch backward while there
// are uninitialized objects.
(!BackwardBranchMarker.branchesBackward(programMethod) ||
- uninitializedObjectCount == 0) &&
+ uninitializedObjectCount == 0) &&
// Only inline if the code access of the inlined method allows it.
(allowAccessModification ||
@@ -537,24 +501,47 @@ implements AttributeVisitor,
(!AccessMethodMarker.accessesPackageCode(programMethod) ||
ClassUtil.internalPackageName(programClass.getName()).equals(
- ClassUtil.internalPackageName(targetClass.getName()))))) &&
+ ClassUtil.internalPackageName(targetClass.getName()))))) &&
// (!AccessMethodMarker.accessesProtectedCode(programMethod) ||
// targetClass.extends_(programClass) ||
// targetClass.implements_(programClass)) ||
(!AccessMethodMarker.accessesProtectedCode(programMethod) ||
- programClass.equals(targetClass)) &&
+ programClass.equals(targetClass)) &&
// Only inline the method if it doesn't catch exceptions, or if it
// is invoked with an empty stack.
(!CatchExceptionMarker.catchesExceptions(programMethod) ||
- emptyInvokingStack) &&
+ emptyInvokingStack) &&
- // Only inline the method if it comes from the a class with at most
- // a subset of the initialized superclasses.
+ // Only inline the method if it comes from the same class or from
+ // a class with a static initializer.
(programClass.equals(targetClass) ||
- initializedSuperClasses(targetClass).containsAll(initializedSuperClasses(programClass))))
- { boolean oldInlining = inlining;
+ programClass.findMethod(ClassConstants.INTERNAL_METHOD_NAME_CLINIT,
+ ClassConstants.INTERNAL_METHOD_TYPE_CLINIT) == null))
+ {
+// System.out.print("MethodInliner: inlining ");
+// programMethod.accept(programClass, new SimpleClassPrinter(true));
+// System.out.print(" in ");
+// targetMethod.accept(targetClass, new SimpleClassPrinter(true));
+//
+// System.out.println(" Private: "+
+// (!AccessMethodMarker.accessesPrivateCode(programMethod) ||
+// programClass.equals(targetClass)));
+//
+// System.out.println(" Package: "+
+// (!AccessMethodMarker.accessesPackageCode(programMethod) ||
+// ClassUtil.internalPackageName(programClass.getName()).equals(
+// ClassUtil.internalPackageName(targetClass.getName()))));
+//
+// System.out.println(" Protected: "+
+// ((!AccessMethodMarker.accessesProtectedCode(programMethod) ||
+// targetClass.extends_(programClass) ||
+// targetClass.implements_(programClass)) ||
+// ClassUtil.internalPackageName(programClass.getName()).equals(
+// ClassUtil.internalPackageName(targetClass.getName()))));
+
+ boolean oldInlining = inlining;
inlining = true;
inliningMethods.push(programMethod);
@@ -577,21 +564,4 @@ implements AttributeVisitor,
uninitializedObjectCount--;
}
}
-
-
- /**
- * Returns the set of superclasses and interfaces that are initialized.
- */
- private Set initializedSuperClasses(Clazz clazz)
- {
- Set set = new HashSet();
-
- // Visit all superclasses and interfaces, collecting the ones that have
- // static initializers.
- clazz.hierarchyAccept(true, true, true, false,
- new StaticInitializerContainingClassFilter(
- new ClassCollector(set)));
-
- return set;
- }
}
diff --git a/src/proguard/optimize/peephole/NopRemover.java b/src/proguard/optimize/peephole/NopRemover.java
index 4c99f3a..69adb30 100644
--- a/src/proguard/optimize/peephole/NopRemover.java
+++ b/src/proguard/optimize/peephole/NopRemover.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/optimize/peephole/PeepholeOptimizer.java b/src/proguard/optimize/peephole/PeepholeOptimizer.java
index d865638..98f8e8d 100644
--- a/src/proguard/optimize/peephole/PeepholeOptimizer.java
+++ b/src/proguard/optimize/peephole/PeepholeOptimizer.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/optimize/peephole/ReachableCodeMarker.java b/src/proguard/optimize/peephole/ReachableCodeMarker.java
index cac1965..d9dbf2d 100644
--- a/src/proguard/optimize/peephole/ReachableCodeMarker.java
+++ b/src/proguard/optimize/peephole/ReachableCodeMarker.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -27,8 +27,6 @@ import proguard.classfile.instruction.*;
import proguard.classfile.instruction.visitor.InstructionVisitor;
import proguard.classfile.util.SimplifiedVisitor;
-import java.util.Arrays;
-
/**
* This AttributeVisitor finds all instruction offsets, branch targets, and
* exception targets in the CodeAttribute objects that it visits.
@@ -93,7 +91,10 @@ implements AttributeVisitor,
else
{
// Reset the array.
- Arrays.fill(isReachable, 0, codeLength, false);
+ for (int index = 0; index < codeLength; index++)
+ {
+ isReachable[index] = false;
+ }
}
// Mark the code, starting at the entry point.
diff --git a/src/proguard/optimize/peephole/RetargetedInnerClassAttributeRemover.java b/src/proguard/optimize/peephole/RetargetedInnerClassAttributeRemover.java
index 254f748..6707a12 100644
--- a/src/proguard/optimize/peephole/RetargetedInnerClassAttributeRemover.java
+++ b/src/proguard/optimize/peephole/RetargetedInnerClassAttributeRemover.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -28,8 +28,6 @@ import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.util.SimplifiedVisitor;
import proguard.classfile.visitor.ClassVisitor;
-import java.util.Arrays;
-
/**
* This ClassVisitor removes InnerClasses and EnclosingMethod attributes in
* classes that are retargeted or that refer to classes that are retargeted.
@@ -72,7 +70,10 @@ implements ClassVisitor,
}
// Clean up any remaining array elements.
- Arrays.fill(attributes, newAtributesCount, attributesCount, null);
+ for (int index = newAtributesCount; index < attributesCount; index++)
+ {
+ attributes[index] = null;
+ }
// Update the number of attribuets.
programClass.u2attributesCount = newAtributesCount;
@@ -89,39 +90,8 @@ implements ClassVisitor,
// Check whether the class itself is retargeted.
checkTarget(clazz);
- if (!retargeted)
- {
- // Check whether the referenced classes are retargeted.
- innerClassesAttribute.innerClassEntriesAccept(clazz, this);
- int classesCount = innerClassesAttribute.u2classesCount;
- InnerClassesInfo[] classes = innerClassesAttribute.classes;
-
- int newClassesCount = 0;
-
- // Copy over all non-retargeted attributes.
- for (int index = 0; index < classesCount; index++)
- {
- InnerClassesInfo classInfo = classes[index];
-
- // Check if the outer class or inner class is a retargeted class.
- retargeted = false;
- classInfo.outerClassConstantAccept(clazz, this);
- classInfo.innerClassConstantAccept(clazz, this);
- if (!retargeted)
- {
- classes[newClassesCount++] = classInfo;
- }
- }
-
- // Clean up any remaining array elements.
- Arrays.fill(classes, newClassesCount, classesCount, null);
-
- // Update the number of classes.
- innerClassesAttribute.u2classesCount = newClassesCount;
-
- // Remove the attribute altogether if it's empty.
- retargeted = newClassesCount == 0;
- }
+ // Check whether the referenced classes are retargeted.
+ innerClassesAttribute.innerClassEntriesAccept(clazz, this);
}
diff --git a/src/proguard/optimize/peephole/TargetClassChanger.java b/src/proguard/optimize/peephole/TargetClassChanger.java
index 5fa4fac..22fd83d 100644
--- a/src/proguard/optimize/peephole/TargetClassChanger.java
+++ b/src/proguard/optimize/peephole/TargetClassChanger.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
@@ -51,13 +51,13 @@ implements ClassVisitor,
AnnotationVisitor,
ElementValueVisitor
{
- private static final boolean DEBUG = false;
-
-
// Implementations for ClassVisitor.
public void visitProgramClass(ProgramClass programClass)
{
+ Clazz superClass = null;
+ Clazz[] interfaceClasses = null;
+
// Change the references of the constant pool.
programClass.constantPoolEntriesAccept(this);
@@ -80,39 +80,34 @@ implements ClassVisitor,
programClass.getName(),
programClass);
- // This class will loose all its interfaces.
- programClass.u2interfacesCount = 0;
-
// This class will loose all its subclasses.
programClass.subClasses = null;
}
- else
+
+ // Remove interface classes that are pointing to this class.
+ int newInterfacesCount = 0;
+ for (int index = 0; index < programClass.u2interfacesCount; index++)
{
- // Remove interface classes that are pointing to this class.
- int newInterfacesCount = 0;
- for (int index = 0; index < programClass.u2interfacesCount; index++)
+ Clazz interfaceClass = programClass.getInterface(index);
+ if (!programClass.equals(interfaceClass))
{
- Clazz interfaceClass = programClass.getInterface(index);
- if (!programClass.equals(interfaceClass))
- {
- programClass.u2interfaces[newInterfacesCount++] =
- programClass.u2interfaces[index];
- }
+ programClass.u2interfaces[newInterfacesCount++] =
+ programClass.u2interfaces[index];
}
- programClass.u2interfacesCount = newInterfacesCount;
+ }
+ programClass.u2interfacesCount = newInterfacesCount;
- // Update the subclasses of the superclass and interfaces of the
- // target class.
- ConstantVisitor subclassAdder =
- new ReferencedClassVisitor(
- new SubclassFilter(programClass,
- new SubclassAdder(programClass)));
+ // Update the subclasses of the superclass and interfaces of the
+ // target class.
+ ConstantVisitor subclassAdder =
+ new ReferencedClassVisitor(
+ new SubclassFilter(programClass,
+ new SubclassAdder(programClass)));
- programClass.superClassConstantAccept(subclassAdder);
- programClass.interfaceConstantsAccept(subclassAdder);
+ programClass.superClassConstantAccept(subclassAdder);
+ programClass.interfaceConstantsAccept(subclassAdder);
- // TODO: Maybe restore private method references.
- }
+ // TODO: Maybe restore private method references.
}
@@ -193,12 +188,6 @@ implements ClassVisitor,
Clazz newReferencedClass = updateReferencedClass(referencedClass);
if (referencedClass != newReferencedClass)
{
- if (DEBUG)
- {
- System.out.println("TargetClassChanger:");
- System.out.println(" ["+clazz.getName()+"] changing reference from ["+refConstant.referencedClass+"."+refConstant.referencedMember.getName(refConstant.referencedClass)+refConstant.referencedMember.getDescriptor(refConstant.referencedClass)+"]");
- }
-
// Change the referenced class.
refConstant.referencedClass = newReferencedClass;
@@ -208,11 +197,6 @@ implements ClassVisitor,
refConstant.getName(clazz),
refConstant.getType(clazz),
newReferencedClass);
-
- if (DEBUG)
- {
- System.out.println(" ["+clazz.getName()+"] to ["+refConstant.referencedClass+"."+refConstant.referencedMember.getName(refConstant.referencedClass)+refConstant.referencedMember.getDescriptor(refConstant.referencedClass)+"]");
- }
}
}
diff --git a/src/proguard/optimize/peephole/UnreachableCodeRemover.java b/src/proguard/optimize/peephole/UnreachableCodeRemover.java
index fcb8914..e8a99ab 100644
--- a/src/proguard/optimize/peephole/UnreachableCodeRemover.java
+++ b/src/proguard/optimize/peephole/UnreachableCodeRemover.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/optimize/peephole/UnreachableExceptionRemover.java b/src/proguard/optimize/peephole/UnreachableExceptionRemover.java
index f3ecf0b..048f5e3 100644
--- a/src/proguard/optimize/peephole/UnreachableExceptionRemover.java
+++ b/src/proguard/optimize/peephole/UnreachableExceptionRemover.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/optimize/peephole/VariableShrinker.java b/src/proguard/optimize/peephole/VariableShrinker.java
index 55f42ca..45b694f 100644
--- a/src/proguard/optimize/peephole/VariableShrinker.java
+++ b/src/proguard/optimize/peephole/VariableShrinker.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
diff --git a/src/proguard/optimize/peephole/VerticalClassMerger.java b/src/proguard/optimize/peephole/VerticalClassMerger.java
index 721f2a5..29ed6ff 100644
--- a/src/proguard/optimize/peephole/VerticalClassMerger.java
+++ b/src/proguard/optimize/peephole/VerticalClassMerger.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free