未验证 提交 a7173923 编写于 作者: S Skylot

fix: workaround to prevent incorrect order after `move` inline (#1472)

上级 a71b3a71
......@@ -61,7 +61,9 @@ public class MoveInlineVisitor extends AbstractVisitor {
}
SSAVar ssaVar = resultArg.getSVar();
if (ssaVar.isUsedInPhi()) {
return deleteMove(mth, move);
return false;
// TODO: review conditions of 'up' move inline (test TestMoveInline)
// return deleteMove(mth, move);
}
RegDebugInfoAttr debugInfo = moveArg.get(AType.REG_DEBUG_INFO);
for (RegisterArg useArg : ssaVar.getUseList()) {
......
package jadx.tests.integration.others;
import org.junit.jupiter.api.Test;
import jadx.tests.api.SmaliTest;
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat;
@SuppressWarnings("CommentedOutCode")
public class TestMoveInline extends SmaliTest {
// @formatter:off
/*
public final void Y(int i) throws k {
int i2 = 0;
while ((i & (-128)) != 0) {
this.h[i2] = (byte) ((i & 127) | 128);
i >>>= 7;
i2++;
}
byte[] bArr = this.h;
bArr[i2] = (byte) i;
this.a.k(bArr, 0, i2 + 1);
}
*/
// @formatter:on
@Test
public void test() {
getArgs().setRawCFGOutput(true);
assertThat(getClassNodeFromSmali())
.code()
// check operations order
.containsLines(3,
"i >>>= 7;",
"i2++;");
}
}
.class public Lothers/TestMoveInline;
.super Ljava/lang/Object;
.field private h:[B
.field private a:Lothers/TestMoveInline;
.method public k([BII)V
.registers 5
return-void
.end method
.method public test(I)V
.registers 7
const/4 v0, 0x0
move v1, v0
:goto_2
and-int/lit8 v2, p1, -0x80
if-nez v2, :cond_13
.line 1
iget-object v2, p0, Lothers/TestMoveInline;->h:[B
add-int/lit8 v3, v1, 0x1
int-to-byte p1, p1
aput-byte p1, v2, v1
.line 2
iget-object p1, p0, Lothers/TestMoveInline;->a:Lothers/TestMoveInline;
invoke-virtual {p1, v2, v0, v3}, Lothers/TestMoveInline;->k([BII)V
return-void
.line 3
:cond_13
iget-object v2, p0, Lothers/TestMoveInline;->h:[B
add-int/lit8 v3, v1, 0x1
and-int/lit8 v4, p1, 0x7f
or-int/lit16 v4, v4, 0x80
int-to-byte v4, v4
aput-byte v4, v2, v1
ushr-int/lit8 p1, p1, 0x7
move v1, v3
goto :goto_2
.end method
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册