Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
asm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jamie Mansfield
asm
Commits
cd93d4c9
Commit
cd93d4c9
authored
Jun 14, 2018
by
Jason Zaugg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rationalize API for new unitialized values
parent
f50e2a1d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
46 deletions
+13
-46
asm-analysis/src/main/java/org/objectweb/asm/tree/analysis/Analyzer.java
...c/main/java/org/objectweb/asm/tree/analysis/Analyzer.java
+2
-2
asm-analysis/src/main/java/org/objectweb/asm/tree/analysis/Frame.java
.../src/main/java/org/objectweb/asm/tree/analysis/Frame.java
+2
-2
asm-analysis/src/main/java/org/objectweb/asm/tree/analysis/Interpreter.java
...ain/java/org/objectweb/asm/tree/analysis/Interpreter.java
+9
-42
No files found.
asm-analysis/src/main/java/org/objectweb/asm/tree/analysis/Analyzer.java
View file @
cd93d4c9
...
...
@@ -395,12 +395,12 @@ public class Analyzer<V extends Value> implements Opcodes {
interpreter
.
newParameterValue
(
isInstanceMethod
,
currentLocal
,
argumentTypes
[
i
]));
currentLocal
++;
if
(
argumentTypes
[
i
].
getSize
()
==
2
)
{
frame
.
setLocal
(
currentLocal
,
interpreter
.
newEmptyValue
AfterSize2Local
(
currentLocal
));
frame
.
setLocal
(
currentLocal
,
interpreter
.
newEmptyValue
(
currentLocal
));
currentLocal
++;
}
}
while
(
currentLocal
<
method
.
maxLocals
)
{
frame
.
setLocal
(
currentLocal
,
interpreter
.
newEmpty
NonParameterLocal
Value
(
currentLocal
));
frame
.
setLocal
(
currentLocal
,
interpreter
.
newEmptyValue
(
currentLocal
));
currentLocal
++;
}
frame
.
setReturn
(
interpreter
.
newReturnTypeValue
(
Type
.
getReturnType
(
method
.
desc
)));
...
...
asm-analysis/src/main/java/org/objectweb/asm/tree/analysis/Frame.java
View file @
cd93d4c9
...
...
@@ -264,12 +264,12 @@ public class Frame<V extends Value> {
var
=
((
VarInsnNode
)
insn
).
var
;
setLocal
(
var
,
value1
);
if
(
value1
.
getSize
()
==
2
)
{
setLocal
(
var
+
1
,
interpreter
.
newEmptyValue
AfterSize2Local
(
var
+
1
));
setLocal
(
var
+
1
,
interpreter
.
newEmptyValue
(
var
+
1
));
}
if
(
var
>
0
)
{
Value
local
=
getLocal
(
var
-
1
);
if
(
local
!=
null
&&
local
.
getSize
()
==
2
)
{
setLocal
(
var
-
1
,
interpreter
.
newEmptyValue
ForPreviousSize2Local
(
var
-
1
));
setLocal
(
var
-
1
,
interpreter
.
newEmptyValue
(
var
-
1
));
}
}
break
;
...
...
asm-analysis/src/main/java/org/objectweb/asm/tree/analysis/Interpreter.java
View file @
cd93d4c9
...
...
@@ -70,9 +70,7 @@ public abstract class Interpreter<V extends Value> {
*
* <p>An interpreter may choose to implement one or more of {@link
* Interpreter#newReturnTypeValue(Type)}, {@link Interpreter#newParameterValue(boolean, int,
* Type)}, {@link Interpreter#newEmptyNonParameterLocalValue(int)}, {@link
* Interpreter#newEmptyValueAfterSize2Local(int)}, {@link
* Interpreter#newEmptyValueForPreviousSize2Local(int)}, {@link
* Type)}, {@link Interpreter#newEmptyValue(int)}, {@link
* Interpreter#newExceptionValue(TryCatchBlockNode, Frame, Type)} to distinguish different types
* of new value.
*
...
...
@@ -130,50 +128,19 @@ public abstract class Interpreter<V extends Value> {
}
/**
* Called by the analyzer when initializing a non-parameter local in a frame. This method has to
* return a size-1 value representing an empty slot.
* Called by the analyzer when: a) initializing a non-parameter local in a frame, or b) resetting
* the subsequent slot of a new size-2 value, or c) resetting the a size-2 slot when its second
* half (the subsequent <tt>local</tt>) is assigned size-1 value.
*
* <p>By default, calls <code>newValue(null)</code>.
*
* @param local The index of the local in the frame.
* @return a value that represents the given type. The size of the returned value must be equal to
* the size of the given type.
* @since ASM 1.7
*/
public
V
newEmptyNonParameterLocalValue
(
int
local
)
{
return
newValue
(
null
);
}
/**
* Called by the analyzer and the interpreter. When initializing or setting the value of a size-2
* local, the value of the subsequent slot is reset using this method. This method has to return a
* size-1 value representing an empty slot.
* <p>This method has to return a size-1 value representing an empty slot.
*
* <p>By default, calls <code>newValue(null)</code>.
*
* @param local The index of the local in the frame.
* @return a value that represents the given type. The size of the returned value must be equal to
* the size of the given type.
* @return a value representing an uninitialized value of size-1
* @since ASM 1.7
*/
public
V
newEmptyValueAfterSize2Local
(
int
local
)
{
return
newValue
(
null
);
}
/**
* Called by the interpreter. When setting the value of a local variable, the interpreter checks
* whether the current value stored at the preceding index is of size-2. In this case, the
* preceding size-2 value is no longer valid and reset using this method. This method has to
* return a size-1 value representing an empty slot.
*
* <p>By default, calls <code>newValue(null)</code>.
*
* @param local The index of the local in the frame.
* @return a value that represents the given type. The size of the returned value must be equal to
* the size of the given type.
* @since ASM 1.7
*/
public
V
newEmptyValueForPreviousSize2Local
(
int
local
)
{
public
V
newEmptyValue
(
int
local
)
{
return
newValue
(
null
);
}
...
...
@@ -186,8 +153,8 @@ public abstract class Interpreter<V extends Value> {
* @param tryCatchBlockNode The exception handler
* @param handlerFrame The frame of the handler catching an exception from the current instruction
* @param exceptionType The excption type handled by this handler.
* @return a value that represents the given
type. The size of the returned value must be equal to
* the size of the given type.
* @return a value that represents the given
<tt>exceptionType</tt>. The size of the returned
*
value must be equal to
the size of the given type.
* @since ASM 1.7
*/
public
V
newExceptionValue
(
...
...
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