Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
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
6cb14a1c
Commit
6cb14a1c
authored
Aug 16, 2018
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: use flag for mark 'this' register
parent
ea9f933f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
37 deletions
+20
-37
AFlag.java
jadx-core/src/main/java/jadx/core/dex/attributes/AFlag.java
+1
-0
InsnArg.java
...rc/main/java/jadx/core/dex/instructions/args/InsnArg.java
+1
-1
RegisterArg.java
...ain/java/jadx/core/dex/instructions/args/RegisterArg.java
+2
-1
TypeImmutableArg.java
...ava/jadx/core/dex/instructions/args/TypeImmutableArg.java
+5
-33
MethodNode.java
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
+3
-2
SSATransform.java
...rc/main/java/jadx/core/dex/visitors/ssa/SSATransform.java
+8
-0
No files found.
jadx-core/src/main/java/jadx/core/dex/attributes/AFlag.java
View file @
6cb14a1c
...
...
@@ -26,6 +26,7 @@ public enum AFlag {
SKIP_ARG
,
// skip argument in invoke call
ANONYMOUS_CONSTRUCTOR
,
ANONYMOUS_CLASS
,
THIS
,
ELSE_IF_CHAIN
,
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/args/InsnArg.java
View file @
6cb14a1c
...
...
@@ -140,7 +140,7 @@ public abstract class InsnArg extends Typed {
}
public
boolean
isThis
()
{
// must be implemented in RegisterArg
and MthParameterArg
// must be implemented in RegisterArg
return
false
;
}
}
jadx-core/src/main/java/jadx/core/dex/instructions/args/RegisterArg.java
View file @
6cb14a1c
...
...
@@ -4,6 +4,7 @@ import java.util.Objects;
import
org.jetbrains.annotations.NotNull
;
import
jadx.core.dex.attributes.AFlag
;
import
jadx.core.dex.instructions.InsnType
;
import
jadx.core.dex.instructions.PhiInsn
;
import
jadx.core.dex.nodes.DexNode
;
...
...
@@ -118,7 +119,7 @@ public class RegisterArg extends InsnArg implements Named {
@Override
public
boolean
isThis
()
{
if
(
"this"
.
equals
(
getName
()
))
{
if
(
contains
(
AFlag
.
THIS
))
{
return
true
;
}
// maybe it was moved from 'this' register
...
...
jadx-core/src/main/java/jadx/core/dex/instructions/args/TypeImmutableArg.java
View file @
6cb14a1c
...
...
@@ -4,7 +4,7 @@ import org.jetbrains.annotations.NotNull;
public
class
TypeImmutableArg
extends
RegisterArg
{
p
rivate
boolean
isThis
;
p
ublic
static
final
String
THIS_ARG_NAME
=
"this"
;
public
TypeImmutableArg
(
int
rn
,
ArgType
type
)
{
super
(
rn
,
type
);
...
...
@@ -20,48 +20,20 @@ public class TypeImmutableArg extends RegisterArg {
// not allowed
}
public
void
markAsThis
()
{
this
.
isThis
=
true
;
}
@Override
public
boolean
isThis
()
{
return
isThis
;
}
@Override
public
String
getName
()
{
if
(
isThis
)
{
return
"this"
;
if
(
isThis
()
)
{
return
THIS_ARG_NAME
;
}
return
super
.
getName
();
}
@Override
void
setSVar
(
@NotNull
SSAVar
sVar
)
{
if
(
isThis
)
{
sVar
.
setName
(
"this"
);
if
(
isThis
()
)
{
sVar
.
setName
(
THIS_ARG_NAME
);
}
sVar
.
setTypeImmutable
(
type
);
super
.
setSVar
(
sVar
);
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
{
return
true
;
}
if
(!(
obj
instanceof
TypeImmutableArg
))
{
return
false
;
}
if
(!
super
.
equals
(
obj
))
{
return
false
;
}
return
isThis
==
((
TypeImmutableArg
)
obj
).
isThis
;
}
@Override
public
int
hashCode
()
{
return
31
*
super
.
hashCode
()
+
(
isThis
?
1
:
0
);
}
}
jadx-core/src/main/java/jadx/core/dex/nodes/MethodNode.java
View file @
6cb14a1c
...
...
@@ -193,11 +193,11 @@ public class MethodNode extends LineAttrNode implements ILoadable, IDexNode {
}
}
initArguments
(
argsTypes
);
return
true
;
}
catch
(
JadxRuntimeException
e
)
{
LOG
.
error
(
"Method signature parse error: {}"
,
this
,
e
);
return
false
;
}
return
true
;
}
private
void
initArguments
(
List
<
ArgType
>
args
)
{
...
...
@@ -214,7 +214,7 @@ public class MethodNode extends LineAttrNode implements ILoadable, IDexNode {
thisArg
=
null
;
}
else
{
TypeImmutableArg
arg
=
InsnArg
.
typeImmutableReg
(
pos
-
1
,
parentClass
.
getClassInfo
().
getType
());
arg
.
markAsThis
(
);
arg
.
add
(
AFlag
.
THIS
);
thisArg
=
arg
;
}
if
(
args
.
isEmpty
())
{
...
...
@@ -243,6 +243,7 @@ public class MethodNode extends LineAttrNode implements ILoadable, IDexNode {
return
argsList
.
remove
(
0
);
}
@Nullable
public
RegisterArg
getThisArg
()
{
return
thisArg
;
}
...
...
jadx-core/src/main/java/jadx/core/dex/visitors/ssa/SSATransform.java
View file @
6cb14a1c
...
...
@@ -53,6 +53,7 @@ public class SSATransform extends AbstractVisitor {
fixLastAssignInTry
(
mth
);
removeBlockerInsns
(
mth
);
markThisArg
(
mth
);
boolean
repeatFix
;
int
k
=
0
;
...
...
@@ -405,4 +406,11 @@ public class SSATransform extends AbstractVisitor {
InstructionRemover
.
unbindInsn
(
mth
,
phi
);
return
true
;
}
private
static
void
markThisArg
(
MethodNode
mth
)
{
RegisterArg
thisArg
=
mth
.
getThisArg
();
if
(
thisArg
!=
null
)
{
thisArg
.
getSVar
().
getUseList
().
forEach
(
arg
->
arg
.
add
(
AFlag
.
THIS
));
}
}
}
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