Mercurial > hg > icedrobot > daneel
changeset 115:b880d6db5210
Fix: SHR, SHL, USHR takes an int as second parameter and not a double.
author | forax |
---|---|
date | Mon, 04 Apr 2011 18:54:11 +0200 |
parents | 63f4cff176e1 |
children | 8ae57ade33c4 |
files | src/main/java/org/icedrobot/daneel/rewriter/DexRewriter.java |
diffstat | 1 files changed, 16 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/org/icedrobot/daneel/rewriter/DexRewriter.java Mon Apr 04 13:51:54 2011 +0200 +++ b/src/main/java/org/icedrobot/daneel/rewriter/DexRewriter.java Mon Apr 04 18:54:11 2011 +0200 @@ -751,39 +751,45 @@ opcode = Opcode.getOpcode(opcode.ordinal() + OP_2ADDR_SHIFT); } - int srcType, dstType; + int src1Type, src2Type, dstType; switch(opcode) { case CMPL_FLOAT: case CMPG_FLOAT: case ADD_FLOAT: case SUB_FLOAT: case MUL_FLOAT: case DIV_FLOAT: case REM_FLOAT: - srcType = FLOAT_TYPE; + src1Type = src2Type = FLOAT_TYPE; dstType = (opcode == Opcode.CMPL_FLOAT || opcode == Opcode.CMPG_FLOAT) ? INT_TYPE : FLOAT_TYPE; break; case CMPL_DOUBLE: case CMPG_DOUBLE: case ADD_DOUBLE: case SUB_DOUBLE: case MUL_DOUBLE: case DIV_DOUBLE: case REM_DOUBLE: - srcType = DOUBLE_TYPE; + src1Type = src2Type = DOUBLE_TYPE; dstType = (opcode == Opcode.CMPL_DOUBLE || opcode == Opcode.CMPG_DOUBLE) ? INT_TYPE : DOUBLE_TYPE; break; case CMP_LONG: case ADD_LONG: case SUB_LONG: case MUL_LONG: case DIV_LONG: case REM_LONG: case AND_LONG: case OR_LONG: - case XOR_LONG: case SHL_LONG: case SHR_LONG: case USHR_LONG: - srcType = LONG_TYPE; + case XOR_LONG: + src1Type = src2Type = LONG_TYPE; dstType = (opcode == Opcode.CMP_LONG) ? INT_TYPE : LONG_TYPE; break; + + case SHL_LONG: case SHR_LONG: case USHR_LONG: + src1Type = LONG_TYPE; + src2Type = INT_TYPE; + dstType = LONG_TYPE; + break; // ADD_INT, SUB_INT, MUL_INT, DIV_INT, REM_INT, // AND_INT, OR_INT, XOR_INT, SHL_INT, SHR_INT, USHR_INT, default: - srcType = dstType = INT_TYPE; + src1Type = src2Type = dstType = INT_TYPE; } - mv.visitVarInsn(Register.getJavaOpcode(srcType, ILOAD), vsrc1); - interpreter.load(vsrc1, srcType); - mv.visitVarInsn(Register.getJavaOpcode(srcType, ILOAD), vsrc2); - interpreter.load(vsrc2, srcType); + mv.visitVarInsn(Register.getJavaOpcode(src1Type, ILOAD), vsrc1); + interpreter.load(vsrc1, src1Type); + mv.visitVarInsn(Register.getJavaOpcode(src2Type, ILOAD), vsrc2); + interpreter.load(vsrc2, src2Type); mv.visitInsn(toJavaOpcode[opcode.ordinal()]); mv.visitVarInsn(Register.getJavaOpcode(dstType, ISTORE), vdest); interpreter.store(vdest, dstType);