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

C2 produces wrong result while unswitching a loop due to lost control dependencies


    • Subcomponent:
    • Resolved In Build:
    • Verification:
      Fix failed



        The attached test produces a wrong result for C2 due to lost control dependencies for loop predicates while unswitching a loop after it was partially peeled.

        The C2 compiled code produces a wrong result for 'iFld' in the attached test case. It is -8 instead of -7. The loop in the test case is partially peeled and then unswitched. The wrong result is produced because a wrong state is transferred to the interpreter when an uncommon trap is hit in the C2 compiled code in the fast version of the unswitched loop.

        The problem is when unswitching the loop, we clone the original loop predicates for the slow and fast version of the loop but we do not account for partially peeled statements that are control dependent on the loop predicates (i.e. need to be executed after the predicates). As a result, these are executed before the cloned loop predicates.


          1. fixed_dependencies.png
            30 kB
            Christian Hagedorn
          2. FuzzerUtils.class
            8 kB
            Leonid Mesnik
          3. FuzzerUtils.java
            13 kB
            Leonid Mesnik
          4. FuzzerUtils$1.class
            0.8 kB
            Leonid Mesnik
          5. Test.class
            6 kB
            Leonid Mesnik
          6. Test.java
            9 kB
            Leonid Mesnik
          7. wrong_dependencies.png
            33 kB
            Christian Hagedorn

            Issue Links



                • Assignee:
                  chagedorn Christian Hagedorn
                  lmesnik Leonid Mesnik
                • Votes:
                  0 Vote for this issue
                  5 Start watching this issue


                  • Created: