[9] RFR of 8140630: java/nio/Buffer/Basic.java crashes vm on linux-x64 using latest devkit to build
Martin Buchholz
martinrb at google.com
Thu Nov 5 03:46:59 UTC 2015
OK, I looked a little closer.
We need to actually understand this crash, and create a small repro recipe.
It's not at all obvious what the purpose of those methods in Bits.java and
Bits.c is - they apparently always byte-swap, but that is very surprising
from their names, e.g. copyToIntArray. Give those methods some javadoc!
Maybe the crash comes from type punning int* and float* ? We shouldn't
suppress the crash unless we can prove it's actually a compiler bug. Why do
these methods take Object instead of e.g. int[] as parameters?
On Wed, Nov 4, 2015 at 2:12 PM, Martin Buchholz <martinrb at google.com> wrote:
> At Google, we've also noticed crashes in Bits.c with recent gcc.
> Adding nio-dev, since this is not really a build problem.
> It appears that Bits.c is resorting to undefined behavior, even though
> there is a long tradition of unaligned access on x86 being permitted by the
> hardware.
>
> My colleague Alexander Smundak has also been looking at this, and is
> trying to actually fix Bits.c.
>
> I've also been thinking about this a little. When compiling on x86 with
> gcc, we might want to use attribute(aligned(...)) to keep gcc from making
> unwarranted assumptions about alignment.
>
> I think Andrew Haley has also been thinking about efficient array/buffer
> operations?
>
> On Wed, Nov 4, 2015 at 12:56 PM, Brian Burkhalter <
> brian.burkhalter at oracle.com> wrote:
>
>> Please review at your convenience.
>>
>> Issue: https://bugs.openjdk.java.net/browse/JDK-8140630
>> Patch: Included below
>>
>> The change is to compile src/java.base/share/native/libjava/Bits.c only
>> into libjava.so with normal optimization level (-O2) instead of high
>> optimization level (-O3). The other objects in libjava are not affected.
>> This is for 64-bit Linux only. With this patch applied,
>> java/nio/Buffer/Basic.java now passes on all platforms and there is no
>> crash.
>>
>> Thanks,
>>
>> Brian
>>
>> --- a/make/lib/CoreLibraries.gmk
>> +++ b/make/lib/CoreLibraries.gmk
>> @@ -139,6 +139,12 @@
>> endif
>> endif
>>
>> +ifeq ($(OPENJDK_TARGET_OS), linux)
>> + ifeq ($(OPENJDK_TARGET_CPU), x86_64)
>> + BUILD_LIBJAVA_Bits.c_CFLAGS := $(C_O_FLAG_NORM)
>> + endif
>> +endif
>> +
>> $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
>> LIBRARY := java, \
>> OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20151104/cb2ed4cb/attachment.html>
More information about the nio-dev
mailing list