RFR JDK-8141491: Unaligned memory access in Bits.c
aph at redhat.com
Wed Feb 3 16:15:44 UTC 2016
On 02/03/2016 04:13 PM, Mikael Vidstedt wrote:
> On 2016-02-03 01:43, Andrew Haley wrote:
>> On 02/02/16 19:25, Mikael Vidstedt wrote:
>>> Please review this change which introduces a Copy::conjoint_swap and an
>>> Unsafe.copySwapMemory method to call it from Java, along with the
>>> necessary changes to have java.nio.Bits call it instead of the Bits.c code.
>> There doesn't seem to be any way to use a byte-swap instruction
>> in the swapping code. This will make it unnecessarily slow.
> To be clear, this isn't trying to provide the absolutely most optimal
> copy+swap implementation. It's trying to fix the Bits.c unaligned bug
> and pave the way for further improvements. Further performance
> improvements here are certainly possible, but at this point I'm happy as
> long as the performance is on par (or better) with the Bits.c
> implementation it's replacing.
Got it, sure. It's just nice to be able to replace low-level routines
with platform ones.
> That said, at least gcc seems to recognize the byte swapping pattern and
> does emit a bswap on linux-x64. I'm not sure about the other platforms
Oh, very nice. Right, I'll check that once your patch does in.
More information about the core-libs-dev