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
380ee75d
Commit
380ee75d
authored
Feb 07, 2015
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: fix constants replace for constructors and other instructions
parent
99d98140
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
18 deletions
+16
-18
ClassNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
+9
-7
ConstInlinerVisitor.java
...main/java/jadx/core/dex/visitors/ConstInlinerVisitor.java
+7
-1
ModVisitor.java
...core/src/main/java/jadx/core/dex/visitors/ModVisitor.java
+0
-10
No files found.
jadx-core/src/main/java/jadx/core/dex/nodes/ClassNode.java
View file @
380ee75d
...
...
@@ -297,19 +297,21 @@ public class ClassNode extends LineAttrNode implements ILoadable {
case
BOOLEAN:
return
getConstField
(
literal
==
1
,
false
);
case
CHAR:
return
getConstField
((
char
)
literal
,
Math
.
abs
(
literal
)
>
1
);
return
getConstField
((
char
)
literal
,
Math
.
abs
(
literal
)
>
1
0
);
case
BYTE:
return
getConstField
((
byte
)
literal
,
Math
.
abs
(
literal
)
>
1
);
return
getConstField
((
byte
)
literal
,
Math
.
abs
(
literal
)
>
1
0
);
case
SHORT:
return
getConstField
((
short
)
literal
,
Math
.
abs
(
literal
)
>
1
);
return
getConstField
((
short
)
literal
,
Math
.
abs
(
literal
)
>
1
00
);
case
INT:
return
getConstField
((
int
)
literal
,
Math
.
abs
(
literal
)
>
1
);
return
getConstField
((
int
)
literal
,
Math
.
abs
(
literal
)
>
1
00
);
case
LONG:
return
getConstField
(
literal
,
Math
.
abs
(
literal
)
>
1
);
return
getConstField
(
literal
,
Math
.
abs
(
literal
)
>
1
000
);
case
FLOAT:
return
getConstField
(
Float
.
intBitsToFloat
((
int
)
literal
),
true
);
float
f
=
Float
.
intBitsToFloat
((
int
)
literal
);
return
getConstField
(
f
,
f
!=
0.0
);
case
DOUBLE:
return
getConstField
(
Double
.
longBitsToDouble
(
literal
),
true
);
double
d
=
Double
.
longBitsToDouble
(
literal
);
return
getConstField
(
d
,
d
!=
0
);
}
return
null
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/ConstInlinerVisitor.java
View file @
380ee75d
...
...
@@ -12,6 +12,7 @@ import jadx.core.dex.instructions.args.LiteralArg;
import
jadx.core.dex.instructions.args.RegisterArg
;
import
jadx.core.dex.instructions.args.SSAVar
;
import
jadx.core.dex.nodes.BlockNode
;
import
jadx.core.dex.nodes.FieldNode
;
import
jadx.core.dex.nodes.InsnNode
;
import
jadx.core.dex.nodes.MethodNode
;
import
jadx.core.utils.InstructionRemover
;
...
...
@@ -103,7 +104,7 @@ public class ConstInlinerVisitor extends AbstractVisitor {
// continue;
// }
InsnNode
useInsn
=
arg
.
getParentInsn
();
if
(
useInsn
.
getType
()
==
InsnType
.
PHI
)
{
if
(
useInsn
==
null
||
useInsn
.
getType
()
==
InsnType
.
PHI
)
{
continue
;
}
LiteralArg
litArg
;
...
...
@@ -122,6 +123,11 @@ public class ConstInlinerVisitor extends AbstractVisitor {
if
(
useInsn
.
replaceArg
(
arg
,
litArg
))
{
fixTypes
(
mth
,
useInsn
,
litArg
);
replaceCount
++;
FieldNode
f
=
mth
.
getParentClass
().
getConstFieldByLiteralArg
(
litArg
);
if
(
f
!=
null
)
{
litArg
.
wrapInstruction
(
new
IndexInsnNode
(
InsnType
.
SGET
,
f
.
getFieldInfo
(),
0
));
}
}
}
return
replaceCount
==
use
.
size
();
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/ModVisitor.java
View file @
380ee75d
...
...
@@ -165,16 +165,6 @@ public class ModVisitor extends AbstractVisitor {
replaceInsn
(
block
,
insnNumber
,
replace
);
}
}
}
else
if
(
inv
.
getArgsCount
()
>
0
)
{
for
(
int
j
=
0
;
j
<
inv
.
getArgsCount
();
j
++)
{
InsnArg
arg
=
inv
.
getArg
(
j
);
if
(
arg
.
isLiteral
())
{
FieldNode
f
=
parentClass
.
getConstFieldByLiteralArg
((
LiteralArg
)
arg
);
if
(
f
!=
null
)
{
arg
.
wrapInstruction
(
new
IndexInsnNode
(
InsnType
.
SGET
,
f
.
getFieldInfo
(),
0
));
}
}
}
}
}
...
...
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