Title: Intra Escape Analysis in Jikes RVM
1Intra Escape Analysis in Jikes RVM
- Keerti Lakshminarayan
- Michael Suwandi
2Motivation
- Costs of Object Management
- Removal of the synchronization constructs
- Connection Graphs, Choi et al
- Very precise. Beneficial in a static compiler.
- But in Jikes ?
- Jikes RVM has a simple escape analysis
- Fast (single-pass) and conservative.
3Escape States Equi-Escape Sets
- Different escape categories
- No Escape
- Method Escape
- Thread Escape
- Simpler analysis in SSA, but more to analyze
solution use Equi-Escape Sets
4Identifying Candidates (1/2)
- T q new T()
- T.field p or p T.field
- q.field p, or p q.field
- P q
- (T)p
- q.method(p)
- return p, or throw p
5Identifying Candidates (2/2)
class A public B b class B public int
x class Main public A test() A a
new A() a.b new B() for (int i 0 i
lt 2 i) B b a.b
println(b.x) a.b new B() a
new A() return a
new t1, A new t2, B putfield
t2, t1, (A.b) L0 phi t3, 0, t4 phi t5,
t2, t6 getfield t7, t5, (B.x) call
println, t7 new t6, B putfield t6,
t1, (A.b) addi t4, t3, 1 ifcmp t4, 2,
L0 new t8, A return t8
Global Escape
t8
t5
t1
t6
A.b
t2
No Escape
6Scalar Replacement (1/3)
- Scalar replace objects with No Escape state
only! - Replace the object with all of its instance
fields - Hunt down references using the reference maps and
replace them too
7Scalar Replacement (2/3)
refmove t11, ltnullgt new t2, B
refmove t12, t2 L0 phi t3, 0, t4 phi t5,
t2, t6 phi t14, t12, t15 getfield t7,
t5, (B.x) call println, t7 new t6, B
refmove t15, t6 addi t4, t3, 1
ifcmp t4, 2, L0 new t8, A return t8
refmove t10, ltnullgt new t2, B
refmove t10, t2 L0 phi t3, 0, t4 phi t5,
t2, t6 getfield t7, t5, (B.x) call
println, t7 new t6, B refmove t10,
t6 addi t4, t3, 1 ifcmp t4, 2, L0
new t8, A return t8
new t1, A new t2, B putfield
t2, t1, (A.b) L0 phi t3, 0, t4 phi t5,
t2, t6 getfield t7, t5, (B.x) call
println, t7 new t6, B putfield t6,
t1, (A.b) addi t4, t3, 1 ifcmp t4, 2,
L0 new t8, A return t8
Scalar replacement
Enter SSA
8Scalar Replacement (3/3)
refmove t11, ltnullgt new t2, B
refmove t12, t2 L0 phi t3, 0, t4 phi t5,
t2, t6 phi t14, t12, t15 getfield t7,
t5, (B.x) call println, t7 new t6, B
refmove t15, t6 addi t4, t3, 1
ifcmp t4, 2, L0 new t8, A return t8
refmove t11, ltnullgt move t16, 0
move t17, t16 L0 phi t3, 0, t4 phi t18,
t16, t19 phi t20, t17, t21 move t7,
t18 call println, t7 move t19, 0
move t21, t19 addi t4, t3, 1 ifcmp
t4, 2, L0 new t8, A return t8
Global Escape
Global Escape
2nd iteration
No Escape
9Evaluation and Future Work
- We are sorry we cannot thrill you with our graphs
and tables as yet! - First synthetic benchmarks. Later JavaG, JLex
- Measuring against Jikes RVM on how many
candidates found/replaced and how long it takes
to perform the analysis/transformation - Our goal is to show the usefulness (hopefully) of
the equi-escape sets in escape analysis for
dynamic compilers over the more precise (but more
time consuming) connection graph. - Interprocedual analysis remove synchronization
for thread local objects
10Learning from the ProjectAcknowledgements and
References
- Escape Analysis thankfully in Java
- Actual implementation requires tweaks
- Continued learning of the structure of the Jikes
RVM - Escape Analysis Thomas Kotzmann
- Connection Graphs Choi et al.
- Escape Analysis in the Jikes RVM Magill and
Spoonhower - Jungwoo, BK, and Prof. Mckinley