Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colcode
jadx
提交
9132ef57
J
jadx
项目概览
colcode
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9132ef57
编写于
1月 25, 2018
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
core: use late deletion for NOP instruction (#215)
上级
d42bf2d4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
25 addition
and
21 deletion
+25
-21
jadx-core/src/main/java/jadx/core/dex/instructions/InsnDecoder.java
...src/main/java/jadx/core/dex/instructions/InsnDecoder.java
+2
-0
jadx-core/src/main/java/jadx/core/dex/visitors/blocksmaker/BlockSplitter.java
...ava/jadx/core/dex/visitors/blocksmaker/BlockSplitter.java
+23
-21
未找到文件。
jadx-core/src/main/java/jadx/core/dex/instructions/InsnDecoder.java
浏览文件 @
9132ef57
...
...
@@ -69,6 +69,8 @@ public class InsnDecoder {
private
InsnNode
decode
(
DecodedInstruction
insn
,
int
offset
)
throws
DecodeException
{
switch
(
insn
.
getOpcode
())
{
case
Opcodes
.
NOP
:
return
new
InsnNode
(
InsnType
.
NOP
,
0
);
case
Opcodes
.
PACKED_SWITCH_PAYLOAD
:
case
Opcodes
.
SPARSE_SWITCH_PAYLOAD
:
case
Opcodes
.
FILL_ARRAY_DATA_PAYLOAD
:
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/blocksmaker/BlockSplitter.java
浏览文件 @
9132ef57
package
jadx.core.dex.visitors.blocksmaker
;
import
java.util.EnumSet
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
jadx.core.dex.attributes.AFlag
;
import
jadx.core.dex.attributes.AType
;
import
jadx.core.dex.attributes.nodes.JumpInfo
;
...
...
@@ -14,13 +20,6 @@ import jadx.core.dex.trycatch.SplitterBlockAttr;
import
jadx.core.dex.visitors.AbstractVisitor
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
java.util.EnumSet
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
public
class
BlockSplitter
extends
AbstractVisitor
{
// leave these instructions alone in block node
...
...
@@ -43,6 +42,7 @@ public class BlockSplitter extends AbstractVisitor {
mth
.
initBasicBlocks
();
splitBasicBlocks
(
mth
);
removeInsns
(
mth
);
removeEmptyBlocks
(
mth
);
}
private
static
void
splitBasicBlocks
(
MethodNode
mth
)
{
...
...
@@ -197,14 +197,12 @@ public class BlockSplitter extends AbstractVisitor {
private
static
boolean
isDoWhile
(
Map
<
Integer
,
BlockNode
>
blocksMap
,
BlockNode
curBlock
,
InsnNode
insn
)
{
// split 'do-while' block (last instruction: 'if', target this block)
if
(
insn
.
getType
()
==
InsnType
.
IF
)
{
IfNode
ifs
=
(
IfNode
)
insn
;
BlockNode
targetBlock
=
blocksMap
.
get
(
ifs
.
getTarget
());
if
(
targetBlock
==
curBlock
)
{
return
true
;
}
if
(
insn
.
getType
()
!=
InsnType
.
IF
)
{
return
false
;
}
return
false
;
IfNode
ifs
=
(
IfNode
)
insn
;
BlockNode
targetBlock
=
blocksMap
.
get
(
ifs
.
getTarget
());
return
targetBlock
==
curBlock
;
}
private
static
BlockNode
getBlock
(
int
offset
,
Map
<
Integer
,
BlockNode
>
blocksMap
)
{
...
...
@@ -217,14 +215,18 @@ public class BlockSplitter extends AbstractVisitor {
private
static
void
removeInsns
(
MethodNode
mth
)
{
for
(
BlockNode
block
:
mth
.
getBasicBlocks
())
{
Iterator
<
InsnNode
>
it
=
block
.
getInstructions
().
iterator
();
while
(
it
.
hasNext
())
{
InsnType
insnType
=
it
.
next
().
getType
();
if
(
insnType
==
InsnType
.
GOTO
||
insnType
==
InsnType
.
NOP
)
{
it
.
remove
();
}
}
block
.
getInstructions
().
removeIf
(
insn
->
{
InsnType
insnType
=
insn
.
getType
();
return
insnType
==
InsnType
.
GOTO
||
insnType
==
InsnType
.
NOP
;
});
}
}
private
void
removeEmptyBlocks
(
MethodNode
mth
)
{
mth
.
getBasicBlocks
().
removeIf
(
block
->
block
.
getInstructions
().
isEmpty
()
&&
block
.
getPredecessors
().
isEmpty
()
&&
block
.
getSuccessors
().
isEmpty
()
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录