Menu

#14 Goto instruction optimization breaks Cascade and Clepsydra

open
None
5
2007-04-18
2007-04-18
No

The javac compiler eliminates the goto instruction in certain circumstances when it isn't necessary. In other cases, the jump target of the goto instruction is not in the expected place due to compiler optimizations. Neither Cascade nor Clepsydra account for these optimizations and produce the wrong output when they are present.

Discussion

  • Trevor Harmon

    Trevor Harmon - 2007-04-18

    Logged In: YES
    user_id=720008
    Originator: YES

    Here's a test case demonstrating the problem.

    if (val > 10)
    {
    if (val > 15)
    val += 43;
    else
    val += 89;
    }
    else
    {
    val += 9;
    }

     
  • Trevor Harmon

    Trevor Harmon - 2007-04-18

    Logged In: YES
    user_id=720008
    Originator: YES

    Here's another test case:

    if (val > 10)
    {
    if (val > 20)
    val += 30;
    else
    {
    if (val > 30)
    val += 35;
    else
    val += 36;
    }
    }
    else
    {
    val += 50;
    }

     
  • Trevor Harmon

    Trevor Harmon - 2007-04-18

    Logged In: YES
    user_id=720008
    Originator: YES

    Here's another test case:

    while (val > 10)
    {
    if (val > 20)
    val += 30;
    else
    val += 35;
    }

     

Log in to post a comment.