diff options
author | aclement <aclement> | 2006-11-29 13:43:01 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-11-29 13:43:01 +0000 |
commit | f1520e89e3e9facafe708d390cf91cb43fc1bcb3 (patch) | |
tree | fc099e5972835e69f6aeb72e3fd5f0e650c9d848 /bcel-builder | |
parent | 145f2240e5706f4012cb1decf944023a12de48a8 (diff) | |
download | aspectj-f1520e89e3e9facafe708d390cf91cb43fc1bcb3.tar.gz aspectj-f1520e89e3e9facafe708d390cf91cb43fc1bcb3.zip |
test and fix for 166084: istore incorrectly optimizedRoot_verification
Diffstat (limited to 'bcel-builder')
-rw-r--r-- | bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableInstruction.java | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableInstruction.java b/bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableInstruction.java index 827eb45f1..128231cf2 100644 --- a/bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableInstruction.java +++ b/bcel-builder/src/org/aspectj/apache/bcel/generic/LocalVariableInstruction.java @@ -62,7 +62,7 @@ import org.aspectj.apache.bcel.util.ByteSequence; /** * Abstract super class for instructions dealing with local variables. * - * @version $Id: LocalVariableInstruction.java,v 1.4 2004/11/22 08:31:27 aclement Exp $ + * @version $Id: LocalVariableInstruction.java,v 1.5 2006/11/29 13:43:01 aclement Exp $ * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A> */ public abstract class LocalVariableInstruction extends Instruction @@ -151,21 +151,29 @@ public abstract class LocalVariableInstruction extends Instruction { if(wide) { n = bytes.readUnsignedShort(); - length = 4; } else if(((opcode >= Constants.ILOAD) && (opcode <= Constants.ALOAD)) || ((opcode >= Constants.ISTORE) && (opcode <= Constants.ASTORE))) { n = bytes.readUnsignedByte(); - length = 2; } else if(opcode <= Constants.ALOAD_3) { // compact load instruction such as ILOAD_2 n = (opcode - Constants.ILOAD_0) % 4; - length = 1; } else { // Assert ISTORE_0 <= tag <= ASTORE_3 n = (opcode - Constants.ISTORE_0) % 4; - length = 1; } + workOutLength(); } + + private void workOutLength() { + if(n >= 0 && n <= 3) { // Use more compact instruction xLOAD_n + opcode = (short)(c_tag + n); + length = 1; + } else { + opcode = canon_tag; + if(wide()) length = 4; + else length = 2; + } + } /** * @return local variable index referred by this instruction. @@ -180,18 +188,7 @@ public abstract class LocalVariableInstruction extends Instruction throw new ClassGenException("Illegal value: " + n); this.n = n; - - if(n >= 0 && n <= 3) { // Use more compact instruction xLOAD_n - opcode = (short)(c_tag + n); - length = 1; - } else { - opcode = canon_tag; - - if(wide()) // Need WIDE prefix ? - length = 4; - else - length = 2; - } + workOutLength(); } /** @return canonical tag for instruction, e.g., ALOAD for ALOAD_0 |