RFR (S): 8191681: Unsafe accesses should use field_offset_to_byte_offset()
Erik Österlund
erik.osterlund at oracle.com
Mon Nov 27 08:21:59 UTC 2017
Hi Andrew,
On 2017-11-24 18:44, Andrew Haley wrote:
> On 24/11/17 14:45, Erik Österlund wrote:
>> Before the Access API, there was a no-op conversion function in
>> unsafe.cpp for getting the byte offset of a field offset from unsafe as
>> a jlong. Now, the field offsets *are* byte offsets, so the conversion
>> did not do anything. But I guess it could be useful nevertheless for
>> abstraction purposes.
> This came up when I was working on Unsafe, and I think it's really a
> bit of nonsense. These days the byte offsets might even be absolute
> addresses, and the speculation that one day we might change our minds
> is rather pointless. I could find the discussion from that thread if
> you're interested.
>
Thank you for your feedback. I would not mind dropping these changes in
favour of simply assuming that Unsafe works with byte offsets only. My
Access API changes introduced that assumption in this file by dodging
the no-op conversion. Then I was asked to remove the assumption by
re-introducing code performing the no-op conversion of field offsets to
byte offsets. Personally I do not have a preference whether to perform
or not perform this no-op conversion.
Thanks,
/Erik
More information about the hotspot-runtime-dev
mailing list