RFR: JDK-8205549 JDK-8205698 Support of flattened values in Unsafe

Frederic Parain frederic.parain at oracle.com
Fri Jun 29 20:36:13 UTC 2018


I’d prefer asserts then just let the VM crash unpredictably.
But we’re speaking about Unsafe, do whatever you want
for getObject()/putObject().

However, put*() methods should (must?) enforce value types immutability
(this includes primitive fields too). I haven’t seen this in Mandy’s changeset
(but I might I missed it).

Fred
  

> On Jun 29, 2018, at 12:35, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> 
> 
> 
>> On Jun 29, 2018, at 7:14 AM, Frederic Parain <frederic.parain at oracle.com> wrote:
>> 
>> The legacy getObject()/putObject() would be maintained with value
>> types support just the time to allow a smooth transition.
>> 
> 
> IMHO i think these should be left as is. Various external (and of course unsupported!) usages of Unsafe do all sorts of crazy things and there is a risk those usages could be perturbed, either due to performance or because the new code infers something incorrectly.
> 
> I would like to suggest an alternative if this is a major concern. Modify the sun.misc.Unsafe implementation in the unsupported module and add asserts to the Java implementations to fail if it is detected value types are used. Then document the restrictions.
> 
> Paul.



More information about the valhalla-dev mailing list