The debug segment (generated with -w or -d commandline options) has source file name and line number information.
When now parrot is run with the slow core and warnings are enabled, the location of the warnings is printed.


$ parrot -bw h.pasm #[1]
Use of uninitialized value in string context at h.pasm line 7.
Use of uninitialized value in string context at h.pasm line 10.

Question is: Should -w automatically select the slow core?
(This is currently the only core which tracks interpreter->cur_pc)

Further:
The C<setline> and C<setfile> opcodes are suboptimal, they impose runtime penalty on each run core, so they will go finally. The C<getline> and C<getfile> can map to the functionality used in warnings.c.


And finally: Parrot will (again[2]) track HLL source line info like:

#line 17 "sourcefile.p6"

So that warnings and errors can be located in HLL source too.

Have fun
leo

[1]
$ cat h.pasm
  new P1, .PerlHash
  # new P3, .PerlString
  # set P3, "yyy\n"
  # set P1["a"], P3
  set P0, P1["a"]
  print P0
  set P0, "xxx\n"
  set P2, P1["a"]
  print P2
  end

[2] IIRC was that one of my first patches to imcc.



Reply via email to