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

[lworld] Incorrect generation of C1 unverified entry point

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: repo-valhalla
    • Fix Version/s: repo-valhalla
    • Component/s: hotspot
    • Labels:

      Description

      For methods that have a value-type receiver but no other value args, we use the same entry point for VVEP and VVEP_RO (for space and speed optimization).

      See
      http://hg.openjdk.java.net/valhalla/valhalla/file/e9393b1577db/src/hotspot/share/c1/c1_LIRAssembler.cpp#l662

      However, in this version of the VM, the UEP is incorrect. The UEP is invoked by C2 using virtual call convention (which does not unpack the receiver), but the method looks like this:

      UEP
        check_icache
      VEP:
        pack receiver
      UVEP:
        check_icache
      VVEP/VVEP_RO
        body

      So a call to the UEP will fall-through to the VEP, which expects the receiver to be unpacked.
       
      The fix is to change the entry-point layout to be the following:
            
      VEP:
        pack receiver
      UEP/UVEP:
        check_icache
      VVEP/VVEP_RO
        body

      See this for a full description of the entry points for C1-compiled methods (after this bug has been fixed):
      http://hg.openjdk.java.net/valhalla/valhalla/file/6822a6f27c5b/src/hotspot/share/c1/c1_LIRAssembler.cpp#l628

      ==============================


      The bug is manifest in the Ackermann0.ack_interface3 benchmark. The following two cases run fine:

      [C2 only]
      JAVA_TOOL_OPTIONS='-XX:-EnableValhallaC1' make test TEST=micro:valhalla.lworld.callconv.Ackermann0.ack_interface3

      [C1 only]
      JAVA_TOOL_OPTIONS='-XX:+EnableValhallaC1 -XX:TieredStopAtLevel=1' make test TEST=micro:valhalla.lworld.callconv.Ackermann0.ack_interface3

      But the following fails [C1 + C2 tiered compilation]

      $ JAVA_TOOL_OPTIONS='-XX:+EnableValhallaC1 -XX:TieredStopAtLevel=4' make test TEST=micro:valhalla.lworld.callconv.Ackermann0.ack_interface3
      Building targets 'test test' in configuration 'linux-x64'
      Test selection 'micro:valhalla.lworld.callconv.Ackermann0.ack_interface3', will run:
      * micro:valhalla.lworld.callconv.Ackermann0.ack_interface3

      Running test 'micro:valhalla.lworld.callconv.Ackermann0.ack_interface3'
      Picked up JAVA_TOOL_OPTIONS: -XX:+EnableValhallaC1 -XX:TieredStopAtLevel=4
      # JMH version: 1.21
      # VM version: JDK 14-lworldea, Java HotSpot(TM) 64-Bit Server VM, 14-lworldea+0-2019-08-27-2041257.iklam...
      # VM invoker: /jdk2/valhalla/build/linux-x64/images/jdk/bin/java
      # VM options: -XX:+EnableValhallaC1 -XX:TieredStopAtLevel=4 --add-opens=java.base/java.io=ALL-UNNAMED -Djava.library.path=/jdk2/valhalla/build/linux-x64/images/test/micro/native
      # Warmup: 5 iterations, 1 s each
      # Measurement: 5 iterations, 1 s each
      # Timeout: 10 min per iteration
      # Threads: 1 thread, will synchronize iterations
      # Benchmark mode: Average time, time/op
      # Benchmark: org.openjdk.bench.valhalla.lworld.callconv.Ackermann0.ack_interface3

      # Run progress: 0.00% complete, ETA 00:00:30
      # Fork: 1 of 3
      Picked up JAVA_TOOL_OPTIONS: -XX:+EnableValhallaC1 -XX:TieredStopAtLevel=4
      # Warmup Iteration 1: <failure>

      java.lang.StackOverflowError
              at org.openjdk.bench.valhalla.lworld.callconv.Ackermann0.ackermannInterface(Ackermann0.java:279)
              at org.openjdk.bench.valhalla.lworld.callconv.Ackermann0.ackermannInterface(Ackermann0.java:279)
              at org.openjdk.bench.valhalla.lworld.callconv.Ackermann0.ackermannInterface(Ackermann0.java:279)
              at org.openjdk.bench.valhalla.lworld.callconv.Ackermann0.ackermannInterface(Ackermann0.java:279)
              ......

        Attachments

          Activity

            People

            • Assignee:
              iklam Ioi Lam
              Reporter:
              iklam Ioi Lam
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: