Peephole Contest 2008 COMP 520
Peephole Contest 2008
COMP 520
Final Ranking (Total)
37441
29542
29484
29360
28971
28367
27050
26911
0 10000 20000 30000 40000
Bytecodes
Submissions
Group Patterns submitted Unsound Remaining
1 88 0 88
2 70 8 62
3 41 5 36
4 36 4 32
5 90 1 89
Sound or unsound?
Constant folding
iconst_x
iconst_y
iadd || isub || imul || idiv || irem
--------->
ldc x op y
Sound or unsound?
StringBuffer
aload x
dup
ifnull label_1
goto label_2
label_1:
pop
ldc "null"
label_2:
------------------------>
new j/l/StringBuffer
dup
invokenonvirtual j/l/StringBuffer/<init>()V
aload x
invokevirtualj/l/StringBuffer/append(Lj/l/String;)Lj/l/StringBuffer;
invokevirtual j/l/StringBuffer/toString()Lj/l/String;
Sound or unsound?
StringBuffer
invokevirtualj/l/String/concat(Lj/l/String;)Lj/l/String;
dup
ifnonnull lbl1
pop
ldc "null"
label lbl1
--------->
invokevirtualj/l/String/concat(Lj/l/String;)Lj/l/String;
Sound or unsound?
Dead code elimination
goto lbl
not-a-label
--------->
goto lbl
[a|i]return
not-a-label
--------->
[a|i]return
Rules to keep in mind
• Ok to assume “sensible code”, i.e. verifyable code
• Should not assume certain code-generation scheme
• Why? Times change, and code generation schemes, too!
Results
Tatatataaaaa….
2004 Benchmarks
18837
15154
15107
15013
14920
14435
13882
13761
0 5000 10000 15000 20000
Bytecodes
2007 Benchmarks
10769
8138
8120
8113
7831
7763
7164
7152
0 2000 4000 6000 8000 10000 12000
Bytecodes
2008 Benchmarks
7835
6288
6257
6250
6234
6101
6016
5986
0 2000 4000 6000 8000 10000
Bytecodes
Most gain for the pain
103
118
127
221
265
0 100 200 300
Bytecodes removed / pattern
Final Ranking (Total)
37441
29542
29484
29360
28971
28367
27050
26911
0 10000 20000 30000 40000
Bytecodes
COMP 520 PRESENTS
Winners of the Peephole Contest
of the Year 2008
GROUP 5Ning Jia
Alexis Malozemoff
Wei WuNovember 21st, 2008
Eric Bodden & Reehan Shaikh