JEP 193: Enhanced Volatiles

Florian Weimer fweimer at redhat.com
Tue Mar 4 22:12:51 UTC 2014


On 03/04/2014 01:05 PM, Doug Lea wrote:
> On 03/04/2014 02:41 AM, Jeroen Frijters wrote:
>> Brian Goetz wrote:
>>> Embedded in this proposal is the desire to not provide a full-blown
>>> "lvalue" form for variables; supporting any form of pass-by-reference at
>>> the language level is a super-non-goal here.
>>
>> Why is this? It solves these problems in an extremely clean way and also
>> provides lots of other value (for example, for JEP 191: Foreign Function
>> Interface).
>>
>> I understand pass-by-reference is an expensive feature, but IMNSHO
>> poluting
>> Java with this proposal will prove to be more expensive in the long
>> run. It's
>> like erased generics all over again.
>>
>
> The expensive version of pass-by-reference is already supported
> using java.lang.reflect.Field.

And per the statistics posted in 
<http://mail.openjdk.java.net/pipermail/core-libs-dev/2014-March/025531.html>, 
the slightly faster pointer-to-field-member support is one of the 
prevalent use cases for sun.misc.Unsafe.  That's why I share Jeroen's 
puzzlement.

-- 
Florian Weimer / Red Hat Product Security Team



More information about the core-libs-dev mailing list