[concurrency-interest] Is Reference.reachabilityFence() needed in Reference constructor?

Alex Otenko oleksandr.otenko at gmail.com
Mon Oct 26 14:58:48 EDT 2015


That would be the case, if it can assume access is single-threaded.

Alex

> On 26 Oct 2015, at 11:56, Justin Sampson <jsampson at guidewire.com> wrote:
> 
> Alex Otenko wrote:
> 
>> Wouldn't it be possible to add a test that will always be false?
>> 
>> eg
>> [...]
>> if (get() != referent) {
>> [...]
>> 
>> The point being that referent would need to stay alive due to
>> Java semantics to align with get() and queue assignment.
> 
> Couldn't the compiler just inline get() as this.referent, see that
> this.referent was just set to referent, and simplify this.referent
> != referent to false?
> 
> Cheers,
> Justin



More information about the Concurrency-interest mailing list