Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_39073359
jadx
提交
6fbcf46a
J
jadx
项目概览
qq_39073359
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
6fbcf46a
编写于
6月 23, 2014
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
core: refactor return remover visitor
上级
a36bc8f2
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
23 deletion
+21
-23
jadx-core/src/main/java/jadx/core/dex/visitors/ConstInlinerVisitor.java
...main/java/jadx/core/dex/visitors/ConstInlinerVisitor.java
+1
-1
jadx-core/src/main/java/jadx/core/dex/visitors/regions/ReturnVisitor.java
...in/java/jadx/core/dex/visitors/regions/ReturnVisitor.java
+18
-20
jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/FinishTypeInference.java
.../core/dex/visitors/typeinference/FinishTypeInference.java
+1
-1
jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/PostTypeInference.java
...dx/core/dex/visitors/typeinference/PostTypeInference.java
+1
-1
未找到文件。
jadx-core/src/main/java/jadx/core/dex/visitors/ConstInlinerVisitor.java
浏览文件 @
6fbcf46a
...
...
@@ -80,7 +80,7 @@ public class ConstInlinerVisitor extends AbstractVisitor {
}
/**
* This is method similar to PostTypeInference.
visit
method,
* This is method similar to PostTypeInference.
process
method,
* but contains some expensive operations needed only after constant inline
*/
private
static
void
fixTypes
(
MethodNode
mth
,
InsnNode
insn
,
LiteralArg
litArg
)
{
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/regions/ReturnVisitor.java
浏览文件 @
6fbcf46a
...
...
@@ -12,13 +12,11 @@ import jadx.core.dex.regions.IfRegion;
import
jadx.core.dex.regions.LoopRegion
;
import
jadx.core.dex.regions.SwitchRegion
;
import
jadx.core.dex.visitors.AbstractVisitor
;
import
jadx.core.utils.RegionUtils
;
import
jadx.core.utils.exceptions.JadxException
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.ListIterator
;
import
java.util.Set
;
/**
* Remove unnecessary return instructions for void methods
...
...
@@ -85,7 +83,7 @@ public class ReturnVisitor extends AbstractVisitor {
IContainer
subBlock
=
itSubBlock
.
previous
();
if
(
subBlock
==
curContainer
)
{
break
;
}
else
if
(
not
Empty
(
subBlock
))
{
}
else
if
(
!
is
Empty
(
subBlock
))
{
return
false
;
}
}
...
...
@@ -95,25 +93,25 @@ public class ReturnVisitor extends AbstractVisitor {
return
true
;
}
private
static
boolean
notEmpty
(
IContainer
subBlock
)
{
if
(
subBlock
.
contains
(
AFlag
.
RETURN
))
{
return
false
;
}
int
insnCount
=
RegionUtils
.
insnsCount
(
subBlock
);
if
(
insnCount
>
1
)
{
return
true
;
}
if
(
insnCount
==
1
)
{
// don't count one 'return' instruction (it will be removed later)
Set
<
BlockNode
>
blocks
=
new
HashSet
<
BlockNode
>();
RegionUtils
.
getAllRegionBlocks
(
subBlock
,
blocks
);
for
(
BlockNode
node
:
blocks
)
{
if
(!
node
.
contains
(
AFlag
.
RETURN
)
&&
!
node
.
getInstructions
().
isEmpty
())
{
return
true
;
/**
* Check if container not contains instructions,
* don't count one 'return' instruction (it will be removed later).
*/
private
static
boolean
isEmpty
(
IContainer
container
)
{
if
(
container
instanceof
BlockNode
)
{
BlockNode
block
=
(
BlockNode
)
container
;
return
block
.
getInstructions
().
isEmpty
()
||
block
.
contains
(
AFlag
.
RETURN
);
}
else
if
(
container
instanceof
IRegion
)
{
IRegion
region
=
(
IRegion
)
container
;
for
(
IContainer
block
:
region
.
getSubBlocks
())
{
if
(!
isEmpty
(
block
))
{
return
false
;
}
}
return
true
;
}
else
{
throw
new
JadxRuntimeException
(
"Unknown container type: "
+
container
.
getClass
());
}
return
false
;
}
}
}
jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/FinishTypeInference.java
浏览文件 @
6fbcf46a
...
...
@@ -19,7 +19,7 @@ public class FinishTypeInference extends AbstractVisitor {
change
=
false
;
for
(
BlockNode
block
:
mth
.
getBasicBlocks
())
{
for
(
InsnNode
insn
:
block
.
getInstructions
())
{
if
(
PostTypeInference
.
visit
(
mth
,
insn
))
{
if
(
PostTypeInference
.
process
(
mth
,
insn
))
{
change
=
true
;
}
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/PostTypeInference.java
浏览文件 @
6fbcf46a
...
...
@@ -15,7 +15,7 @@ import java.util.List;
public
class
PostTypeInference
{
public
static
boolean
visit
(
MethodNode
mth
,
InsnNode
insn
)
{
public
static
boolean
process
(
MethodNode
mth
,
InsnNode
insn
)
{
switch
(
insn
.
getType
())
{
case
CONST:
RegisterArg
res
=
insn
.
getResult
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录