RFD: C2: Poor code quality for Unsafe
Paul Sandoz
paul.sandoz at oracle.com
Wed Jul 27 13:45:59 UTC 2016
> On 27 Jul 2016, at 15:36, Andrew Haley <aph at redhat.com> wrote:
>
> On 27/07/16 13:57, Paul Sandoz wrote:
>> What JDK build are you using? dev, hs, or hs-comp?
>
> hs-comp.
>
Only hs has the buggy fix for ByteBufferAs-X-Buffer to use Unsafe to read/write as wider primitives, so hs-comp will resort to reading/writing as bytes and composing/decomposing as view types via Bits.java.
>> Would it be possible to reevaluate with a fix for a bug i introduced switching ByteBufferAs-X-Buffer to use Unsafe?
>>
>> http://mail.openjdk.java.net/pipermail/hotspot-dev/2016-July/024007.html
>
> Sure. It doesn't seem to make any difference to the exact issue I'm
> addressing.
>
Thanks. Perhaps it will if Unsafe is used to read wider primitives?
> I'm kinda amazed that the ByteBufferTest didn't detect any of that. Oh
> well, I thought that it was so thorough. :-)
>
Same here, and i added views to the test. I found out that slicing/duplicating when the position is > 0 complicates how offsets are progpagated and there are subtle differences between heap and direct buffers in that regard.
Paul.
More information about the hotspot-dev
mailing list