cx->blk_eval.old_op_type = PL_op->op_type; \
cx->blk_eval.old_namesv = (n ? newSVpv(n,0) : NULL); \
cx->blk_eval.old_eval_root = PL_eval_root; \
- cx->blk_eval.cur_text = PL_linestr; \
+ cx->blk_eval.cur_text = PL_parser ? PL_parser->linestr : NULL; \
cx->blk_eval.cv = NULL; /* set by doeval(), as applicable */ \
cx->blk_eval.retop = NULL; \
cx->blk_eval.cur_top_env = PL_top_env; \
#define PL_lex_state (vTHX->Ilex_state)
#define PL_lineary (vTHX->Ilineary)
#define PL_linestart (vTHX->Ilinestart)
-#define PL_linestr (vTHX->Ilinestr)
#define PL_localpatches (vTHX->Ilocalpatches)
#define PL_lockhook (vTHX->Ilockhook)
#define PL_madskills (vTHX->Imadskills)
#define PL_Ilex_state PL_lex_state
#define PL_Ilineary PL_lineary
#define PL_Ilinestart PL_linestart
-#define PL_Ilinestr PL_linestr
#define PL_Ilocalpatches PL_localpatches
#define PL_Ilockhook PL_lockhook
#define PL_Imadskills PL_madskills
PERLVAR(Inexttoke, I32)
#endif
-PERLVAR(Ilinestr, SV *)
PERLVAR(Ibufptr, char *)
PERLVAR(Ioldbufptr, char *)
PERLVAR(Ioldoldbufptr, char *)
char pending_ident; /* pending identifier lookup */
bool preambled;
SUBLEXINFO sublex_info;
+ SV *linestr; /* current chunk of src text */
#ifdef PERL_MAD
SV *endwhite;
#endif
PL_curcop = &PL_compiling; /* needed by ckWARN, right away */
- PL_linestr = newSV_type(SVt_PVIV);
- SvGROW(PL_linestr, 80);
-
/* set read-only and try to insure than we wont see REFCNT==0
very often */
PL_preambleav = NULL;
SvREFCNT_dec(PL_subname);
PL_subname = NULL;
- SvREFCNT_dec(PL_linestr);
- PL_linestr = NULL;
#ifdef PERL_USES_PL_PIDSTATUS
SvREFCNT_dec(PL_pidstatus);
PL_pidstatus = NULL;
#define PL_lineary (*Perl_Ilineary_ptr(aTHX))
#undef PL_linestart
#define PL_linestart (*Perl_Ilinestart_ptr(aTHX))
-#undef PL_linestr
-#define PL_linestr (*Perl_Ilinestr_ptr(aTHX))
#undef PL_localpatches
#define PL_localpatches (*Perl_Ilocalpatches_ptr(aTHX))
#undef PL_lockhook
/* prepare to compile string */
if (PERLDB_LINE && PL_curstash != PL_debstash)
- save_lines(CopFILEAV(&PL_compiling), PL_linestr);
+ save_lines(CopFILEAV(&PL_compiling), PL_parser->linestr);
PUTBACK;
ret = doeval(gimme, NULL, runcv, seq);
if (PERLDB_INTER && was != (I32)PL_sub_generation /* Some subs defined here. */
parser->pending_ident = proto->pending_ident;
parser->preambled = proto->preambled;
parser->sublex_info = proto->sublex_info; /* XXX not quite right */
+ parser->linestr = sv_dup_inc(proto->linestr, param);
#ifdef PERL_MAD
parser->endwhite = proto->endwhite;
PL_nexttoke = proto_perl->Inexttoke;
#endif
- PL_linestr = sv_dup_inc(proto_perl->Ilinestr, param);
- i = proto_perl->Ibufptr - SvPVX_const(proto_perl->Ilinestr);
- PL_bufptr = SvPVX(PL_linestr) + (i < 0 ? 0 : i);
- i = proto_perl->Ioldbufptr - SvPVX_const(proto_perl->Ilinestr);
- PL_oldbufptr = SvPVX(PL_linestr) + (i < 0 ? 0 : i);
- i = proto_perl->Ioldoldbufptr - SvPVX_const(proto_perl->Ilinestr);
- PL_oldoldbufptr = SvPVX(PL_linestr) + (i < 0 ? 0 : i);
- i = proto_perl->Ilinestart - SvPVX_const(proto_perl->Ilinestr);
- PL_linestart = SvPVX(PL_linestr) + (i < 0 ? 0 : i);
- PL_bufend = SvPVX(PL_linestr) + SvCUR(PL_linestr);
+ if (proto_perl->Iparser) {
+ i = proto_perl->Ibufptr - SvPVX_const(proto_perl->Iparser->linestr);
+ PL_bufptr = SvPVX(PL_parser->linestr) + (i < 0 ? 0 : i);
+ i = proto_perl->Ioldbufptr - SvPVX_const(proto_perl->Iparser->linestr);
+ PL_oldbufptr = SvPVX(PL_parser->linestr) + (i < 0 ? 0 : i);
+ i = proto_perl->Ioldoldbufptr - SvPVX_const(proto_perl->Iparser->linestr);
+ PL_oldoldbufptr = SvPVX(PL_parser->linestr) + (i < 0 ? 0 : i);
+ i = proto_perl->Ilinestart - SvPVX_const(proto_perl->Iparser->linestr);
+ PL_linestart = SvPVX(PL_parser->linestr) + (i < 0 ? 0 : i);
+ PL_bufend = SvPVX(PL_parser->linestr) + SvCUR(PL_parser->linestr);
+ i = proto_perl->Ilast_uni - SvPVX_const(proto_perl->Iparser->linestr);
+ PL_last_uni = SvPVX(PL_parser->linestr) + (i < 0 ? 0 : i);
+ i = proto_perl->Ilast_lop - SvPVX_const(proto_perl->Iparser->linestr);
+ PL_last_lop = SvPVX(PL_parser->linestr) + (i < 0 ? 0 : i);
+ }
PL_expect = proto_perl->Iexpect;
PL_subline = proto_perl->Isubline;
PL_subname = sv_dup_inc(proto_perl->Isubname, param);
- i = proto_perl->Ilast_uni - SvPVX_const(proto_perl->Ilinestr);
- PL_last_uni = SvPVX(PL_linestr) + (i < 0 ? 0 : i);
- i = proto_perl->Ilast_lop - SvPVX_const(proto_perl->Ilinestr);
- PL_last_lop = SvPVX(PL_linestr) + (i < 0 ? 0 : i);
PL_last_lop_op = proto_perl->Ilast_lop_op;
PL_in_my = proto_perl->Iin_my;
PL_in_my_stash = hv_dup(proto_perl->Iin_my_stash, param);
#define PL_pending_ident (PL_parser->pending_ident)
#define PL_preambled (PL_parser->preambled)
#define PL_sublex_info (PL_parser->sublex_info)
+#define PL_linestr (PL_parser->linestr)
+
#ifdef PERL_MAD
# define PL_endwhite (PL_parser->endwhite)
SAVEPPTR(PL_last_lop);
SAVEPPTR(PL_last_uni);
SAVEPPTR(PL_linestart);
- SAVESPTR(PL_linestr);
SAVEDESTRUCTOR_X(restore_rsfp, PL_rsfp);
SAVEI8(PL_expect);
} else {
len = 0;
}
+
if (!len) {
- PL_linestr = newSVpvs("\n;");
+ parser->linestr = newSVpvs("\n;");
} else if (SvREADONLY(line) || s[len-1] != ';') {
- PL_linestr = newSVsv(line);
+ parser->linestr = newSVsv(line);
if (s[len-1] != ';')
- sv_catpvs(PL_linestr, "\n;");
+ sv_catpvs(parser->linestr, "\n;");
} else {
SvTEMP_off(line);
SvREFCNT_inc_simple_void_NN(line);
- PL_linestr = line;
+ parser->linestr = line;
}
- /* PL_linestr needs to survive until end of scope, not just the next
- FREETMPS. See changes 17505 and 17546 which fixed the symptoms only. */
- SAVEFREESV(PL_linestr);
- PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = SvPVX(PL_linestr);
- PL_bufend = PL_bufptr + SvCUR(PL_linestr);
+ PL_oldoldbufptr = PL_oldbufptr = PL_bufptr = PL_linestart = SvPVX(parser->linestr);
+ PL_bufend = PL_bufptr + SvCUR(parser->linestr);
PL_last_lop = PL_last_uni = NULL;
PL_rsfp = 0;
}
void
Perl_parser_free(pTHX_ const yy_parser *parser)
{
+ SvREFCNT_dec(parser->linestr);
+
Safefree(parser->stack);
Safefree(parser->lex_brackstack);
Safefree(parser->lex_casestack);