Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_39073359
jadx
提交
632a742e
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,发现更多精彩内容 >>
提交
632a742e
编写于
5月 04, 2014
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
core: fix method inline
上级
08c9d122
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
17 deletion
+21
-17
jadx-core/src/main/java/jadx/core/Jadx.java
jadx-core/src/main/java/jadx/core/Jadx.java
+1
-1
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
+14
-12
jadx-core/src/main/java/jadx/core/dex/nodes/InsnNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/InsnNode.java
+5
-4
jadx-core/src/main/java/jadx/core/dex/visitors/MethodInlineVisitor.java
...main/java/jadx/core/dex/visitors/MethodInlineVisitor.java
+1
-0
未找到文件。
jadx-core/src/main/java/jadx/core/Jadx.java
浏览文件 @
632a742e
...
...
@@ -13,13 +13,13 @@ import jadx.core.dex.visitors.IDexTreeVisitor;
import
jadx.core.dex.visitors.MethodInlineVisitor
;
import
jadx.core.dex.visitors.ModVisitor
;
import
jadx.core.dex.visitors.PrepareForCodeGen
;
import
jadx.core.dex.visitors.ssa.SSATransform
;
import
jadx.core.dex.visitors.SimplifyVisitor
;
import
jadx.core.dex.visitors.regions.CheckRegions
;
import
jadx.core.dex.visitors.regions.IfRegionVisitor
;
import
jadx.core.dex.visitors.regions.ProcessVariables
;
import
jadx.core.dex.visitors.regions.RegionMakerVisitor
;
import
jadx.core.dex.visitors.ssa.EliminatePhiNodes
;
import
jadx.core.dex.visitors.ssa.SSATransform
;
import
jadx.core.dex.visitors.typeinference.FinishTypeInference
;
import
jadx.core.dex.visitors.typeinference.TypeInference
;
import
jadx.core.utils.Utils
;
...
...
jadx-core/src/main/java/jadx/core/codegen/InsnGen.java
浏览文件 @
632a742e
...
...
@@ -3,7 +3,6 @@ package jadx.core.codegen;
import
jadx.core.dex.attributes.AttributeFlag
;
import
jadx.core.dex.attributes.AttributeType
;
import
jadx.core.dex.attributes.FieldReplaceAttr
;
import
jadx.core.dex.attributes.IAttribute
;
import
jadx.core.dex.attributes.MethodInlineAttr
;
import
jadx.core.dex.info.ClassInfo
;
import
jadx.core.dex.info.FieldInfo
;
...
...
@@ -583,9 +582,7 @@ public class InsnGen {
// inline method
MethodNode
callMthNode
=
mth
.
dex
().
resolveMethod
(
callMth
);
if
(
callMthNode
!=
null
&&
callMthNode
.
getAttributes
().
contains
(
AttributeType
.
METHOD_INLINE
))
{
inlineMethod
(
callMthNode
,
insn
,
code
);
if
(
callMthNode
!=
null
&&
inlineMethod
(
callMthNode
,
insn
,
code
))
{
return
;
}
...
...
@@ -662,9 +659,12 @@ public class InsnGen {
}
}
private
void
inlineMethod
(
MethodNode
callMthNode
,
InvokeNode
insn
,
CodeWriter
code
)
throws
CodegenException
{
IAttribute
mia
=
callMthNode
.
getAttributes
().
get
(
AttributeType
.
METHOD_INLINE
);
InsnNode
inl
=
((
MethodInlineAttr
)
mia
).
getInsn
();
private
boolean
inlineMethod
(
MethodNode
callMthNode
,
InvokeNode
insn
,
CodeWriter
code
)
throws
CodegenException
{
MethodInlineAttr
mia
=
(
MethodInlineAttr
)
callMthNode
.
getAttributes
().
get
(
AttributeType
.
METHOD_INLINE
);
if
(
mia
==
null
)
{
return
false
;
}
InsnNode
inl
=
mia
.
getInsn
();
if
(
callMthNode
.
getMethodInfo
().
getArgumentsTypes
().
isEmpty
())
{
makeInsn
(
inl
,
code
,
Flags
.
BODY_ONLY
);
}
else
{
...
...
@@ -681,12 +681,13 @@ public class InsnGen {
inl
.
getRegisterArgs
(
inlArgs
);
Map
<
RegisterArg
,
InsnArg
>
toRevert
=
new
HashMap
<
RegisterArg
,
InsnArg
>();
for
(
RegisterArg
r
:
inlArgs
)
{
if
(
r
.
getRegNum
()
>=
regs
.
length
)
{
LOG
.
warn
(
"Unknown register number {} in method call: {}, {}"
,
r
,
callMthNode
,
mth
);
int
regNum
=
r
.
getRegNum
();
if
(
regNum
>=
regs
.
length
)
{
LOG
.
warn
(
"Unknown register number {} in method call: {} from {}"
,
r
,
callMthNode
,
mth
);
}
else
{
InsnArg
repl
=
regs
[
r
.
getRegNum
()
];
InsnArg
repl
=
regs
[
r
egNum
];
if
(
repl
==
null
)
{
LOG
.
warn
(
"Not passed register {} in method call: {}
,
{}"
,
r
,
callMthNode
,
mth
);
LOG
.
warn
(
"Not passed register {} in method call: {}
from
{}"
,
r
,
callMthNode
,
mth
);
}
else
{
inl
.
replaceArg
(
r
,
repl
);
toRevert
.
put
(
r
,
repl
);
...
...
@@ -694,11 +695,12 @@ public class InsnGen {
}
}
makeInsn
(
inl
,
code
,
Flags
.
BODY_ONLY
);
// revert changes
// revert changes
in 'MethodInlineAttr'
for
(
Map
.
Entry
<
RegisterArg
,
InsnArg
>
e
:
toRevert
.
entrySet
())
{
inl
.
replaceArg
(
e
.
getValue
(),
e
.
getKey
());
}
}
return
true
;
}
private
void
makeTernary
(
TernaryInsn
insn
,
CodeWriter
code
,
EnumSet
<
Flags
>
state
)
throws
CodegenException
{
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/InsnNode.java
浏览文件 @
632a742e
...
...
@@ -81,15 +81,16 @@ public class InsnNode extends LineAttrNode {
arguments
.
set
(
n
,
arg
);
}
/**
* Replace instruction arg with another using recursive search.
* <br>
* <b>Caution:</b> this method don't change usage information for replaced argument.
*/
public
boolean
replaceArg
(
InsnArg
from
,
InsnArg
to
)
{
int
count
=
getArgsCount
();
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
InsnArg
arg
=
arguments
.
get
(
i
);
if
(
arg
==
from
)
{
if
(
arg
.
isRegister
())
{
RegisterArg
registerArg
=
(
RegisterArg
)
arg
;
registerArg
.
getSVar
().
removeUse
(
registerArg
);
}
setArg
(
i
,
to
);
return
true
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/MethodInlineVisitor.java
浏览文件 @
632a742e
...
...
@@ -36,6 +36,7 @@ public class MethodInlineVisitor extends AbstractVisitor {
BlockNode
block
=
mth
.
getBasicBlocks
().
get
(
1
);
InsnNode
insn
=
block
.
getInstructions
().
get
(
0
);
InsnNode
inl
=
new
InsnNode
(
InsnType
.
ARGS
,
1
);
// set arg from 'return' instruction
inl
.
addArg
(
insn
.
getArg
(
0
));
addInlineAttr
(
mth
,
inl
);
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录