Run optimizations before Escape Analysis?

Vladimir Kozlov Vladimir.Kozlov at Sun.COM
Wed Dec 3 07:34:48 PST 2008


Ed,

You can try to move EA code into Optimize() method after first
IterGVN.optimize() and remove nulling _congraph.

Also you need to use PhaseIterGVN igvn in EA code instead
of _compile->initial_gvn(). Add new field _igvn in
ConnectionGraph class and initialize it by passing igvn
to ConnectionGraph constructor.

See if it will give you more NoEscape allocations.

Vladimir

Edward Lee wrote:
> I've been trying to help EA find more NoEscape allocations because
> I've noticed it missing out on some cases that could be made available
> by simple optimizations. For example..
> 
> void foo(int a, int b)
>   Object newObj = new Object();
>   if (a != b)
>     staticField = newObj;
> 
> If a method bar() always calls foo() with both arguments as the same
> value, even if foo() is inlined into bar(), escape analysis won't
> realize the static field isn't set from bar().
> 
> It seems that initializing IterGVN before escape analysis and then
> running another instance of IterGVN from Optimize causes badness
> (issues relating to GVN hash table being an invalid address when
> creating oop_null for EA). I've coded a little pass that gets run
> right before escape analysis basically doing some of what
> IterGVN.optimize() would have done on IfNodes, and EA is able to say
> newObj doesn't escape. But this is quite hacky, and I'm basically
> reimplementing transform+subsume_node. (Using substitute_by ran into
> gvn hash lock issues.)
> 
> Is there a better way to run a stripped down IterGVN/CCP without
> having issues of running them twice?
> 
> Ed



More information about the hotspot-dev mailing list