Escape analysis seems to be broken

Description

I was testing the correctness of static escape analysis in Jikes, and I think it is broken. This is what I did.

I added a phase after EscapeTransformations in HIROptimizations to instrument only thread-local accesses. My instrumentation phase first iterates over the IR and marks instructions that are thread-local (i.e., the register used is thread-local). It then adds instrumentation before those instructions. I add a metadata word to the object header. The metadata word for each allocated object is initialized with the allocating thread id. From within the instrumentation, I assert that the metadata word in the object header should always match the current thread excuting the instrumentation.

For a correct implementation, we expect the assertions to always pass if the object is not escaped. However, the assertions fail for a few microbenchmarks that I have created (and also with DaCapo benchmarks). For example, I have attached a microbenchmark called StaticWorkerThread. Jikes considers the putfield instruction (shown below) in method callee() as thread-local, i.e., the register l2sa is identified to be thread-local which is incorrect.

3 T putfield 39, l2sa(Lescape/StaticWorkerThread$MyObject;,x,d), Addr 0x00000004, <mem loc: Lescape/StaticWorkerThread$MyObject;.a>, t3sv(GUARD)

Environment

All

Status

Assignee

Erik Brangs

Reporter

Swarnendu Biswas

Labels

Components

Affects versions

Priority

Medium
Configure