PP(pp_wantarray)
{
- djSP;
+ dSP;
I32 cxix;
EXTEND(SP, 1);
PP(pp_regcomp)
{
- djSP;
+ dSP;
register PMOP *pm = (PMOP*)cLOGOP->op_other;
register char *t;
SV *tmpstr;
PP(pp_substcont)
{
- djSP;
+ dSP;
register PMOP *pm = (PMOP*) cLOGOP->op_other;
register PERL_CONTEXT *cx = &cxstack[cxstack_ix];
register SV *dstr = cx->sb_dstr;
register char *m = cx->sb_m;
char *orig = cx->sb_orig;
register REGEXP *rx = cx->sb_rx;
-
+
rxres_restore(&cx->sb_rxres, rx);
if (cx->sb_iters++) {
MAGIC *mg;
I32 i;
if (SvTYPE(sv) < SVt_PVMG)
- SvUPGRADE(sv, SVt_PVMG);
+ (void)SvUPGRADE(sv, SVt_PVMG);
if (!(mg = mg_find(sv, 'g'))) {
sv_magic(sv, Nullsv, 'g', Nullch, 0);
mg = mg_find(sv, 'g');
PP(pp_formline)
{
- djSP; dMARK; dORIGMARK;
+ dSP; dMARK; dORIGMARK;
register SV *tmpForm = *++MARK;
register U16 *fpc;
register char *t;
if (item_is_utf) {
while (arg--) {
if (UTF8_IS_CONTINUED(*s)) {
- switch (UTF8SKIP(s)) {
+ STRLEN skip = UTF8SKIP(s);
+ switch (skip) {
+ default:
+ Move(s,t,skip,char);
+ s += skip;
+ t += skip;
+ break;
case 7: *t++ = *s++;
case 6: *t++ = *s++;
case 5: *t++ = *s++;
PP(pp_grepstart)
{
- djSP;
+ dSP;
SV *src;
if (PL_stack_base + *PL_markstack_ptr == SP) {
PP(pp_mapwhile)
{
- djSP;
+ dSP;
I32 items = (SP - PL_stack_base) - *PL_markstack_ptr; /* how many new items */
I32 count;
I32 shift;
PP(pp_sort)
{
- djSP; dMARK; dORIGMARK;
+ dSP; dMARK; dORIGMARK;
register SV **up;
SV **myorigmark = ORIGMARK;
register I32 max;
PP(pp_flip)
{
- djSP;
+ dSP;
if (GIMME == G_ARRAY) {
RETURNOP(((LOGOP*)cUNOP->op_first)->op_other);
if (PL_op->op_private & OPpFLIP_LINENUM) {
struct io *gp_io;
flip = PL_last_in_gv
- && (gp_io = GvIOp(PL_last_in_gv))
+ && (gp_io = GvIO(PL_last_in_gv))
&& SvIV(sv) == (IV)IoLINES(gp_io);
} else {
flip = SvTRUE(sv);
PP(pp_flop)
{
- djSP;
+ dSP;
if (GIMME == G_ARRAY) {
dPOPPOPssrl;
SV *targ = PAD_SV(cUNOP->op_first->op_targ);
sv_inc(targ);
if ((PL_op->op_private & OPpFLIP_LINENUM)
- ? (PL_last_in_gv && SvIV(sv) == (IV)IoLINES(GvIOp(PL_last_in_gv)))
+ ? (GvIO(PL_last_in_gv)
+ && SvIV(sv) == (IV)IoLINES(GvIOp(PL_last_in_gv)))
: SvTRUE(sv) ) {
sv_setiv(PAD_SV(((UNOP*)cUNOP->op_first)->op_first->op_targ), 0);
sv_catpv(targ, "E0");
}
}
-/*
- * Closures mentioned at top level of eval cannot be referenced
- * again, and their presence indirectly causes a memory leak.
- * (Note that the fact that compcv and friends are still set here
- * is, AFAIK, an accident.) --Chip
- *
- * XXX need to get comppad et al from eval's cv rather than
- * relying on the incidental global values.
- */
-STATIC void
-S_free_closures(pTHX)
-{
- SV **svp = AvARRAY(PL_comppad_name);
- I32 ix;
- for (ix = AvFILLp(PL_comppad_name); ix >= 0; ix--) {
- SV *sv = svp[ix];
- if (sv && sv != &PL_sv_undef && *SvPVX(sv) == '&') {
- SvREFCNT_dec(sv);
- svp[ix] = &PL_sv_undef;
-
- sv = PL_curpad[ix];
- if (CvCLONE(sv)) {
- SvREFCNT_dec(CvOUTSIDE(sv));
- CvOUTSIDE(sv) = Nullcv;
- }
- else {
- SvREFCNT_dec(sv);
- sv = NEWSV(0,0);
- SvPADTMP_on(sv);
- PL_curpad[ix] = sv;
- }
- }
- }
-}
-
void
Perl_qerror(pTHX_ SV *err)
{
PP(pp_xor)
{
- djSP; dPOPTOPssrl;
+ dSP; dPOPTOPssrl;
if (SvTRUE(left) != SvTRUE(right))
RETSETYES;
else
PP(pp_andassign)
{
- djSP;
+ dSP;
if (!SvTRUE(TOPs))
RETURN;
else
PP(pp_orassign)
{
- djSP;
+ dSP;
if (SvTRUE(TOPs))
RETURN;
else
PP(pp_caller)
{
- djSP;
+ dSP;
register I32 cxix = dopoptosub(cxstack_ix);
register PERL_CONTEXT *cx;
register PERL_CONTEXT *ccstack = cxstack;
PP(pp_reset)
{
- djSP;
+ dSP;
char *tmps;
STRLEN n_a;
if (PL_op->op_private || SvIV(PL_DBsingle) || SvIV(PL_DBsignal) || SvIV(PL_DBtrace))
{
- djSP;
+ dSP;
register CV *cv;
register PERL_CONTEXT *cx;
I32 gimme = G_ARRAY;
if (!cv)
DIE(aTHX_ "No DB::DB routine defined");
- if (CvDEPTH(cv) >= 1 && !(PL_debug & (1<<30))) /* don't do recursive DB::DB call */
+ if (CvDEPTH(cv) >= 1 && !(PL_debug & DEBUG_DB_RECURSE_FLAG))
+ /* don't do recursive DB::DB call */
return NORMAL;
ENTER;
PP(pp_enteriter)
{
- djSP; dMARK;
+ dSP; dMARK;
register PERL_CONTEXT *cx;
I32 gimme = GIMME_V;
SV **svp;
PP(pp_enterloop)
{
- djSP;
+ dSP;
register PERL_CONTEXT *cx;
I32 gimme = GIMME_V;
PP(pp_leaveloop)
{
- djSP;
+ dSP;
register PERL_CONTEXT *cx;
I32 gimme;
SV **newsp;
PP(pp_return)
{
- djSP; dMARK;
+ dSP; dMARK;
I32 cxix;
register PERL_CONTEXT *cx;
bool popsub2 = FALSE;
POPEVAL(cx);
if (CxTRYBLOCK(cx))
break;
- if (AvFILLp(PL_comppad_name) >= 0)
- free_closures();
lex_end();
if (optype == OP_REQUIRE &&
(MARK == SP || (gimme == G_SCALAR && !SvTRUE(*SP))) )
PP(pp_last)
{
- djSP;
+ dSP;
I32 cxix;
register PERL_CONTEXT *cx;
I32 pop2 = 0;
PP(pp_goto)
{
- djSP;
+ dSP;
OP *retop = 0;
I32 ix;
register PERL_CONTEXT *cx;
if (cxix < cxstack_ix)
dounwind(cxix);
TOPBLOCK(cx);
- if (CxTYPE(cx) == CXt_EVAL && cx->blk_eval.old_op_type == OP_ENTEREVAL)
+ if (CxREALEVAL(cx))
DIE(aTHX_ "Can't goto subroutine from an eval-string");
mark = PL_stack_sp;
if (CxTYPE(cx) == CXt_SUB && cx->blk_sub.hasargs) {
if (label && *label) {
OP *gotoprobe = 0;
+ bool leaving_eval = FALSE;
+ PERL_CONTEXT *last_eval_cx = 0;
/* find label */
cx = &cxstack[ix];
switch (CxTYPE(cx)) {
case CXt_EVAL:
- gotoprobe = PL_eval_root; /* XXX not good for nested eval */
- break;
+ leaving_eval = TRUE;
+ if (CxREALEVAL(cx)) {
+ gotoprobe = (last_eval_cx ?
+ last_eval_cx->blk_eval.old_eval_root :
+ PL_eval_root);
+ last_eval_cx = cx;
+ break;
+ }
+ /* else fall through */
case CXt_LOOP:
gotoprobe = cx->blk_oldcop->op_sibling;
break;
if (!retop)
DIE(aTHX_ "Can't find label %s", label);
+ /* if we're leaving an eval, check before we pop any frames
+ that we're not going to punt, otherwise the error
+ won't be caught */
+
+ if (leaving_eval && *enterops && enterops[1]) {
+ I32 i;
+ for (i = 1; enterops[i]; i++)
+ if (enterops[i]->op_type == OP_ENTERITER)
+ DIE(aTHX_ "Can't \"goto\" into the middle of a foreach loop");
+ }
+
/* pop unwanted frames */
if (ix < cxstack_ix) {
PP(pp_exit)
{
- djSP;
+ dSP;
I32 anum;
if (MAXARG < 1)
#ifdef NOTYET
PP(pp_nswitch)
{
- djSP;
+ dSP;
NV value = SvNVx(GvSV(cCOP->cop_gv));
register I32 match = I_32(value);
PP(pp_cswitch)
{
- djSP;
+ dSP;
register I32 match;
if (PL_multiline)
CvOUTSIDE(PL_compcv) = (CV*)SvREFCNT_inc(caller);
}
- SAVEFREESV(PL_compcv);
+ SAVEMORTALIZESV(PL_compcv); /* must remain until end of current statement */
/* make sure we compile in the right package */
PP(pp_require)
{
- djSP;
+ dSP;
register PERL_CONTEXT *cx;
SV *sv;
char *name;
char *tryname;
SV *namesv = Nullsv;
SV** svp;
- I32 gimme = G_SCALAR;
+ I32 gimme = GIMME_V;
PerlIO *tryrsfp = 0;
STRLEN n_a;
int filter_has_file = 0;
U8 *s = (U8*)SvPVX(sv);
U8 *end = (U8*)SvPVX(sv) + SvCUR(sv);
if (s < end) {
- rev = utf8_to_uv(s, end - s, &len, 0);
+ rev = utf8n_to_uvchr(s, end - s, &len, 0);
s += len;
if (s < end) {
- ver = utf8_to_uv(s, end - s, &len, 0);
+ ver = utf8n_to_uvchr(s, end - s, &len, 0);
s += len;
if (s < end)
- sver = utf8_to_uv(s, end - s, &len, 0);
+ sver = utf8n_to_uvchr(s, end - s, &len, 0);
}
}
if (PERL_REVISION < rev
/* prepare to compile file */
+#ifdef MACOS_TRADITIONAL
if (PERL_FILE_IS_ABSOLUTE(name)
- || (*name == '.' && (name[1] == '/' ||
- (name[1] == '.' && name[2] == '/'))))
+ || (*name == ':' && name[1] != ':' && strchr(name+2, ':')))
{
tryname = name;
tryrsfp = doopen_pmc(name,PERL_SCRIPT_MODE);
-#ifdef MACOS_TRADITIONAL
/* We consider paths of the form :a:b ambiguous and interpret them first
as global then as local
*/
- if (!tryrsfp && name[0] == ':' && name[1] != ':' && strchr(name+2, ':'))
+ if (!tryrsfp && *name == ':' && name[1] != ':' && strchr(name+2, ':'))
goto trylocal;
}
else
trylocal: {
#else
+ if (PERL_FILE_IS_ABSOLUTE(name)
+ || (*name == '.' && (name[1] == '/' ||
+ (name[1] == '.' && name[2] == '/'))))
+ {
+ tryname = name;
+ tryrsfp = doopen_pmc(name,PERL_SCRIPT_MODE);
}
else {
#endif
PUSHs(dirsv);
PUSHs(sv);
PUTBACK;
- count = call_sv(loader, G_ARRAY);
+ if (sv_isobject(loader))
+ count = call_method("INC", G_ARRAY);
+ else
+ count = call_sv(loader, G_ARRAY);
SPAGAIN;
if (count > 0) {
PL_eval_owner = thr;
MUTEX_UNLOCK(&PL_eval_mutex);
#endif /* USE_THREADS */
- return DOCATCH(doeval(G_SCALAR, NULL));
+ return DOCATCH(doeval(gimme, NULL));
}
PP(pp_dofile)
PP(pp_entereval)
{
- djSP;
+ dSP;
register PERL_CONTEXT *cx;
dPOPss;
I32 gimme = GIMME_V, was = PL_sub_generation;
PP(pp_leaveeval)
{
- djSP;
+ dSP;
register SV **mark;
SV **newsp;
PMOP *newpm;
}
PL_curpm = newpm; /* Don't pop $1 et al till now */
- if (AvFILLp(PL_comppad_name) >= 0)
- free_closures();
-
#ifdef DEBUGGING
assert(CvDEPTH(PL_compcv) == 1);
#endif
PP(pp_entertry)
{
- djSP;
+ dSP;
register PERL_CONTEXT *cx;
I32 gimme = GIMME_V;
push_return(cLOGOP->op_other->op_next);
PUSHBLOCK(cx, (CXt_EVAL|CXp_TRYBLOCK), SP);
PUSHEVAL(cx, 0, 0);
- PL_eval_root = PL_op; /* Only needed so that goto works right. */
PL_in_eval = EVAL_INEVAL;
sv_setpv(ERRSV,"");
PP(pp_leavetry)
{
- djSP;
+ dSP;
register SV **mark;
SV **newsp;
PMOP *newpm;
}
if (filter_sub && len >= 0) {
- djSP;
+ dSP;
int count;
ENTER;