Skip to content

Commit 38e6e4a

Browse files
authored
Merge pull request #1813 from smowton/smowton/fix/cleanup-unused-clinits
Java frontend: clean up unused clinit symbols
2 parents 278e4e6 + 19d622b commit 38e6e4a

21 files changed

+134
-5
lines changed
Binary file not shown.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
public class Test {
2+
3+
// Refers to, but never instantiates or refers to static fields of, Unused.
4+
// Thus a clinit-wrapper for Unused should be created, but subsequently
5+
// discarded.
6+
Unused u;
7+
8+
public static void main() {
9+
10+
}
11+
12+
}
13+
14+
class Unused {
15+
16+
static int x;
17+
18+
static {
19+
x = 1;
20+
}
21+
22+
}
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
Test.class
3+
--show-goto-functions
4+
java::Unused::clinit_wrapper
5+
Unused\.<clinit>\(\)
6+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
Test.class
3+
--lazy-methods --show-goto-functions
4+
--
5+
java::Unused::clinit_wrapper
6+
Unused\.<clinit>\(\)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CORE
2+
Test.class
3+
--lazy-methods
4+
VERIFICATION SUCCESSFUL
5+
Binary file not shown.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
public class Test {
2+
3+
// Refers to, but never instantiates or refers to static fields of, Unused.
4+
// Thus a clinit-wrapper for Unused should be created, but subsequently
5+
// discarded.
6+
Unused1 u;
7+
8+
public static void main() {
9+
10+
}
11+
12+
}
13+
14+
class Unused1 extends Unused2 {
15+
16+
}
17+
18+
class Unused2 {
19+
20+
static int x;
21+
22+
static {
23+
x = 1;
24+
}
25+
26+
}
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)