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
c3304874
Commit
c3304874
authored
May 04, 2018
by
Eric Bruneton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add failing test showing the issue.
parent
01a551c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
1 deletion
+28
-1
asm/src/test/java/org/objectweb/asm/ClassWriterComputeMaxsTest.java
...st/java/org/objectweb/asm/ClassWriterComputeMaxsTest.java
+28
-1
No files found.
asm/src/test/java/org/objectweb/asm/ClassWriterComputeMaxsTest.java
View file @
c3304874
...
@@ -56,8 +56,12 @@ public class ClassWriterComputeMaxsTest {
...
@@ -56,8 +56,12 @@ public class ClassWriterComputeMaxsTest {
@BeforeEach
@BeforeEach
public
void
setUp
()
throws
Exception
{
public
void
setUp
()
throws
Exception
{
init
(
Opcodes
.
V1_1
);
}
private
void
init
(
final
int
classVersion
)
{
classWriter
=
new
ClassWriter
(
ClassWriter
.
COMPUTE_MAXS
);
classWriter
=
new
ClassWriter
(
ClassWriter
.
COMPUTE_MAXS
);
classWriter
.
visit
(
Opcodes
.
V1_1
,
Opcodes
.
ACC_PUBLIC
,
"C"
,
null
,
"java/lang/Object"
,
null
);
classWriter
.
visit
(
classVersion
,
Opcodes
.
ACC_PUBLIC
,
"C"
,
null
,
"java/lang/Object"
,
null
);
methodVisitor
=
classWriter
.
visitMethod
(
Opcodes
.
ACC_PUBLIC
,
"<init>"
,
"()V"
,
null
,
null
);
methodVisitor
=
classWriter
.
visitMethod
(
Opcodes
.
ACC_PUBLIC
,
"<init>"
,
"()V"
,
null
,
null
);
methodVisitor
.
visitCode
();
methodVisitor
.
visitCode
();
methodVisitor
.
visitVarInsn
(
Opcodes
.
ALOAD
,
0
);
methodVisitor
.
visitVarInsn
(
Opcodes
.
ALOAD
,
0
);
...
@@ -1101,4 +1105,27 @@ public class ClassWriterComputeMaxsTest {
...
@@ -1101,4 +1105,27 @@ public class ClassWriterComputeMaxsTest {
assertMaxs
(
1
,
3
);
assertMaxs
(
1
,
3
);
assertGraph
(
"N0=N18"
,
"N3=N4"
,
"N4=N21"
,
"N6=N3,N4"
,
"N14="
,
"N18=N6"
,
"N21="
);
assertGraph
(
"N0=N18"
,
"N3=N4"
,
"N4=N21"
,
"N6=N3,N4"
,
"N14="
,
"N18=N6"
,
"N21="
);
}
}
/**
* Tests computing the maximum stack size from the existing stack map frames and the instructions
* in between, when dead code is present.
*/
@Test
public
void
testComputeMaxsFromFramesWithDeadCode
()
{
init
(
Opcodes
.
V1_7
);
Label
l0
=
new
Label
();
RETURN
();
// With the default compute maxs algorithm, this dead code block is not considered for the
// maximum stack size, which works fine for classes up to V1_6. Starting with V1_7, stack map
// frames are mandatory, even for dead code, and the maximum stack size must take dead code into
// account. Hopefully it can be computed from the stack map frames, and the instructions in
// between (without any control flow graph construction or algorithm).
LABEL
(
l0
);
methodVisitor
.
visitFrame
(
Opcodes
.
F_SAME
,
0
,
null
,
0
,
null
);
ACONST_NULL
();
RETURN
();
assertMaxs
(
1
,
1
);
}
}
}
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