=== compilers/imcc/imcc.l ================================================================== --- compilers/imcc/imcc.l (revision 290) +++ compilers/imcc/imcc.l (local) @@ -276,6 +276,7 @@ ":multi" return(MULTI); ":main" return(MAIN); ":load" return(LOAD); +":init" return(INIT); ":immediate" return(IMMEDIATE); ":postcomp" return(POSTCOMP); ":anon" return(ANON); === compilers/imcc/imcc.y ================================================================== --- compilers/imcc/imcc.y (revision 290) +++ compilers/imcc/imcc.y (local) @@ -412,7 +412,7 @@ %token COMMA ESUB DOTDOT %token PCC_BEGIN PCC_END PCC_CALL PCC_SUB PCC_BEGIN_RETURN PCC_END_RETURN %token PCC_BEGIN_YIELD PCC_END_YIELD NCI_CALL METH_CALL INVOCANT -%token MAIN LOAD IMMEDIATE POSTCOMP METHOD ANON OUTER NEED_LEX +%token MAIN LOAD INIT IMMEDIATE POSTCOMP METHOD ANON OUTER NEED_LEX %token MULTI LOADLIB %token UNIQUE_REG %token LABEL @@ -804,6 +804,7 @@ proto: LOAD { $$ = P_LOAD; } + | INIT { $$ = P_INIT; } | MAIN { $$ = P_MAIN; } | IMMEDIATE { $$ = P_IMMEDIATE; } | POSTCOMP { $$ = P_POSTCOMP; } === compilers/imcc/main.c ================================================================== --- compilers/imcc/main.c (revision 290) +++ compilers/imcc/main.c (local) @@ -473,6 +473,7 @@ case MAIN: printf(":main");break; case LOAD: printf(":load");break; + case INIT: printf(":init");break; case IMMEDIATE: printf(":immediate");break; case POSTCOMP: printf(":postcomp");break; case ANON: printf(":anon");break; === compilers/imcc/symreg.h ================================================================== --- compilers/imcc/symreg.h (revision 290) +++ compilers/imcc/symreg.h (local) @@ -143,6 +143,7 @@ P_ANON = SUB_FLAG_PF_ANON, /* 0x8 - private3 */ P_MAIN = SUB_FLAG_PF_MAIN, + P_INIT = SUB_FLAG_PF_INIT, P_LOAD = SUB_FLAG_PF_LOAD, P_IMMEDIATE = SUB_FLAG_PF_IMMEDIATE, P_POSTCOMP = SUB_FLAG_PF_POSTCOMP === ext/Parrot-Embed/Build.PL ================================================================== --- ext/Parrot-Embed/Build.PL (revision 290) +++ ext/Parrot-Embed/Build.PL (local) @@ -9,6 +9,8 @@ my ($cflags, $lflags) = get_compiler_flags( $in_parrot_tree ); my $parrot = get_parrot_path( $in_parrot_tree ); +print "in_parrot_tree: $in_parrot_tree clags: $cflags lflags: $lflags parrot: $parrot \n"; + my $class = Module::Build->subclass( code => <<"END_HERE", use Cwd; === include/parrot/packfile.h ================================================================== --- include/parrot/packfile.h (revision 290) +++ include/parrot/packfile.h (local) @@ -254,7 +254,8 @@ PBC_LOADED = 2, PBC_PBC = 4, PBC_IMMEDIATE = 8, - PBC_POSTCOMP = 16 + PBC_POSTCOMP = 16, + PBC_INIT = 32 } pbc_action_enum_t; PARROT_API void PackFile_fixup_subs(Interp *, pbc_action_enum_t, PMC *eval_pmc); === include/parrot/sub.h ================================================================== --- include/parrot/sub.h (revision 290) +++ include/parrot/sub.h (local) @@ -33,6 +33,7 @@ SUB_FLAG_PF_ANON = PObj_private3_FLAG, SUB_FLAG_PF_MAIN = PObj_private4_FLAG, SUB_FLAG_PF_LOAD = PObj_private5_FLAG, + SUB_FLAG_PF_INIT = PObj_private5_FLAG, SUB_FLAG_PF_IMMEDIATE = PObj_private6_FLAG, SUB_FLAG_PF_POSTCOMP = PObj_private7_FLAG, === src/packfile.c ================================================================== --- src/packfile.c (revision 290) +++ src/packfile.c (local) @@ -239,6 +239,8 @@ */ todo = 1; } + if (pragmas & SUB_FLAG_PF_INIT) /* symreg.h:P_INIT */ + todo = 1; break; case PBC_LOADED: if (pragmas & SUB_FLAG_PF_LOAD) /* symreg.h:P_LOAD */ @@ -359,6 +361,12 @@ ":main sub not allowed\n"); } } + /* run :init tagged functions */ + if (PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_INIT) { + PObj_get_FLAGS(sub_pmc) &= ~SUB_FLAG_PF_INIT; + run_sub(interpreter, sub_pmc); + } + break; } return NULL; } @@ -425,7 +433,7 @@ int action, PMC *eval_pmc)> B is one of -B, B, or B. Also store the C +B, B, B, or B. Also store the C in the sub structure, so that the eval PMC is kept alive be living subs. =cut @@ -3551,7 +3559,7 @@ /* =item C +PackFile_fixup_subs(Interp *interpreter, pbc_action_enum_t what, PMC *eval)> Run :load or :immediate subroutines for the current code segment. If C is given, set this is the owner of the subroutines.