I'm currently fixing #37590 and removed tons of code from imcc/pbc.c. The changes are causing a more strict error checking WRT label usage and a slight restriction WRT labels in PASM code:

.pcc_sub foo:
  ...
  branch foo

is now illegal. In practice there is probably always a get_params after the subroutine label, so that above example isn't really useful. Anyway inserting another label fixes it. The ".pcc_sub foo: " syntax isn't really defining a label anymore but a subroutine constant. We probably should drop the colon from it.

Changes in tests:

- test illegal bsr label
- fixed a couple of illegal bsrs or missing labels in parrot tests
- documented a couple of undefined labels in languages/tcl (r10169 as a distinct rev)

Not fixed because of TC (too complex - all PGE related) e.g.

$  rm EVAL_*
$ ./parrot -D20 t/compilers/tge/grammar_1.pir
e_pbc_emit: no label offset defined for 'R66_lit1'

$ grep R66_lit1 EVAL_*
EVAL_8:    if rep < 0 goto R66_lit1

obviously the destination label is missing. This could likely be a never taken branch, as the test succeeded when the label checking was off.

The changes inside pbc.c should also speed up code generation by some, as two iteration passes through the instructions where dropped.

I'll check it in after some more tests,
leo

Reply via email to