We've got the need to have subs that get executed when a code segment is loaded, a need to have a 'main' sub that gets executed as mainline code, and subs that get executed after compilation but before run. So, since I *hate* magic name subs, what I want to do is add tags to subs to indicate what they should do. So, these tags are what I want, to be added to the .pcc_sub line:
MAIN IMMEDIATE LOAD POSTCOMP
and I also would like a way to tag a label out of band for the assembler:
.MAIN foo .IMMEDIATE bar .LOAD baz .POSTCOMP xyzzy
MAIN subs, of which there should be only one, is the sub that parrot executes when it's handed a bytecode file to run. If I do:
./parrot foo.pbc
then the sub tagged MAIN in foo.pbc should be the one considered the main subroutine. MAIN subs get argv passed in.
IMMEDIATE subs are executed, with no parameters, as soon as they're done compiling. They're definitely compile-time things, and odds are we won't have too many of them when writing assembly code, but they'll be reasonably common for HLLs we deal with.
POSTCOMP subs are executed as soon as compilation is done, once again with no parameters. Whether they do a whole lot is up in the air, but that's not my problem, and it'll be useful for compile-and-go systems.
LOAD subs are executed on bytecode load time. Once again, no parameters. Bytecode gets loaded, they get called.
All these subs have real names in addition to their particular properties (and they can have multiple properties) so should be in the bytecode file for normal execution. (So a sub could be marked as LOAD and POSTCOMP, and be callable by name)
I'm presuming throwing names and/or addresses into a metadata segment is the right way to go here, so that works for me.
--
Dan
--------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk