Mercurial > hg > icedrobot > daneel
changeset 51:cb443a3d5b08
Enable all RETURN codes. Contiduted by R?mi Forax.
author | Mario Torre <neugens.limasoftware@gmail.com> |
---|---|
date | Sat, 19 Mar 2011 22:22:42 +0100 |
parents | e0cffd65b006 |
children | 0204d4b61cc4 |
files | src/main/java/org/icedrobot/daneel/dex/dexlib/DexLibDexReader.java src/main/java/org/icedrobot/daneel/rewriter/DexRewriter.java |
diffstat | 2 files changed, 24 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/org/icedrobot/daneel/dex/dexlib/DexLibDexReader.java Sat Mar 19 19:55:30 2011 +0100 +++ b/src/main/java/org/icedrobot/daneel/dex/dexlib/DexLibDexReader.java Sat Mar 19 22:22:42 2011 +0100 @@ -70,6 +70,7 @@ import org.jf.dexlib.Code.LiteralInstruction; import org.jf.dexlib.Code.RegisterRangeInstruction; import org.jf.dexlib.Code.SingleRegisterInstruction; +import org.jf.dexlib.Code.Format.Instruction11x; import org.jf.dexlib.Code.Format.Instruction21c; import org.jf.dexlib.Code.Format.Instruction22c; import org.jf.dexlib.EncodedValue.BooleanEncodedValue; @@ -416,6 +417,11 @@ break; } + case INSTR_OP: { + Instruction11x i11x = (Instruction11x) instr; + mv.visitInstrOp(opcode, i11x.getRegisterA()); + break; + } default: throw new AssertionError("unknown category for " + dexOpcode);
--- a/src/main/java/org/icedrobot/daneel/rewriter/DexRewriter.java Sat Mar 19 19:55:30 2011 +0100 +++ b/src/main/java/org/icedrobot/daneel/rewriter/DexRewriter.java Sat Mar 19 22:22:42 2011 +0100 @@ -410,6 +410,24 @@ }); } + @Override + public void visitInstrOp(Opcode opcode, int srcOrDst) { + srcOrDst = registerToSlot(srcOrDst); + switch (opcode) { + case RETURN: + case RETURN_WIDE: + case RETURN_OBJECT: { + int type = getReturnTypeFromMethodDescriptor(desc); + mv.visitVarInsn(Register.getJavaOpcode(type, ILOAD), srcOrDst); + interpreter.load(srcOrDst, type); + mv.visitInsn(Register.getJavaOpcode(type, IRETURN)); + return; + } + default: + } + throw new UnsupportedOperationException("NYI " + opcode); + } + // unimplemented @Override public void visitLabel(Label label) { @@ -489,30 +507,6 @@ } @Override - public void visitInstrOp(Opcode opcode, int srcOrDst) { - srcOrDst = registerToSlot(srcOrDst); - switch (opcode) { - case RETURN: - int type = getReturnTypeFromMethodDescriptor(desc); - mv.visitVarInsn(Register.getJavaOpcode(type, ILOAD), srcOrDst); - switch (type) { - case INT_TYPE: - mv.visitInsn(IRETURN); - break; - case FLOAT_TYPE: - mv.visitInsn(FRETURN); - break; - default: - throw new UnsupportedOperationException("NYI " + opcode - + " " + type); - } - interpreter.load(srcOrDst, type); - return; - } - throw new UnsupportedOperationException("NYI " + opcode); - } - - @Override public void visitInstrSwitch(Opcode opcode, int vsrc, Map<Integer, Label> labels) { vsrc = registerToSlot(vsrc);