Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
2dbdd1f0
Commit
2dbdd1f0
authored
Jul 13, 2019
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: support instructions removing in SimplifyVisitor
parent
fc58022d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
14 deletions
+26
-14
SimplifyVisitor.java
...src/main/java/jadx/core/dex/visitors/SimplifyVisitor.java
+26
-14
No files found.
jadx-core/src/main/java/jadx/core/dex/visitors/SimplifyVisitor.java
View file @
2dbdd1f0
...
...
@@ -50,24 +50,36 @@ public class SimplifyVisitor extends AbstractVisitor {
return
;
}
for
(
BlockNode
block
:
mth
.
getBasicBlocks
())
{
List
<
InsnNode
>
list
=
block
.
getInstructions
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
InsnNode
modInsn
=
simplifyInsn
(
mth
,
list
.
get
(
i
));
if
(
modInsn
!=
null
)
{
if
(
i
!=
0
&&
modInsn
.
contains
(
AFlag
.
ARITH_ONEARG
))
{
InsnNode
mergedNode
=
simplifyOneArgConsecutive
(
list
.
get
(
i
-
1
),
list
.
get
(
i
),
(
ArithNode
)
modInsn
);
if
(
mergedNode
!=
null
)
{
list
.
remove
(
i
-
1
);
modInsn
=
mergedNode
;
i
--;
}
simplifyBlock
(
mth
,
block
);
}
}
private
static
void
simplifyBlock
(
MethodNode
mth
,
BlockNode
block
)
{
List
<
InsnNode
>
list
=
block
.
getInstructions
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
InsnNode
insn
=
list
.
get
(
i
);
int
insnCount
=
list
.
size
();
InsnNode
modInsn
=
simplifyInsn
(
mth
,
insn
);
if
(
modInsn
!=
null
)
{
if
(
i
!=
0
&&
modInsn
.
contains
(
AFlag
.
ARITH_ONEARG
))
{
InsnNode
mergedNode
=
simplifyOneArgConsecutive
(
list
.
get
(
i
-
1
),
list
.
get
(
i
),
(
ArithNode
)
modInsn
);
if
(
mergedNode
!=
null
)
{
list
.
remove
(
i
-
1
);
modInsn
=
mergedNode
;
i
--;
}
}
if
(
i
<
list
.
size
()
&&
list
.
get
(
i
)
==
insn
)
{
list
.
set
(
i
,
modInsn
);
}
}
if
(
list
.
size
()
<
insnCount
)
{
// some insns removed => restart block processing
simplifyBlock
(
mth
,
block
);
return
;
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment