Skip to content

Commit 0689289

Browse files
committed
Remove all unused bytes in one pass, instead of one by one.
This fixes long compilation times with a lot of dead code, for example when including bit data files that are not used.
1 parent 2d78095 commit 0689289

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/compiler/peephole.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1480,7 +1480,11 @@ class peephole
14801480
// Remove dead code after a RET or END
14811481
if((mtok(0, "TOK_RET") || mtok(0, "TOK_END")) && !mlabel(1))
14821482
{
1483-
del(1);
1483+
int last = 1;
1484+
while(current + last < code.size() && !mlabel(last))
1485+
last++;
1486+
while(--last >= 1)
1487+
del(last);
14841488
continue;
14851489
}
14861490
// Convert PRINT CHR$(X) to PUT X

0 commit comments

Comments
 (0)