K Stol <[EMAIL PROTECTED]> wrote: > From: "Leopold Toetsch" <[EMAIL PROTECTED]> >> But with the constant Sub PMC in the packfile execution could start >> at "_main" then.
> I couldn't follow the constant Sub PMC thread (didn't understand, maybe a > WTHI subject?). The PIR assembler inside Parrot generates one entry per ".pcc_sub" in the constant packfile segment. As we have strings, numbers, and keys in the constant table, now there are PMCs too. A constant Sub PMC has label, sub entry offset, and end offset as information. When the constant table gets constructed at packfile load time, a Sub PMC is created and finally the offset converted to the absolute address, where the Sub happened to be loaded in memory. Also the name of the Sub (the label) is put into the interpreter's global stash with the Sub as value. find_global P1, "_sub" I0 = P1 is the same as I0 = addr "_sub" # set_addr for subroutines known at compile time. The former works for subroutines too, that got loaded later with the C<load_bytecode> opcode. > It sounds kinda odd to have an exception while exiting is quite a normal > action. It's just an op being executed with expected behaviour. Kinda weird > to call it an exception (or throw one for that matter). The C<exit> can happen deeply inside some called subs. The exception can be caught e.g. in main, to do some cleanup before really shutting down. Makes sense to me. leo