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

Add deoptimization points to AllocationMergesTests

XMLWordPrintable

      compiler/c2/irTests/AllocationMergesTests.java contains many IR tests to verify that allocation merges are correctly done during EA.
      But that is only done on an IR level.

      We've had a few issues in the past (e.g. JDK-8335977) where debug information was wrong and we failed to re-materialize scalar replaced objects correctly later when taking a deoptimization path. These bugs are really hard to find because we first need to deopt at the correct place where the info is wrong and then we also need to observe the wrong state.

      In Valhalla, we have this test:

      https://github.com/openjdk/valhalla/blob/8580a4eea6d533512b1e5d6e115c03fc0fcc773a/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestValueConstruction.java

      where we do the following trick to trigger deoptimizations at various places: We insert some If conditions that are first never taken. As a result, C2 just inserts uncommon traps because it was never observed that we take the paths. Later we make the If conditions true and thus we trigger a deoptimization.

      The idea of this RFE is to apply the same trick to AllocationMergesTests. I once started this work and then found JDK-8335977. I attached the patch from back there which can be used as a starting point. It is by no means complete or refactored but can be used as guidance. Note that IR matching should be disabled, for example with -DVerifyIR=false, due to triggering deoptimizations.

      The current patch is passing with current latest mainline.

            thartmann Tobias Hartmann
            chagedorn Christian Hagedorn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: