Thanks for the report Chris! I'll file a bug so that we don't loose
track of this.
Cheers,
Edvard
On 05/22/2012 11:28 PM, Chris Dennis wrote:
Hi All,
I believe that when the Mac OS X support was merged in to the jdk7u-dev forest
that a mistake was made regarding Visual Studio's lack of inttypes.h. The
symptom of this bug can be seen in the following output:
$ java -showversion -d64 -XX:MaxDirectMemorySize=4g OffHeapAllocationTest
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)
Command Line: [-XX:MaxDirectMemorySize=4g]
sun.misc.VM.maxDirectMemory() = 0
java.nio.Bits.maxMemory = 0
Experimenting with different MaxDirectMemorySize values clearly shows this to
be a 32-bit wrap-around issue. When Mac OS X support was merged in, the
INTX_FORMAT which is used to write the MaxDirectMemorySize global in to the
system properties was modified to use PRIdPTR from inttypes.h. As Visual
Studio lacks inttypes.h, definitions for this (and the other associated format
specifiers) were added to globalDefinitions_visCPP.hpp. However the
definitions added are only correct for a 32-bit system. I believe the
following changeset corrects that error (no Windows access prevents me from
verifying this fix however).
If you need me to file a formal bug report for this then let me know.
Regards,
Chris Dennis
================================================================================
diff -r bca9e76ea254 src/share/vm/utilities/globalDefinitions_visCPP.hpp
--- a/src/share/vm/utilities/globalDefinitions_visCPP.hpp Tue Mar 20
10:17:41 2012 -0700
+++ b/src/share/vm/utilities/globalDefinitions_visCPP.hpp Tue May 22
17:24:57 2012 -0400
@@ -220,9 +220,15 @@
#define PRIu64 "I64u"
#define PRIx64 "I64x"
+#ifdef _LP64
+#define PRIdPTR "I64d"
+#define PRIuPTR "I64u"
+#define PRIxPTR "I64x"
+#else
#define PRIdPTR "d"
#define PRIuPTR "u"
#define PRIxPTR "x"
+#endif
#define offset_of(klass,field) offsetof(klass,field)