diff options
author | aclement <aclement> | 2009-09-14 20:29:10 +0000 |
---|---|---|
committer | aclement <aclement> | 2009-09-14 20:29:10 +0000 |
commit | 600b4494987ac17c5bfa6e69172f9ec8be3801fe (patch) | |
tree | 3bf53456afd969b5c3312fcc259fc83256516de1 /bcel-builder/verifier-src | |
parent | 4da4379d79ef1dc70a4b5ba7595a07ce187b8f33 (diff) | |
download | aspectj-600b4494987ac17c5bfa6e69172f9ec8be3801fe.tar.gz aspectj-600b4494987ac17c5bfa6e69172f9ec8be3801fe.zip |
refactoring
Diffstat (limited to 'bcel-builder/verifier-src')
-rw-r--r-- | bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELFactory.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELFactory.java b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELFactory.java index 5aa954588..e24a4a665 100644 --- a/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELFactory.java +++ b/bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELFactory.java @@ -85,7 +85,7 @@ import org.aspectj.apache.bcel.verifier.InstructionWalker; * Factory creates il.append() statements, and sets instruction targets. A helper class for BCELifier. * * @see BCELifier - * @version $Id: BCELFactory.java,v 1.5 2009/09/09 19:56:20 aclement Exp $ + * @version $Id: BCELFactory.java,v 1.6 2009/09/14 20:29:10 aclement Exp $ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> */ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor { @@ -99,7 +99,8 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor { _out = out; } - private final HashMap<Instruction, InstructionHandle> branch_map = new HashMap<Instruction, InstructionHandle>(); // Map<Instruction, InstructionHandle> + private final HashMap<Instruction, InstructionHandle> branch_map = new HashMap<Instruction, InstructionHandle>(); // Map<Instruction, + // InstructionHandle> public void start() { if (!_mg.isAbstract() && !_mg.isNative()) { @@ -134,7 +135,7 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor { short opcode = i.getOpcode(); if (InstructionConstants.INSTRUCTIONS[opcode] != null && !i.isConstantInstruction() && !i.isReturnInstruction()) { // Handled - // below + // below _out.println("il.append(InstructionConstants." + i.getName().toUpperCase() + ");"); return true; } @@ -154,6 +155,7 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor { } } + @Override public void visitArrayInstruction(Instruction i) { short opcode = i.getOpcode(); Type type = i.getType(_cp); @@ -173,6 +175,7 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor { + BCELifier.printType(type) + ", " + "Constants." + Constants.OPCODE_NAMES[opcode].toUpperCase() + "));"); } + @Override public void visitInvokeInstruction(InvokeInstruction i) { short opcode = i.getOpcode(); String class_name = i.getClassName(_cp); @@ -185,6 +188,7 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor { + Constants.OPCODE_NAMES[opcode].toUpperCase() + "));"); } + @Override public void visitAllocationInstruction(Instruction i) { Type type; @@ -204,7 +208,6 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor { case Constants.MULTIANEWARRAY: dim = ((MULTIANEWARRAY) i).getDimensions(); - case Constants.ANEWARRAY: case Constants.NEWARRAY: _out.println("il.append(_factory.createNewArray(" + BCELifier.printType(type) + ", (short) " + dim + "));"); @@ -227,30 +230,36 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor { _out.println("il.append(new PUSH(_cp, " + embed + "));"); } + @Override public void visitLDC(Instruction i) { createConstant(i.getValue(_cp)); } + @Override public void visitLDC2_W(Instruction i) { createConstant(i.getValue(_cp)); } + @Override public void visitConstantPushInstruction(Instruction i) { createConstant(i.getValue()); } + @Override public void visitINSTANCEOF(Instruction i) { Type type = i.getType(_cp); _out.println("il.append(new INSTANCEOF(_cp.addClass(" + BCELifier.printType(type) + ")));"); } + @Override public void visitCHECKCAST(Instruction i) { Type type = i.getType(_cp); _out.println("il.append(_factory.createCheckCast(" + BCELifier.printType(type) + "));"); } + @Override public void visitReturnInstruction(Instruction i) { Type type = i.getType(_cp); @@ -260,6 +269,7 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor { // Memorize BranchInstructions that need an update private final ArrayList<InstructionBranch> branches = new ArrayList<InstructionBranch>(); + @Override public void visitBranchInstruction(InstructionBranch bi) { BranchHandle bh = (BranchHandle) branch_map.get(bi); int pos = bh.getPosition(); @@ -315,6 +325,7 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor { } } + @Override public void visitRET(RET i) { _out.println("il.append(new RET(" + i.getIndex() + ")));"); } |