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

Terminal flags for loops are wrong

    XMLWordPrintable

Details

    • Bug
    • Resolution: Future Project
    • P4
    • tbd
    • 10
    • core-libs
    • None

    Description

      The controlFlowEscapes logic in Lower is wrong. it checks if ANY loop inside our loop has ANY break or continue and determines this is enough for control flow to escape.

      It should really check if the breaks break out of "this" loop and the continues continue _outside_ "this" loop.

      For example

      while(true)
         print(x);
         while(true)
           break;
         print(y)

      will get the outer loop tagged as non terminal, even though it isn't because it uses the break in the inner loop.

      similarly

      while(true)
        continue

      is really terminal, but counted as it isn't which generates NOP NOP ATHROW sequences. The continue goes to the loop header, which would conservatively tag it as non terminal if it weren't "true", but it is.
      This is not stricty "wrong", but the overly conservative logic creates dead code for the landing pad that is never gone to in CodeGEnerator

      Attachments

        Activity

          People

            attila Attila Szegedi
            lagergren Marcus Lagergren
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: