[concurrency-interest] DirectByteBuffers and reachabilityFence

Andrew Haley aph at redhat.com
Wed Dec 9 13:40:33 EST 2015


On 12/09/2015 05:53 PM, Gil Tene wrote:

> My take on this would be to change the JLS and JVM spec to state
> that 'this' remains reachable until after the last instruction of
> every instance method. Period. This would basically equate to
> placing an implicit reachability fence at all exist points of every
> instance method (I.e. The equivalent of a try...finally). The "nice״
> thing about such an implicit reachability fence is that it does not
> really defeat any optimizations, as it only serves to extend the
> lifetime of an oop (so potentially pressing slightly harder on the
> register allocator). IMO this would auto-magically fix lots of
> current rarely occurring bugs (like those on DBB, but also in user
> code), and prevent many future ones.

Mmmm.  That's what I said!  One other advantage to doing this
automagically is that you won't get all these Java devs arguing about
whether the reachabilityFence really was needed.

Andrew.


More information about the Concurrency-interest mailing list