Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
keyescgm
jadx
提交
0ab933ef
J
jadx
项目概览
keyescgm
/
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,发现更多精彩内容 >>
未验证
提交
0ab933ef
编写于
11月 15, 2021
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
perf: cache 'implements' list (heavily used in type inference)
上级
4ee4a343
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
25 addition
and
27 deletion
+25
-27
jadx-core/build.gradle
jadx-core/build.gradle
+2
-0
jadx-core/src/main/java/jadx/core/clsp/ClspGraph.java
jadx-core/src/main/java/jadx/core/clsp/ClspGraph.java
+22
-22
jadx-core/src/main/java/jadx/core/dex/nodes/RootNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/RootNode.java
+1
-0
jadx-core/src/main/java/jadx/core/dex/visitors/OverrideMethodVisitor.java
...in/java/jadx/core/dex/visitors/OverrideMethodVisitor.java
+0
-5
未找到文件。
jadx-core/build.gradle
浏览文件 @
0ab933ef
...
...
@@ -19,6 +19,8 @@ dependencies {
testRuntimeOnly
(
project
(
':jadx-plugins:jadx-java-convert'
))
testRuntimeOnly
(
project
(
':jadx-plugins:jadx-java-input'
))
testRuntimeOnly
(
project
(
':jadx-plugins:jadx-raung-input'
))
testImplementation
(
'tools.profiler:async-profiler:1.8.3'
)
}
test
{
...
...
jadx-core/src/main/java/jadx/core/clsp/ClspGraph.java
浏览文件 @
0ab933ef
...
...
@@ -28,8 +28,9 @@ public class ClspGraph {
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ClspGraph
.
class
);
private
final
RootNode
root
;
private
Map
<
String
,
Set
<
String
>>
superTypesCache
;
private
Map
<
String
,
ClspClass
>
nameMap
;
private
Map
<
String
,
Set
<
String
>>
superTypesCache
;
private
Map
<
String
,
List
<
String
>>
implementsCache
;
private
final
Set
<
String
>
missingClasses
=
new
HashSet
<>();
...
...
@@ -61,6 +62,11 @@ public class ClspGraph {
}
}
public
void
initCache
()
{
fillSuperTypesCache
();
fillImplementsCache
();
}
public
boolean
isClsKnown
(
String
fullName
)
{
return
nameMap
.
containsKey
(
fullName
);
}
...
...
@@ -114,13 +120,20 @@ public class ClspGraph {
}
public
List
<
String
>
getImplementations
(
String
clsName
)
{
List
<
String
>
list
=
new
ArrayList
<>();
for
(
String
cls
:
nameMap
.
keySet
())
{
if
(
isImplements
(
cls
,
clsName
))
{
list
.
add
(
cls
);
List
<
String
>
list
=
implementsCache
.
get
(
clsName
);
return
list
==
null
?
Collections
.
emptyList
()
:
list
;
}
private
void
fillImplementsCache
()
{
Map
<
String
,
List
<
String
>>
map
=
new
HashMap
<>(
nameMap
.
size
());
List
<
String
>
classes
=
new
ArrayList
<>(
nameMap
.
keySet
());
Collections
.
sort
(
classes
);
for
(
String
cls
:
classes
)
{
for
(
String
st
:
getSuperTypes
(
cls
))
{
map
.
computeIfAbsent
(
st
,
v
->
new
ArrayList
<>()).
add
(
cls
);
}
}
return
list
;
implementsCache
=
map
;
}
public
String
getCommonAncestor
(
String
clsName
,
String
implClsName
)
{
...
...
@@ -157,24 +170,11 @@ public class ClspGraph {
}
public
Set
<
String
>
getSuperTypes
(
String
clsName
)
{
if
(
superTypesCache
!=
null
)
{
Set
<
String
>
result
=
superTypesCache
.
get
(
clsName
);
if
(
result
==
null
)
{
return
Collections
.
emptySet
();
}
return
result
;
}
ClspClass
cls
=
nameMap
.
get
(
clsName
);
if
(
cls
==
null
)
{
missingClasses
.
add
(
clsName
);
return
Collections
.
emptySet
();
}
Set
<
String
>
result
=
new
HashSet
<>();
addSuperTypes
(
cls
,
result
);
return
result
;
return
result
==
null
?
Collections
.
emptySet
()
:
result
;
}
p
ublic
synchronized
void
fillSuperTypesCache
()
{
p
rivate
void
fillSuperTypesCache
()
{
Map
<
String
,
Set
<
String
>>
map
=
new
HashMap
<>(
nameMap
.
size
());
Set
<
String
>
tmpSet
=
new
HashSet
<>();
for
(
Map
.
Entry
<
String
,
ClspClass
>
entry
:
nameMap
.
entrySet
())
{
...
...
jadx-core/src/main/java/jadx/core/dex/nodes/RootNode.java
浏览文件 @
0ab933ef
...
...
@@ -196,6 +196,7 @@ public class RootNode {
ClspGraph
newClsp
=
new
ClspGraph
(
this
);
newClsp
.
load
();
newClsp
.
addApp
(
classes
);
newClsp
.
initCache
();
this
.
clsp
=
newClsp
;
}
}
catch
(
Exception
e
)
{
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/OverrideMethodVisitor.java
浏览文件 @
0ab933ef
...
...
@@ -43,11 +43,6 @@ import jadx.core.utils.exceptions.JadxException;
)
public
class
OverrideMethodVisitor
extends
AbstractVisitor
{
@Override
public
void
init
(
RootNode
root
)
throws
JadxException
{
root
.
getClsp
().
fillSuperTypesCache
();
}
@Override
public
boolean
visit
(
ClassNode
cls
)
throws
JadxException
{
processCls
(
cls
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录