From: Dave Mitchell Date: Sat, 5 May 2007 00:49:51 +0000 (+0000) Subject: migrate more variables to PL_parser struct: X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fb205e7a8791bda7ee1f6f939d96b947f4eb160c;p=p5sagit%2Fp5-mst-13.2.git migrate more variables to PL_parser struct: PL_nexttoke PL_curforce PL_nextval PL_nexttype p4raw-id: //depot/perl@31148 --- diff --git a/embedvar.h b/embedvar.h index c458948..2218a38 100644 --- a/embedvar.h +++ b/embedvar.h @@ -173,7 +173,6 @@ #define PL_cshlen (vTHX->Icshlen) #define PL_cshname (vTHX->Icshname) #define PL_curcopdb (vTHX->Icurcopdb) -#define PL_curforce (vTHX->Icurforce) #define PL_curstname (vTHX->Icurstname) #define PL_custom_op_descs (vTHX->Icustom_op_descs) #define PL_custom_op_names (vTHX->Icustom_op_names) @@ -260,9 +259,6 @@ #define PL_my_cxt_keys (vTHX->Imy_cxt_keys) #define PL_my_cxt_list (vTHX->Imy_cxt_list) #define PL_my_cxt_size (vTHX->Imy_cxt_size) -#define PL_nexttoke (vTHX->Inexttoke) -#define PL_nexttype (vTHX->Inexttype) -#define PL_nextval (vTHX->Inextval) #define PL_nice_chunk (vTHX->Inice_chunk) #define PL_nice_chunk_size (vTHX->Inice_chunk_size) #define PL_nomemok (vTHX->Inomemok) @@ -428,7 +424,6 @@ #define PL_Icshlen PL_cshlen #define PL_Icshname PL_cshname #define PL_Icurcopdb PL_curcopdb -#define PL_Icurforce PL_curforce #define PL_Icurstname PL_curstname #define PL_Icustom_op_descs PL_custom_op_descs #define PL_Icustom_op_names PL_custom_op_names @@ -515,9 +510,6 @@ #define PL_Imy_cxt_keys PL_my_cxt_keys #define PL_Imy_cxt_list PL_my_cxt_list #define PL_Imy_cxt_size PL_my_cxt_size -#define PL_Inexttoke PL_nexttoke -#define PL_Inexttype PL_nexttype -#define PL_Inextval PL_nextval #define PL_Inice_chunk PL_nice_chunk #define PL_Inice_chunk_size PL_nice_chunk_size #define PL_Inomemok PL_nomemok diff --git a/intrpvar.h b/intrpvar.h index 5799966..b2749d1 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -285,16 +285,6 @@ PERLVAR(Isv_undef, SV) PERLVAR(Isv_no, SV) PERLVAR(Isv_yes, SV) -/* What we know when we're in LEX_KNOWNEXT state. */ -#ifdef PERL_MAD -PERLVARA(Inexttoke,5, NEXTTOKE) /* value of next token, if any */ -PERLVAR(Icurforce, I32) -#else -PERLVARA(Inextval,5, YYSTYPE) /* value of next token, if any */ -PERLVARA(Inexttype,5, I32) /* type of next token */ -PERLVAR(Inexttoke, I32) -#endif - PERLVAR(Ilex_state, U8) /* next token is determined */ PERLVAR(Ierror_count, U8) /* how many errors so far, max 10 */ PERLVARI(Icv_has_eval, bool, FALSE) /* PL_compcv includes an entereval or similar */ diff --git a/parser.h b/parser.h index 2dfcfa7..b9f4dda 100644 --- a/parser.h +++ b/parser.h @@ -83,7 +83,16 @@ typedef struct yy_parser { SV *thisstuff; SV *thistoken; SV *thiswhite; + +/* What we know when we're in LEX_KNOWNEXT state. */ + NEXTTOKE nexttoke[5]; /* value of next token, if any */ + I32 curforce; +#else + YYSTYPE nextval[5]; /* value of next token, if any */ + I32 nexttype[5]; /* type of next token */ + I32 nexttoke; #endif + } yy_parser; diff --git a/perlapi.h b/perlapi.h index 0106cdd..b4096cf 100644 --- a/perlapi.h +++ b/perlapi.h @@ -222,8 +222,6 @@ END_EXTERN_C #define PL_cshname (*Perl_Icshname_ptr(aTHX)) #undef PL_curcopdb #define PL_curcopdb (*Perl_Icurcopdb_ptr(aTHX)) -#undef PL_curforce -#define PL_curforce (*Perl_Icurforce_ptr(aTHX)) #undef PL_curstname #define PL_curstname (*Perl_Icurstname_ptr(aTHX)) #undef PL_custom_op_descs @@ -396,12 +394,6 @@ END_EXTERN_C #define PL_my_cxt_list (*Perl_Imy_cxt_list_ptr(aTHX)) #undef PL_my_cxt_size #define PL_my_cxt_size (*Perl_Imy_cxt_size_ptr(aTHX)) -#undef PL_nexttoke -#define PL_nexttoke (*Perl_Inexttoke_ptr(aTHX)) -#undef PL_nexttype -#define PL_nexttype (*Perl_Inexttype_ptr(aTHX)) -#undef PL_nextval -#define PL_nextval (*Perl_Inextval_ptr(aTHX)) #undef PL_nice_chunk #define PL_nice_chunk (*Perl_Inice_chunk_ptr(aTHX)) #undef PL_nice_chunk_size diff --git a/sv.c b/sv.c index f05f4cd..276b8c7 100644 --- a/sv.c +++ b/sv.c @@ -9611,6 +9611,13 @@ Perl_parser_dup(pTHX_ const yy_parser *proto, CLONE_PARAMS* param) parser->thisstuff = proto->thisstuff; parser->thistoken = proto->thistoken; parser->thiswhite = proto->thiswhite; + + Copy(proto->nexttoke, parser->nexttoke, 5, NEXTTOKE); + parser->curforce = proto->curforce; +#else + Copy(proto->nextval, parser->nextval, 5, YYSTYPE); + Copy(proto->nexttype, parser->nexttype, 5, I32); + parser->nexttoke = proto->nexttoke; #endif return parser; } @@ -11252,15 +11259,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags, PL_lex_state = proto_perl->Ilex_state; -#ifdef PERL_MAD - Copy(proto_perl->Inexttoke, PL_nexttoke, 5, NEXTTOKE); - PL_curforce = proto_perl->Icurforce; -#else - Copy(proto_perl->Inextval, PL_nextval, 5, YYSTYPE); - Copy(proto_perl->Inexttype, PL_nexttype, 5, I32); - PL_nexttoke = proto_perl->Inexttoke; -#endif - PL_multi_end = proto_perl->Imulti_end; PL_error_count = proto_perl->Ierror_count; diff --git a/toke.c b/toke.c index 3e10445..4fca542 100644 --- a/toke.c +++ b/toke.c @@ -74,6 +74,13 @@ # define PL_thisstuff (PL_parser->thisstuff) # define PL_thistoken (PL_parser->thistoken) # define PL_thiswhite (PL_parser->thiswhite) +# define PL_thiswhite (PL_parser->thiswhite) +# define PL_nexttoke (PL_parser->nexttoke) +# define PL_curforce (PL_parser->curforce) +#else +# define PL_nexttoke (PL_parser->nexttoke) +# define PL_nexttype (PL_parser->nexttype) +# define PL_nextval (PL_parser->nextval) #endif static int @@ -657,40 +664,20 @@ Perl_lex_start(pTHX_ SV *line) /* initialise lexer state */ SAVEI8(PL_lex_state); -#ifdef PERL_MAD - if (PL_lex_state == LEX_KNOWNEXT) { - I32 toke = parser->old_parser->lasttoke; - while (--toke >= 0) { - SAVEI32(PL_nexttoke[toke].next_type); - SAVEVPTR(PL_nexttoke[toke].next_val); - if (PL_madskills) - SAVEVPTR(PL_nexttoke[toke].next_mad); - } - } - SAVEI32(PL_curforce); - PL_curforce = -1; -#else - if (PL_lex_state == LEX_KNOWNEXT) { - I32 toke = PL_nexttoke; - while (--toke >= 0) { - SAVEI32(PL_nexttype[toke]); - SAVEVPTR(PL_nextval[toke]); - } - SAVEI32(PL_nexttoke); - } -#endif SAVECOPLINE(PL_curcop); SAVEDESTRUCTOR_X(restore_rsfp, PL_rsfp); +#ifdef PERL_MAD + parser->curforce = -1; +#else + parser->nexttoke = 0; +#endif parser->copline = NOLINE; PL_lex_state = LEX_NORMAL; parser->expect = XSTATE; Newx(parser->lex_brackstack, 120, char); Newx(parser->lex_casestack, 12, char); *parser->lex_casestack = '\0'; -#ifndef PERL_MAD - PL_nexttoke = 0; -#endif if (line) { s = SvPV_const(line, len);