Skip to content

[debug] code gen for WHILE loop unfriendly for debugging #1484

Closed
@liufengyun

Description

@liufengyun

Given the code:

    var a = 1 + 2

    while (a * 8 < 100) { // first jump to end
      a += 1
    }

The compilation generates following code, which has an unnecessary jump at the beginning:

       9: goto          37                                         <---- unnecessary jump
      12: iload_2
      13: bipush        8
      15: imul
      16: bipush        100
      18: if_icmplt     24
      21: goto          34
      24: iload_2
      25: iconst_1
      26: iadd
      27: istore_2
      28: goto          12
      31: nop
      32: nop
      33: athrow
      34: goto          40
      37: goto          12

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions