Change 29678 by [EMAIL PROTECTED] on 2007/01/03 22:17:48 handle cloning of parsers on the save stack
Affected files ... ... //depot/perl/perly.c#107 edit ... //depot/perl/scope.c#200 edit ... //depot/perl/scope.h#86 edit ... //depot/perl/sv.c#1346 edit Differences ... ==== //depot/perl/perly.c#107 (text) ==== Index: perl/perly.c --- perl/perly.c#106~29670~ 2007-01-02 13:45:08.000000000 -0800 +++ perl/perly.c 2007-01-03 14:17:48.000000000 -0800 @@ -348,7 +348,7 @@ ps = parser->ps; ENTER; /* force parser free before we return */ - SAVEDESTRUCTOR_X(Perl_parser_free, (void*) parser); + SAVEPARSER(parser); /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | ==== //depot/perl/scope.c#200 (text) ==== Index: perl/scope.c --- perl/scope.c#199~29482~ 2006-12-07 01:07:25.000000000 -0800 +++ perl/scope.c 2007-01-03 14:17:48.000000000 -0800 @@ -1023,6 +1023,10 @@ Copy(state, &PL_reg_state, 1, struct re_save_state); } break; + case SAVEt_PARSER: + ptr = SSPOPPTR; + parser_free((yy_parser *) ptr); + break; default: Perl_croak(aTHX_ "panic: leave_scope inconsistency"); } ==== //depot/perl/scope.h#86 (text) ==== Index: perl/scope.h --- perl/scope.h#85~29585~ 2006-12-18 08:06:38.000000000 -0800 +++ perl/scope.h 2007-01-03 14:17:48.000000000 -0800 @@ -53,6 +53,7 @@ #define SAVEt_RE_STATE 42 #define SAVEt_COMPILE_WARNINGS 43 #define SAVEt_STACK_CXPOS 44 +#define SAVEt_PARSER 45 #ifndef SCOPE_SAVES_SIGNAL_MASK #define SCOPE_SAVES_SIGNAL_MASK 0 @@ -214,6 +215,13 @@ SSPUSHINT(SAVEt_STACK_CXPOS); \ } STMT_END +#define SAVEPARSER(p) \ + STMT_START { \ + SSCHECK(2); \ + SSPUSHPTR(p); \ + SSPUSHINT(SAVEt_PARSER); \ + } STMT_END + #ifdef USE_ITHREADS # define SAVECOPSTASH(c) SAVEPPTR(CopSTASHPV(c)) # define SAVECOPSTASH_FREE(c) SAVESHAREDPV(CopSTASHPV(c)) ==== //depot/perl/sv.c#1346 (text) ==== Index: perl/sv.c --- perl/sv.c#1345~29673~ 2007-01-03 07:17:29.000000000 -0800 +++ perl/sv.c 2007-01-03 14:17:48.000000000 -0800 @@ -9498,7 +9498,14 @@ if (!proto) return NULL; + /* look for it in the table first */ + parser = (yy_parser *)ptr_table_fetch(PL_ptr_table, proto); + if (parser) + return parser; + + /* create anew and remember what it is */ Newxz(parser, 1, yy_parser); + ptr_table_store(PL_ptr_table, proto, parser); parser->yyerrstatus = 0; parser->yychar = YYEMPTY; /* Cause a token to be read. */ @@ -10670,6 +10677,10 @@ ptr = POPPTR(ss,ix); TOPPTR(nss,ix) = DUP_WARNINGS((STRLEN*)ptr); break; + case SAVEt_PARSER: + ptr = POPPTR(ss,ix); + TOPPTR(nss,ix) = parser_dup(ptr, param); + break; default: Perl_croak(aTHX_ "panic: ss_dup inconsistency (%"IVdf")", (IV) type); End of Patch.