Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7172708

32/64 bit type issues on Windows after Mac OS X port

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 7u4
    • Fix Version/s: hs23.2
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Introduced In Build:
      b01
    • Introduced In Version:
    • Resolved In Build:
      b06
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        Reported by Chris Dennis on the jdk7u mailing list

        "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)."

        Reproducer

        public class TestMaxDirectMemory {

           public static void main(String[] args) {
        System.out.println(sun.misc.VM.maxDirectMemory());
           }
        }

        When run with -XX:MaxDirectMemorySize=4g on a 64bit Windows 1.7.0_04 VM it will print 0 since the high 32bits will get dropped.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  dholmes David Holmes
                  Reporter:
                  ewendeli Edvard Wendelin (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: