On Feb 17, 2015, at 6:22 AM, Andrew Haley <a...@redhat.com> wrote:
> 
> Everything gets inlined nicely and the ByteBuffer is not created, but
> a store fence remains because of the final fields in HeapByteBuffer.

Wow, that got closer to the goal than I expected.  In general, the EA analysis 
can fail "at random" because of vagaries of inlining policy.

The remaining store fence is probably a bug.  A store fence for scalarized 
(lifted-out-of-memory) final fields should go away, since the fields are not 
actually stored in heap memory.

I filed JDK-8073358 to track.

BTW, we already elide synch. ops on scalarized (non-stored) objects.  Fence 
elision is a similar optimization.

— John

P.S.  Value types will come with scalarization "always-on", so even if a call 
goes out of line, the value's fields can be kept out of the heap.

One of the projected use cases of values is safe encapsulation for complex 
pointers (native or in-object).

Reply via email to