diff options
| author | Jesse Wilson <jessewilson@google.com> | 2011-02-14 19:01:34 -0800 |
|---|---|---|
| committer | Jesse Wilson <jessewilson@google.com> | 2011-02-15 11:07:31 -0800 |
| commit | 1bbb3378b108329c7ab75713fe9507b7ffc7f885 (patch) | |
| tree | bf39b3c451d159644ea1cdd74d2af23e8cce8232 /dx | |
| parent | 2c269f1a42962e245749fcf03366e1228cce6551 (diff) | |
| download | android_dalvik-1bbb3378b108329c7ab75713fe9507b7ffc7f885.tar.gz android_dalvik-1bbb3378b108329c7ab75713fe9507b7ffc7f885.tar.bz2 android_dalvik-1bbb3378b108329c7ab75713fe9507b7ffc7f885.zip | |
Fix some bugs in the new dx instruction code.
http://b/3447216
Change-Id: I9a77541b994f184da0e389840e5cac728ad6c072
Diffstat (limited to 'dx')
4 files changed, 11 insertions, 13 deletions
diff --git a/dx/src/com/android/dx/io/instructions/DecodedInstruction.java b/dx/src/com/android/dx/io/instructions/DecodedInstruction.java index c526f871c..e418a1c0b 100644 --- a/dx/src/com/android/dx/io/instructions/DecodedInstruction.java +++ b/dx/src/com/android/dx/io/instructions/DecodedInstruction.java @@ -202,7 +202,7 @@ public abstract class DecodedInstruction { * throw if the value is out of the range of a signed int. */ public final int getLiteralInt() { - if (literal != (int) target) { + if (literal != (int) literal) { throw new DexException("Literal out of range: " + Hex.u8(literal)); } @@ -214,7 +214,7 @@ public abstract class DecodedInstruction { * value is out of the range of a signed code unit. */ public final short getLiteralUnit() { - if (literal != (short) target) { + if (literal != (short) literal) { throw new DexException("Literal out of range: " + Hex.u8(literal)); } @@ -226,7 +226,7 @@ public abstract class DecodedInstruction { * throw if the value is out of the range of a signed byte. */ public final int getLiteralByte() { - if (literal != (byte) target) { + if (literal != (byte) literal) { throw new DexException("Literal out of range: " + Hex.u8(literal)); } diff --git a/dx/src/com/android/dx/io/instructions/InstructionCodec.java b/dx/src/com/android/dx/io/instructions/InstructionCodec.java index b178019a4..079038554 100644 --- a/dx/src/com/android/dx/io/instructions/InstructionCodec.java +++ b/dx/src/com/android/dx/io/instructions/InstructionCodec.java @@ -268,7 +268,7 @@ public enum InstructionCodec { @Override public void encode(DecodedInstruction insn, CodeOutput out) { out.write( codeUnit(insn.getOpcode(), insn.getA()), - insn.getLiteralUnit()); + insn.getIndexUnit()); } }, @@ -595,7 +595,7 @@ public enum InstructionCodec { } @Override public void encode(DecodedInstruction insn, CodeOutput out) { - int literal = insn.getLiteralInt(); + long literal = insn.getLiteral(); out.write( codeUnit(insn.getOpcode(), insn.getA()), unit0(literal), diff --git a/dx/src/com/android/dx/io/instructions/ShortArrayCodeInput.java b/dx/src/com/android/dx/io/instructions/ShortArrayCodeInput.java index bb5a4a041..03897c906 100644 --- a/dx/src/com/android/dx/io/instructions/ShortArrayCodeInput.java +++ b/dx/src/com/android/dx/io/instructions/ShortArrayCodeInput.java @@ -55,18 +55,18 @@ public final class ShortArrayCodeInput extends BaseCodeCursor /** @inheritDoc */ public int readInt() throws EOFException { - int short0 = read(); - int short1 = read(); + int short0 = read() & 0xffff; + int short1 = read() & 0xffff; return short0 | (short1 << 16); } /** @inheritDoc */ public long readLong() throws EOFException { - long short0 = read(); - long short1 = read(); - long short2 = read(); - long short3 = read(); + long short0 = read() & 0xffff; + long short1 = read() & 0xffff; + long short2 = read() & 0xffff; + long short3 = read() & 0xffff; return short0 | (short1 << 16) | (short2 << 32) | (short3 << 48); } diff --git a/dx/src/com/android/dx/merge/InstructionTransformer.java b/dx/src/com/android/dx/merge/InstructionTransformer.java index 339055bf7..62c3a49f3 100644 --- a/dx/src/com/android/dx/merge/InstructionTransformer.java +++ b/dx/src/com/android/dx/merge/InstructionTransformer.java @@ -17,7 +17,6 @@ package com.android.dx.merge; import com.android.dx.io.CodeReader; -import com.android.dx.io.OpcodeInfo; import com.android.dx.io.instructions.DecodedInstruction; import com.android.dx.io.instructions.ShortArrayCodeOutput; import com.android.dx.util.DexException; @@ -104,5 +103,4 @@ final class InstructionTransformer { throw new DexException("Cannot handle conversion to jumbo index!"); } } - } |
