Re: Docs for allocation sinking optimization

  • From: Florian Weimer <fw@xxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 13 Jul 2012 21:39:54 +0200

* Mike Pall:

> Anyway, since reddit is discussing this now, I'm expecting a
> massive collaborative effort by Javaists (is that what you call
> them?) to improve the code. ;-)

Hotspot eliminates only one of the two allocations.  Your example is
deceptively simple and even uses a common coding pattern, but I'm not
sure if Hotspot can deal with it at all.  Loop optimizations are
disabled "if the loop has a scalar replaceable allocation", even if
the allocation is not eventually eliminated.  And without any sort of
loop-based analysis, it's difficult to see that the object does not
escape.  (After all, the final result actually escapes.)

I don't think it has to do with safepoints.  All backwards jumps have
a safepoint, and class definitions can change at a safepoint, but
there is code to perform the required deoptimization.

Other related posts: