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

hotspot/make/hotspot.script cannot handle command-line arguments with spaces

XMLWordPrintable

    • b94
    • generic
    • generic

      hotspot/make/hotspot.script allows you to run a stand-alone HotSpot build. Here's how:

      ================================
      First do a full JDK build and point to the JDK image with A_GOOD_JDK9_BUILD:

      $ ${A_GOOD_JDK9_BUILD}/bin/java -version
      java version "1.9.0-internal"
      Java(TM) SE Runtime Environment (build 1.9.0-internal-iklam_2015_10_01_18_19-b00)
      Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-internal-iklam_2015_10_01_18_19-b00, mixed mode)

      Then, do a HotSpot-only build:

      $ cd hotspot/make
      $ time make HOTSPOT_BUILD_VERSION=quickie ARCH_DATA_MODEL=64 DEBUG_BINARIES=true ZIP_DEBUGINFO_FILES=0 TEST_IN_BUILD=false STRIP_POLICY=no_strip ENABLE_FULL_DEBUG_SYMBOLS=0 HOTSPOT_BUILD_JOBS=$(expr $(cat /proc/cpuinfo | grep '^processor' | wc -l) - 1) debug

      real 1m7.898s
      ^^^^^^^^^^^^^^^^^^ look mom, this is quick! The full JDK build on the same host takes more than 5 minutes.

      $ alias myjava='env ALT_JAVA_HOME=${A_GOOD_JDK9_BUILD} bash ../build/linux/linux_amd64_compiler2/debug/hotspot'
      $ myjava -version
      java version "1.9.0-internal"
      Java(TM) SE Runtime Environment (build 1.9.0-internal-iklam_2015_10_01_18_19-b00)
      Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-debug-quickie, mixed mode)
      ================================

      The ../build/linux/linux_amd64_compiler2/debug/hotspot is a copy of hotspot/make/hotspot.script.

      This works for most cases, but hotspot.script doesn't quote the command-line correctly, so if you have a space in a command-line argument, it won't work:

      # correct behavior:
      $ ${A_GOOD_JDK9_BUILD}/bin/java "two words"
      Error: Could not find or load main class two words

      # incorrect behavior with hotspot.script:
      $ myjava "two words"
      Error: Could not find or load main class two

      The main problem with this is newer versions of JTREG (for modules, especially), always run the tests with a -D that contain spaces in it. So if we don't fix this bug, we can't easily use the stand-alone HotSpot build to run JTREG tests.

            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: