3 * Copyright (c) 1991-1994, Larry Wall
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
11 * "You see: Mr. Drogo, he married poor Miss Primula Brandybuck. She was
12 * our Mr. Bilbo's first cousin on the mother's side (her mother being the
13 * youngest of the Old Took's daughters); and Mr. Drogo was his second
14 * cousin. So Mr. Frodo is his first *and* second cousin, once removed
15 * either way, as the saying is, if you follow me." --the Gaffer
21 #define USE_OP_MASK /* Turned on by default in 5.002beta1h */
25 * In the following definition, the ", (OP *) op" is just to make the compiler
26 * think the expression is of the right type: croak actually does a Siglongjmp.
28 #define CHECKOP(type,op) \
29 ((op_mask && op_mask[type]) \
30 ? (croak("%s trapped by operation mask", op_desc[type]), (OP*)op) \
31 : (*check[type])((OP*)op))
33 #define CHECKOP(type,op) (*check[type])(op)
34 #endif /* USE_OP_MASK */
36 static I32 list_assignment _((OP *op));
37 static OP *bad_type _((I32 n, char *t, char *name, OP *kid));
38 static OP *modkids _((OP *op, I32 type));
39 static OP *no_fh_allowed _((OP *op));
40 static OP *scalarboolean _((OP *op));
41 static OP *too_few_arguments _((OP *op, char* name));
42 static OP *too_many_arguments _((OP *op, char* name));
43 static void null _((OP* op));
44 static PADOFFSET pad_findlex _((char* name, PADOFFSET newoff, U32 seq,
45 CV* startcv, I32 cx_ix));
51 SV* tmpsv = sv_newmortal();
52 gv_efullname3(tmpsv, CvGV(cv), Nullch);
53 return SvPV(tmpsv,na);
60 sprintf(tokenbuf,"Missing comma after first argument to %s function",
61 op_desc[op->op_type]);
67 too_few_arguments(op, name)
71 sprintf(tokenbuf,"Not enough arguments for %s", name);
77 too_many_arguments(op, name)
81 sprintf(tokenbuf,"Too many arguments for %s", name);
87 bad_type(n, t, name, kid)
93 sprintf(tokenbuf, "Type of arg %d to %s must be %s (not %s)",
94 (int) n, name, t, op_desc[kid->op_type]);
103 int type = op->op_type;
104 if (type != OP_AELEM && type != OP_HELEM) {
105 sprintf(tokenbuf, "Can't use subscript on %s", op_desc[type]);
107 if (type == OP_RV2HV || type == OP_ENTERSUB)
108 warn("(Did you mean $ or @ instead of %c?)\n",
109 type == OP_RV2HV ? '%' : '&');
113 /* "register" allocation */
122 if (!(isALPHA(name[1]) || name[1] == '_' && (int)strlen(name) > 2)) {
123 if (!isPRINT(name[1]))
124 sprintf(name+1, "^%c", toCTRL(name[1])); /* XXX tokenbuf, really */
125 croak("Can't use global %s in \"my\"",name);
127 if (AvFILL(comppad_name) >= 0) {
128 SV **svp = AvARRAY(comppad_name);
129 for (off = AvFILL(comppad_name); off > comppad_name_floor; off--) {
132 && SvIVX(sv) == 999999999 /* var is in open scope */
133 && strEQ(name, SvPVX(sv)))
135 warn("\"my\" variable %s masks earlier declaration in same scope", name);
140 off = pad_alloc(OP_PADSV, SVs_PADMY);
142 sv_upgrade(sv, SVt_PVNV);
144 av_store(comppad_name, off, sv);
145 SvNVX(sv) = (double)999999999;
146 SvIVX(sv) = 0; /* Not yet introduced--see newSTATEOP */
147 if (!min_intro_pending)
148 min_intro_pending = off;
149 max_intro_pending = off;
151 av_store(comppad, off, (SV*)newAV());
152 else if (*name == '%')
153 av_store(comppad, off, (SV*)newHV());
154 SvPADMY_on(curpad[off]);
159 #ifndef CAN_PROTOTYPE
160 pad_findlex(name, newoff, seq, startcv, cx_ix)
167 pad_findlex(char *name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix)
174 register CONTEXT *cx;
177 for (cv = startcv; cv; cv = CvOUTSIDE(cv)) {
178 AV* curlist = CvPADLIST(cv);
179 SV** svp = av_fetch(curlist, 0, FALSE);
181 if (!svp || *svp == &sv_undef)
184 svp = AvARRAY(curname);
185 for (off = AvFILL(curname); off > 0; off--) {
186 if ((sv = svp[off]) &&
189 seq > I_32(SvNVX(sv)) &&
190 strEQ(SvPVX(sv), name))
198 if (newoff && !CvUNIQUE(cv))
199 return 0; /* don't clone inactive sub's stack frame */
202 oldpad = (AV*)*av_fetch(curlist, depth, FALSE);
203 oldsv = *av_fetch(oldpad, off, TRUE);
204 if (!newoff) { /* Not a mere clone operation. */
205 SV *sv = NEWSV(1103,0);
206 newoff = pad_alloc(OP_PADSV, SVs_PADMY);
207 sv_upgrade(sv, SVt_PVNV);
209 av_store(comppad_name, newoff, sv);
210 SvNVX(sv) = (double)curcop->cop_seq;
211 SvIVX(sv) = 999999999; /* A ref, intro immediately */
212 SvFLAGS(sv) |= SVf_FAKE;
213 /* "It's closures all the way down." */
218 bcv && bcv != cv && !CvCLONE(bcv);
219 bcv = CvOUTSIDE(bcv))
223 av_store(comppad, newoff, SvREFCNT_inc(oldsv));
229 /* Nothing in current lexical context--try eval's context, if any.
230 * This is necessary to let the perldb get at lexically scoped variables.
231 * XXX This will also probably interact badly with eval tree caching.
235 for (i = cx_ix; i >= 0; i--) {
237 switch (cx->cx_type) {
239 if (i == 0 && saweval) {
240 seq = cxstack[saweval].blk_oldcop->cop_seq;
241 return pad_findlex(name, newoff, seq, main_cv, 0);
245 if (cx->blk_eval.old_op_type != OP_ENTEREVAL &&
246 cx->blk_eval.old_op_type != OP_ENTERTRY)
247 return 0; /* require must have its own scope */
254 if (debstash && CvSTASH(cv) == debstash) { /* ignore DB'* scope */
255 saweval = i; /* so we know where we were called from */
258 seq = cxstack[saweval].blk_oldcop->cop_seq;
259 return pad_findlex(name, newoff, seq, cv, i-1);
272 SV **svp = AvARRAY(comppad_name);
273 U32 seq = cop_seqmax;
275 /* The one we're looking for is probably just before comppad_name_fill. */
276 for (off = AvFILL(comppad_name); off > 0; off--) {
277 if ((sv = svp[off]) &&
280 seq > I_32(SvNVX(sv)) &&
281 strEQ(SvPVX(sv), name))
283 return (PADOFFSET)off;
287 /* See if it's in a nested scope */
288 off = pad_findlex(name, 0, seq, CvOUTSIDE(compcv), cxstack_ix);
300 SV **svp = AvARRAY(comppad_name);
302 if (min_intro_pending && fill < min_intro_pending) {
303 for (off = max_intro_pending; off >= min_intro_pending; off--) {
304 if ((sv = svp[off]) && sv != &sv_undef)
305 warn("%s never introduced", SvPVX(sv));
308 /* "Deintroduce" my variables that are leaving with this scope. */
309 for (off = AvFILL(comppad_name); off > fill; off--) {
310 if ((sv = svp[off]) && sv != &sv_undef && SvIVX(sv) == 999999999)
311 SvIVX(sv) = cop_seqmax;
316 pad_alloc(optype,tmptype)
323 if (AvARRAY(comppad) != curpad)
324 croak("panic: pad_alloc");
325 if (pad_reset_pending)
327 if (tmptype & SVs_PADMY) {
329 sv = *av_fetch(comppad, AvFILL(comppad) + 1, TRUE);
330 } while (SvPADBUSY(sv)); /* need a fresh one */
331 retval = AvFILL(comppad);
334 SV **names = AvARRAY(comppad_name);
335 SSize_t names_fill = AvFILL(comppad_name);
338 * "foreach" index vars temporarily become aliases to non-"my"
339 * values. Thus we must skip, not just pad values that are
340 * marked as current pad values, but also those with names.
342 if (++padix <= names_fill &&
343 (sv = names[padix]) && sv != &sv_undef)
345 sv = *av_fetch(comppad, padix, TRUE);
346 if (!(SvFLAGS(sv) & (SVs_PADTMP|SVs_PADMY)))
351 SvFLAGS(sv) |= tmptype;
352 curpad = AvARRAY(comppad);
353 DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad alloc %ld for %s\n", (long) retval, op_name[optype]));
354 return (PADOFFSET)retval;
358 #ifndef CAN_PROTOTYPE
363 #endif /* CAN_PROTOTYPE */
366 croak("panic: pad_sv po");
367 DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad sv %d\n", po));
368 return curpad[po]; /* eventually we'll turn this into a macro */
372 #ifndef CAN_PROTOTYPE
376 pad_free(PADOFFSET po)
377 #endif /* CAN_PROTOTYPE */
381 if (AvARRAY(comppad) != curpad)
382 croak("panic: pad_free curpad");
384 croak("panic: pad_free po");
385 DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad free %d\n", po));
386 if (curpad[po] && curpad[po] != &sv_undef)
387 SvPADTMP_off(curpad[po]);
393 #ifndef CAN_PROTOTYPE
397 pad_swipe(PADOFFSET po)
398 #endif /* CAN_PROTOTYPE */
400 if (AvARRAY(comppad) != curpad)
401 croak("panic: pad_swipe curpad");
403 croak("panic: pad_swipe po");
404 DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad swipe %d\n", po));
405 SvPADTMP_off(curpad[po]);
406 curpad[po] = NEWSV(1107,0);
407 SvPADTMP_on(curpad[po]);
417 if (AvARRAY(comppad) != curpad)
418 croak("panic: pad_reset curpad");
419 DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad reset\n"));
420 if (!tainting) { /* Can't mix tainted and non-tainted temporaries. */
421 for (po = AvMAX(comppad); po > padix_floor; po--) {
422 if (curpad[po] && curpad[po] != &sv_undef)
423 SvPADTMP_off(curpad[po]);
427 pad_reset_pending = FALSE;
436 register OP *kid, *nextkid;
438 if (!op || op->op_seq == (U16)-1)
441 if (op->op_flags & OPf_KIDS) {
442 for (kid = cUNOP->op_first; kid; kid = nextkid) {
443 nextkid = kid->op_sibling; /* Get before next freeing kid */
448 switch (op->op_type) {
450 op->op_targ = 0; /* Was holding old type, if any. */
453 op->op_targ = 0; /* Was holding hints. */
456 if (!(op->op_flags & OPf_REF) || (check[op->op_type] != ck_ftst))
462 SvREFCNT_dec(cGVOP->op_gv);
466 Safefree(cCOP->cop_label);
467 SvREFCNT_dec(cCOP->cop_filegv);
470 SvREFCNT_dec(cSVOP->op_sv);
476 if (op->op_flags & (OPf_SPECIAL|OPf_STACKED|OPf_KIDS))
480 Safefree(cPVOP->op_pv);
483 op_free(cPMOP->op_pmreplroot);
487 pregfree(cPMOP->op_pmregexp);
488 SvREFCNT_dec(cPMOP->op_pmshort);
493 pad_free(op->op_targ);
502 if (op->op_type != OP_NULL && op->op_targ > 0)
503 pad_free(op->op_targ);
504 op->op_targ = op->op_type;
505 op->op_type = OP_NULL;
506 op->op_ppaddr = ppaddr[OP_NULL];
509 /* Contextualizers */
511 #define LINKLIST(o) ((o)->op_next ? (o)->op_next : linklist((OP*)o))
522 /* establish postfix order */
523 if (cUNOP->op_first) {
524 op->op_next = LINKLIST(cUNOP->op_first);
525 for (kid = cUNOP->op_first; kid; kid = kid->op_sibling) {
527 kid->op_next = LINKLIST(kid->op_sibling);
543 if (op && op->op_flags & OPf_KIDS) {
544 for (kid = cLISTOP->op_first; kid; kid = kid->op_sibling)
555 op->op_type == OP_SASSIGN && cBINOP->op_first->op_type == OP_CONST) {
556 line_t oldline = curcop->cop_line;
558 if (copline != NOLINE)
559 curcop->cop_line = copline;
560 warn("Found = in conditional, should be ==");
561 curcop->cop_line = oldline;
572 /* assumes no premature commitment */
573 if (!op || (op->op_flags & OPf_KNOW) || op->op_type == OP_RETURN
577 op->op_flags &= ~OPf_LIST;
578 op->op_flags |= OPf_KNOW;
580 switch (op->op_type) {
582 if (op->op_private & OPpREPEAT_DOLIST)
583 null(((LISTOP*)cBINOP->op_first)->op_first);
584 scalar(cBINOP->op_first);
589 for (kid = cUNOP->op_first->op_sibling; kid; kid = kid->op_sibling)
593 if ((kid = ((LISTOP*)op)->op_first) && kid->op_type == OP_PUSHRE) {
594 if (!kPMOP->op_pmreplroot)
595 deprecate("implicit split to @_");
602 if (op->op_flags & OPf_KIDS) {
603 for (kid = cUNOP->op_first; kid; kid = kid->op_sibling)
609 scalar(cLISTOP->op_first);
614 for (kid = cLISTOP->op_first; kid; kid = kid->op_sibling) {
634 if (!op || error_count)
636 if (op->op_flags & OPf_LIST)
639 op->op_flags |= OPf_KNOW;
641 switch (op->op_type) {
643 if (!(opargs[op->op_type] & OA_FOLDCONST))
647 if (op->op_flags & OPf_STACKED)
720 if (!(op->op_private & OPpLVAL_INTRO))
721 useless = op_desc[op->op_type];
728 if (!(op->op_private & OPpLVAL_INTRO) &&
729 (!op->op_sibling || op->op_sibling->op_type != OP_READLINE))
730 useless = "a variable";
735 curcop = ((COP*)op); /* for warning below */
741 useless = "a constant";
742 if (SvNIOK(sv) && (SvNV(sv) == 0.0 || SvNV(sv) == 1.0))
744 else if (SvPOK(sv)) {
745 if (strnEQ(SvPVX(sv), "di", 2) ||
746 strnEQ(SvPVX(sv), "ds", 2) ||
747 strnEQ(SvPVX(sv), "ig", 2))
751 null(op); /* don't execute a constant */
752 SvREFCNT_dec(sv); /* don't even remember it */
756 op->op_type = OP_PREINC; /* pre-increment is faster */
757 op->op_ppaddr = ppaddr[OP_PREINC];
761 op->op_type = OP_PREDEC; /* pre-decrement is faster */
762 op->op_ppaddr = ppaddr[OP_PREDEC];
768 for (kid = cUNOP->op_first->op_sibling; kid; kid = kid->op_sibling)
772 if (op->op_targ == OP_NEXTSTATE || op->op_targ == OP_DBSTATE)
773 curcop = ((COP*)op); /* for warning below */
774 if (op->op_flags & OPf_STACKED)
779 if (!(op->op_flags & OPf_KIDS))
785 op->op_private |= OPpLEAVE_VOID;
788 for (kid = cLISTOP->op_first; kid; kid = kid->op_sibling)
792 if ((kid = ((LISTOP*)op)->op_first) && kid->op_type == OP_PUSHRE) {
793 if (!kPMOP->op_pmreplroot)
794 deprecate("implicit split to @_");
798 op->op_private |= OPpLEAVE_VOID;
801 if (useless && dowarn)
802 warn("Useless use of %s in void context", useless);
811 if (op && op->op_flags & OPf_KIDS) {
812 for (kid = cLISTOP->op_first; kid; kid = kid->op_sibling)
824 /* assumes no premature commitment */
825 if (!op || (op->op_flags & OPf_KNOW) || op->op_type == OP_RETURN
829 op->op_flags |= (OPf_KNOW | OPf_LIST);
831 switch (op->op_type) {
834 list(cBINOP->op_first);
839 for (kid = cUNOP->op_first->op_sibling; kid; kid = kid->op_sibling)
846 if (!(op->op_flags & OPf_KIDS))
848 if (!op->op_next && cUNOP->op_first->op_type == OP_FLOP) {
849 list(cBINOP->op_first);
850 return gen_constant_list(op);
857 list(cLISTOP->op_first);
861 for (kid = cLISTOP->op_first; kid; kid = kid->op_sibling) {
880 if (op->op_type == OP_LINESEQ ||
881 op->op_type == OP_SCOPE ||
882 op->op_type == OP_LEAVE ||
883 op->op_type == OP_LEAVETRY)
885 for (kid = cLISTOP->op_first; kid; kid = kid->op_sibling) {
886 if (kid->op_sibling) {
892 op->op_flags &= ~OPf_PARENS;
893 if (hints & HINT_BLOCK_SCOPE)
894 op->op_flags |= OPf_PARENS;
897 op = newOP(OP_STUB, 0);
907 if (op && op->op_flags & OPf_KIDS) {
908 for (kid = cLISTOP->op_first; kid; kid = kid->op_sibling)
924 if (!op || error_count)
927 switch (op->op_type) {
929 if (!(op->op_private & (OPpCONST_ARYBASE)))
931 if (eval_start && eval_start->op_type == OP_CONST) {
932 compiling.cop_arybase = (I32)SvIV(((SVOP*)eval_start)->op_sv);
936 SAVEI32(compiling.cop_arybase);
937 compiling.cop_arybase = 0;
939 else if (type == OP_REFGEN)
942 croak("That use of $[ is unsupported");
945 if (op->op_flags & OPf_PARENS)
949 if ((type == OP_UNDEF || type == OP_REFGEN) &&
950 !(op->op_flags & OPf_STACKED)) {
951 op->op_type = OP_RV2CV; /* entersub => rv2cv */
952 op->op_ppaddr = ppaddr[OP_RV2CV];
953 assert(cUNOP->op_first->op_type == OP_NULL);
954 null(((LISTOP*)cUNOP->op_first)->op_first); /* disable pushmark */
960 /* grep, foreach, subcalls, refgen */
961 if (type == OP_GREPSTART || type == OP_ENTERSUB || type == OP_REFGEN)
963 sprintf(tokenbuf, "Can't modify %s in %s",
964 op_desc[op->op_type],
965 type ? op_desc[type] : "local");
989 if (!(op->op_flags & OPf_STACKED))
995 for (kid = cUNOP->op_first->op_sibling; kid; kid = kid->op_sibling)
1001 if (type == OP_REFGEN && op->op_flags & OPf_PARENS) {
1003 return op; /* Treat \(@foo) like ordinary list. */
1007 ref(cUNOP->op_first, op->op_type);
1019 if (!type && cUNOP->op_first->op_type != OP_GV)
1020 croak("Can't localize a reference");
1021 ref(cUNOP->op_first, op->op_type);
1034 if (type == OP_REFGEN && op->op_flags & OPf_PARENS)
1035 return op; /* Treat \(@foo) like ordinary list. */
1040 croak("Can't localize lexical variable %s",
1041 SvPV(*av_fetch(comppad_name, op->op_targ, 4), na));
1048 if (type != OP_SASSIGN)
1054 pad_free(op->op_targ);
1055 op->op_targ = pad_alloc(op->op_type, SVs_PADMY);
1056 assert(SvTYPE(PAD_SV(op->op_targ)) == SVt_NULL);
1057 if (op->op_flags & OPf_KIDS)
1058 mod(cBINOP->op_first->op_sibling, type);
1063 ref(cBINOP->op_first, op->op_type);
1070 if (op->op_flags & OPf_KIDS)
1071 mod(cLISTOP->op_last, type);
1075 if (!(op->op_flags & OPf_KIDS))
1077 if (op->op_targ != OP_LIST) {
1078 mod(cBINOP->op_first, type);
1083 for (kid = cLISTOP->op_first; kid; kid = kid->op_sibling)
1087 op->op_flags |= OPf_MOD;
1089 if (type == OP_AASSIGN || type == OP_SASSIGN)
1090 op->op_flags |= OPf_SPECIAL|OPf_REF;
1092 op->op_private |= OPpLVAL_INTRO;
1093 op->op_flags &= ~OPf_SPECIAL;
1095 else if (type != OP_GREPSTART && type != OP_ENTERSUB)
1096 op->op_flags |= OPf_REF;
1106 if (op && op->op_flags & OPf_KIDS) {
1107 for (kid = cLISTOP->op_first; kid; kid = kid->op_sibling)
1120 if (!op || error_count)
1123 switch (op->op_type) {
1125 if ((type == OP_DEFINED) &&
1126 !(op->op_flags & OPf_STACKED)) {
1127 op->op_type = OP_RV2CV; /* entersub => rv2cv */
1128 op->op_ppaddr = ppaddr[OP_RV2CV];
1129 assert(cUNOP->op_first->op_type == OP_NULL);
1130 null(((LISTOP*)cUNOP->op_first)->op_first); /* disable pushmark */
1131 op->op_flags |= OPf_SPECIAL;
1136 for (kid = cUNOP->op_first->op_sibling; kid; kid = kid->op_sibling)
1140 ref(cUNOP->op_first, op->op_type);
1143 if (type == OP_RV2SV || type == OP_RV2AV || type == OP_RV2HV) {
1144 op->op_private |= (type == OP_RV2AV ? OPpDEREF_AV
1145 : type == OP_RV2HV ? OPpDEREF_HV
1147 op->op_flags |= OPf_MOD;
1153 op->op_flags |= OPf_REF;
1156 ref(cUNOP->op_first, op->op_type);
1161 op->op_flags |= OPf_REF;
1166 if (!(op->op_flags & OPf_KIDS))
1168 ref(cBINOP->op_first, type);
1172 ref(cBINOP->op_first, op->op_type);
1173 if (type == OP_RV2SV || type == OP_RV2AV || type == OP_RV2HV) {
1174 op->op_private |= (type == OP_RV2AV ? OPpDEREF_AV
1175 : type == OP_RV2HV ? OPpDEREF_HV
1177 op->op_flags |= OPf_MOD;
1185 if (!(op->op_flags & OPf_KIDS))
1187 ref(cLISTOP->op_last, type);
1203 if (!op || error_count)
1207 if (type == OP_LIST) {
1208 for (kid = cLISTOP->op_first; kid; kid = kid->op_sibling)
1211 else if (type != OP_PADSV &&
1214 type != OP_PUSHMARK)
1216 sprintf(tokenbuf, "Can't declare %s in my", op_desc[op->op_type]);
1220 op->op_flags |= OPf_MOD;
1221 op->op_private |= OPpLVAL_INTRO;
1230 o->op_flags |= OPf_PARENS;
1235 bind_match(type, left, right)
1242 if (right->op_type == OP_MATCH ||
1243 right->op_type == OP_SUBST ||
1244 right->op_type == OP_TRANS) {
1245 right->op_flags |= OPf_STACKED;
1246 if (right->op_type != OP_MATCH)
1247 left = mod(left, right->op_type);
1248 if (right->op_type == OP_TRANS)
1249 op = newBINOP(OP_NULL, OPf_STACKED, scalar(left), right);
1251 op = prepend_elem(right->op_type, scalar(left), right);
1253 return newUNOP(OP_NOT, 0, scalar(op));
1257 return bind_match(type, left,
1258 pmruntime(newPMOP(OP_MATCH, 0), right, Nullop));
1267 /* XXX need to optimize away NOT NOT here? Or do we let optimizer do it? */
1268 return newUNOP(OP_NOT, OPf_SPECIAL, scalar(op));
1276 if (o->op_flags & OPf_PARENS || perldb || tainting) {
1277 o = prepend_elem(OP_LINESEQ, newOP(OP_ENTER, 0), o);
1278 o->op_type = OP_LEAVE;
1279 o->op_ppaddr = ppaddr[OP_LEAVE];
1282 if (o->op_type == OP_LINESEQ) {
1284 o->op_type = OP_SCOPE;
1285 o->op_ppaddr = ppaddr[OP_SCOPE];
1286 kid = ((LISTOP*)o)->op_first;
1287 if (kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE){
1288 SvREFCNT_dec(((COP*)kid)->cop_filegv);
1293 o = newLISTOP(OP_SCOPE, 0, o, Nullop);
1303 int retval = savestack_ix;
1304 SAVEI32(comppad_name_floor);
1306 if ((comppad_name_fill = AvFILL(comppad_name)) > 0)
1307 comppad_name_floor = comppad_name_fill;
1309 comppad_name_floor = 0;
1311 SAVEI32(min_intro_pending);
1312 SAVEI32(max_intro_pending);
1313 min_intro_pending = 0;
1314 SAVEI32(comppad_name_fill);
1315 SAVEI32(padix_floor);
1316 padix_floor = padix;
1317 pad_reset_pending = FALSE;
1319 hints &= ~HINT_BLOCK_SCOPE;
1324 block_end(floor, seq)
1328 int needblockscope = hints & HINT_BLOCK_SCOPE;
1329 OP* retval = scalarseq(seq);
1331 pad_reset_pending = FALSE;
1333 hints |= HINT_BLOCK_SCOPE; /* propagate out */
1334 pad_leavemy(comppad_name_fill);
1344 eval_root = newUNOP(OP_LEAVEEVAL, ((in_eval & 4) ? OPf_SPECIAL : 0), op);
1345 eval_start = linklist(eval_root);
1346 eval_root->op_next = 0;
1354 main_root = scope(sawparens(scalarvoid(op)));
1355 curcop = &compiling;
1356 main_start = LINKLIST(main_root);
1357 main_root->op_next = 0;
1369 if (o->op_flags & OPf_PARENS)
1373 if (dowarn && bufptr > oldbufptr && bufptr[-1] == ',') {
1375 for (s = bufptr; *s && (isALNUM(*s) || strchr("@$%, ",*s)); s++) ;
1376 if (*s == ';' || *s == '=')
1377 warn("Parens missing around \"%s\" list", lex ? "my" : "local");
1384 return mod(o, OP_NULL); /* a bit kludgey */
1391 if (o->op_type == OP_LIST) {
1392 o = convert(OP_JOIN, 0,
1393 prepend_elem(OP_LIST,
1394 newSVREF(newGVOP(OP_GV, 0, gv_fetchpv(";", TRUE, SVt_PV))),
1405 I32 type = o->op_type;
1408 if (opargs[type] & OA_RETSCALAR)
1410 if (opargs[type] & OA_TARGET)
1411 o->op_targ = pad_alloc(type, SVs_PADTMP);
1413 if ((opargs[type] & OA_OTHERINT) && (hints & HINT_INTEGER))
1414 o->op_ppaddr = ppaddr[type = ++(o->op_type)];
1416 if (!(opargs[type] & OA_FOLDCONST))
1420 goto nope; /* Don't try to run w/ errors */
1422 for (curop = LINKLIST(o); curop != o; curop = LINKLIST(curop)) {
1423 if (curop->op_type != OP_CONST &&
1424 curop->op_type != OP_LIST &&
1425 curop->op_type != OP_SCALAR &&
1426 curop->op_type != OP_NULL &&
1427 curop->op_type != OP_PUSHMARK) {
1432 curop = LINKLIST(o);
1437 if (o->op_targ && sv == PAD_SV(o->op_targ)) /* grab pad temp? */
1438 pad_swipe(o->op_targ);
1439 else if (SvTEMP(sv)) { /* grab mortal temp? */
1440 (void)SvREFCNT_inc(sv);
1444 if (type == OP_RV2GV)
1445 return newGVOP(OP_GV, 0, (GV*)sv);
1447 if ((SvFLAGS(sv) & (SVf_IOK|SVf_NOK|SVf_POK)) == SVf_NOK) {
1449 if ((double)iv == SvNV(sv)) { /* can we smush double to int */
1454 SvIOK_off(sv); /* undo SvIV() damage */
1456 return newSVOP(OP_CONST, 0, sv);
1460 if (!(opargs[type] & OA_OTHERINT))
1463 if (!(hints & HINT_INTEGER)) {
1464 if (type == OP_DIVIDE || !(o->op_flags & OPf_KIDS))
1467 for (curop = ((UNOP*)o)->op_first; curop; curop = curop->op_sibling) {
1468 if (curop->op_type == OP_CONST) {
1469 if (SvIOK(((SVOP*)curop)->op_sv))
1473 if (opargs[curop->op_type] & OA_RETINTEGER)
1477 o->op_ppaddr = ppaddr[++(o->op_type)];
1484 gen_constant_list(o)
1488 I32 oldtmps_floor = tmps_floor;
1492 return o; /* Don't attempt to run with errors */
1494 op = curop = LINKLIST(o);
1500 tmps_floor = oldtmps_floor;
1502 o->op_type = OP_RV2AV;
1503 o->op_ppaddr = ppaddr[OP_RV2AV];
1504 curop = ((UNOP*)o)->op_first;
1505 ((UNOP*)o)->op_first = newSVOP(OP_CONST, 0, SvREFCNT_inc(*stack_sp--));
1512 convert(type, flags, op)
1520 if (!op || op->op_type != OP_LIST)
1521 op = newLISTOP(OP_LIST, 0, op, Nullop);
1523 op->op_flags &= ~(OPf_KNOW|OPf_LIST);
1525 if (!(opargs[type] & OA_MARK))
1526 null(cLISTOP->op_first);
1529 op->op_ppaddr = ppaddr[type];
1530 op->op_flags |= flags;
1532 op = CHECKOP(type, op);
1533 if (op->op_type != type)
1536 if (cLISTOP->op_children < 7) {
1537 /* XXX do we really need to do this if we're done appending?? */
1538 for (kid = cLISTOP->op_first; kid; kid = kid->op_sibling)
1540 cLISTOP->op_last = last; /* in case check substituted last arg */
1543 return fold_constants(op);
1546 /* List constructors */
1549 append_elem(type, first, last)
1560 if (first->op_type != type || type==OP_LIST && first->op_flags & OPf_PARENS)
1561 return newLISTOP(type, 0, first, last);
1563 if (first->op_flags & OPf_KIDS)
1564 ((LISTOP*)first)->op_last->op_sibling = last;
1566 first->op_flags |= OPf_KIDS;
1567 ((LISTOP*)first)->op_first = last;
1569 ((LISTOP*)first)->op_last = last;
1570 ((LISTOP*)first)->op_children++;
1575 append_list(type, first, last)
1586 if (first->op_type != type)
1587 return prepend_elem(type, (OP*)first, (OP*)last);
1589 if (last->op_type != type)
1590 return append_elem(type, (OP*)first, (OP*)last);
1592 first->op_last->op_sibling = last->op_first;
1593 first->op_last = last->op_last;
1594 first->op_children += last->op_children;
1595 if (first->op_children)
1596 last->op_flags |= OPf_KIDS;
1603 prepend_elem(type, first, last)
1614 if (last->op_type == type) {
1615 if (type == OP_LIST) { /* already a PUSHMARK there */
1616 first->op_sibling = ((LISTOP*)last)->op_first->op_sibling;
1617 ((LISTOP*)last)->op_first->op_sibling = first;
1620 if (!(last->op_flags & OPf_KIDS)) {
1621 ((LISTOP*)last)->op_last = first;
1622 last->op_flags |= OPf_KIDS;
1624 first->op_sibling = ((LISTOP*)last)->op_first;
1625 ((LISTOP*)last)->op_first = first;
1627 ((LISTOP*)last)->op_children++;
1631 return newLISTOP(type, 0, first, last);
1639 return newOP(OP_STUB, 0);
1646 if (!op || op->op_type != OP_LIST)
1647 op = newLISTOP(OP_LIST, 0, op, Nullop);
1653 newLISTOP(type, flags, first, last)
1661 Newz(1101, listop, 1, LISTOP);
1663 listop->op_type = type;
1664 listop->op_ppaddr = ppaddr[type];
1665 listop->op_children = (first != 0) + (last != 0);
1666 listop->op_flags = flags;
1670 else if (!first && last)
1673 first->op_sibling = last;
1674 listop->op_first = first;
1675 listop->op_last = last;
1676 if (type == OP_LIST) {
1678 pushop = newOP(OP_PUSHMARK, 0);
1679 pushop->op_sibling = first;
1680 listop->op_first = pushop;
1681 listop->op_flags |= OPf_KIDS;
1683 listop->op_last = pushop;
1685 else if (listop->op_children)
1686 listop->op_flags |= OPf_KIDS;
1697 Newz(1101, op, 1, OP);
1699 op->op_ppaddr = ppaddr[type];
1700 op->op_flags = flags;
1703 op->op_private = 0 + (flags >> 8);
1704 if (opargs[type] & OA_RETSCALAR)
1706 if (opargs[type] & OA_TARGET)
1707 op->op_targ = pad_alloc(type, SVs_PADTMP);
1708 return CHECKOP(type, op);
1712 newUNOP(type, flags, first)
1720 first = newOP(OP_STUB, 0);
1721 if (opargs[type] & OA_MARK)
1722 first = force_list(first);
1724 Newz(1101, unop, 1, UNOP);
1725 unop->op_type = type;
1726 unop->op_ppaddr = ppaddr[type];
1727 unop->op_first = first;
1728 unop->op_flags = flags | OPf_KIDS;
1729 unop->op_private = 1 | (flags >> 8);
1731 unop = (UNOP*) CHECKOP(type, unop);
1735 return fold_constants((OP *) unop);
1739 newBINOP(type, flags, first, last)
1746 Newz(1101, binop, 1, BINOP);
1749 first = newOP(OP_NULL, 0);
1751 binop->op_type = type;
1752 binop->op_ppaddr = ppaddr[type];
1753 binop->op_first = first;
1754 binop->op_flags = flags | OPf_KIDS;
1757 binop->op_private = 1 | (flags >> 8);
1760 binop->op_private = 2 | (flags >> 8);
1761 first->op_sibling = last;
1764 binop = (BINOP*)CHECKOP(type, binop);
1768 binop->op_last = last = binop->op_first->op_sibling;
1770 return fold_constants((OP *)binop);
1774 pmtrans(op, expr, repl)
1779 SV *tstr = ((SVOP*)expr)->op_sv;
1780 SV *rstr = ((SVOP*)repl)->op_sv;
1783 register U8 *t = (U8*)SvPV(tstr, tlen);
1784 register U8 *r = (U8*)SvPV(rstr, rlen);
1789 register short *tbl;
1791 tbl = (short*)cPVOP->op_pv;
1792 complement = op->op_private & OPpTRANS_COMPLEMENT;
1793 delete = op->op_private & OPpTRANS_DELETE;
1794 /* squash = op->op_private & OPpTRANS_SQUASH; */
1797 Zero(tbl, 256, short);
1798 for (i = 0; i < tlen; i++)
1800 for (i = 0, j = 0; i < 256; i++) {
1816 if (!rlen && !delete) {
1819 for (i = 0; i < 256; i++)
1821 for (i = 0, j = 0; i < tlen; i++,j++) {
1824 if (tbl[t[i]] == -1)
1830 if (tbl[t[i]] == -1)
1841 newPMOP(type, flags)
1847 Newz(1101, pmop, 1, PMOP);
1848 pmop->op_type = type;
1849 pmop->op_ppaddr = ppaddr[type];
1850 pmop->op_flags = flags;
1851 pmop->op_private = 0 | (flags >> 8);
1853 if (hints & HINT_LOCALE)
1854 pmop->op_pmpermflags = (pmop->op_pmflags |= PMf_LOCALE);
1856 /* link into pm list */
1857 if (type != OP_TRANS && curstash) {
1858 pmop->op_pmnext = HvPMROOT(curstash);
1859 HvPMROOT(curstash) = pmop;
1866 pmruntime(op, expr, repl)
1874 if (op->op_type == OP_TRANS)
1875 return pmtrans(op, expr, repl);
1879 if (expr->op_type == OP_CONST) {
1881 SV *pat = ((SVOP*)expr)->op_sv;
1882 char *p = SvPV(pat, plen);
1883 if ((op->op_flags & OPf_SPECIAL) && strEQ(p, " ")) {
1884 sv_setpvn(pat, "\\s+", 3);
1885 p = SvPV(pat, plen);
1886 pm->op_pmflags |= PMf_SKIPWHITE;
1888 pm->op_pmregexp = pregcomp(p, p + plen, pm);
1889 if (strEQ("\\s+", pm->op_pmregexp->precomp))
1890 pm->op_pmflags |= PMf_WHITE;
1895 if (pm->op_pmflags & PMf_KEEP)
1896 expr = newUNOP(OP_REGCMAYBE,0,expr);
1898 Newz(1101, rcop, 1, LOGOP);
1899 rcop->op_type = OP_REGCOMP;
1900 rcop->op_ppaddr = ppaddr[OP_REGCOMP];
1901 rcop->op_first = scalar(expr);
1902 rcop->op_flags |= OPf_KIDS;
1903 rcop->op_private = 1;
1904 rcop->op_other = op;
1906 /* establish postfix order */
1907 if (pm->op_pmflags & PMf_KEEP) {
1909 rcop->op_next = expr;
1910 ((UNOP*)expr)->op_first->op_next = (OP*)rcop;
1913 rcop->op_next = LINKLIST(expr);
1914 expr->op_next = (OP*)rcop;
1917 prepend_elem(op->op_type, scalar((OP*)rcop), op);
1922 if (pm->op_pmflags & PMf_EVAL)
1924 else if (repl->op_type == OP_CONST)
1928 for (curop = LINKLIST(repl); curop!=repl; curop = LINKLIST(curop)) {
1929 if (opargs[curop->op_type] & OA_DANGEROUS) {
1930 if (curop->op_type == OP_GV) {
1931 GV *gv = ((GVOP*)curop)->op_gv;
1932 if (strchr("&`'123456789+", *GvENAME(gv)))
1935 else if (curop->op_type == OP_RV2CV)
1937 else if (curop->op_type == OP_RV2SV ||
1938 curop->op_type == OP_RV2AV ||
1939 curop->op_type == OP_RV2HV ||
1940 curop->op_type == OP_RV2GV) {
1941 if (lastop && lastop->op_type != OP_GV) /*funny deref?*/
1944 else if (curop->op_type == OP_PADSV ||
1945 curop->op_type == OP_PADAV ||
1946 curop->op_type == OP_PADHV ||
1947 curop->op_type == OP_PADANY) {
1956 if (curop == repl) {
1957 pm->op_pmflags |= PMf_CONST; /* const for long enough */
1958 pm->op_pmpermflags |= PMf_CONST; /* const for long enough */
1959 prepend_elem(op->op_type, scalar(repl), op);
1962 Newz(1101, rcop, 1, LOGOP);
1963 rcop->op_type = OP_SUBSTCONT;
1964 rcop->op_ppaddr = ppaddr[OP_SUBSTCONT];
1965 rcop->op_first = scalar(repl);
1966 rcop->op_flags |= OPf_KIDS;
1967 rcop->op_private = 1;
1968 rcop->op_other = op;
1970 /* establish postfix order */
1971 rcop->op_next = LINKLIST(repl);
1972 repl->op_next = (OP*)rcop;
1974 pm->op_pmreplroot = scalar((OP*)rcop);
1975 pm->op_pmreplstart = LINKLIST(rcop);
1984 newSVOP(type, flags, sv)
1990 Newz(1101, svop, 1, SVOP);
1991 svop->op_type = type;
1992 svop->op_ppaddr = ppaddr[type];
1994 svop->op_next = (OP*)svop;
1995 svop->op_flags = flags;
1996 if (opargs[type] & OA_RETSCALAR)
1998 if (opargs[type] & OA_TARGET)
1999 svop->op_targ = pad_alloc(type, SVs_PADTMP);
2000 return CHECKOP(type, svop);
2004 newGVOP(type, flags, gv)
2010 Newz(1101, gvop, 1, GVOP);
2011 gvop->op_type = type;
2012 gvop->op_ppaddr = ppaddr[type];
2013 gvop->op_gv = (GV*)SvREFCNT_inc(gv);
2014 gvop->op_next = (OP*)gvop;
2015 gvop->op_flags = flags;
2016 if (opargs[type] & OA_RETSCALAR)
2018 if (opargs[type] & OA_TARGET)
2019 gvop->op_targ = pad_alloc(type, SVs_PADTMP);
2020 return CHECKOP(type, gvop);
2024 newPVOP(type, flags, pv)
2030 Newz(1101, pvop, 1, PVOP);
2031 pvop->op_type = type;
2032 pvop->op_ppaddr = ppaddr[type];
2034 pvop->op_next = (OP*)pvop;
2035 pvop->op_flags = flags;
2036 if (opargs[type] & OA_RETSCALAR)
2038 if (opargs[type] & OA_TARGET)
2039 pvop->op_targ = pad_alloc(type, SVs_PADTMP);
2040 return CHECKOP(type, pvop);
2049 save_hptr(&curstash);
2050 save_item(curstname);
2055 name = SvPV(sv, len);
2056 curstash = gv_stashpvn(name,len,TRUE);
2057 sv_setpvn(curstname, name, len);
2061 sv_setpv(curstname,"<none>");
2069 utilize(aver, floor, version, id, arg)
2082 if (id->op_type != OP_CONST)
2083 croak("Module name must be constant");
2087 if(version != Nullop) {
2088 SV *vesv = ((SVOP*)version)->op_sv;
2090 if (arg == Nullop && !SvNIOK(vesv)) {
2097 if (version->op_type != OP_CONST || !SvNIOK(vesv))
2098 croak("Version number must be constant number");
2100 /* Make copy of id so we don't free it twice */
2101 pack = newSVOP(OP_CONST, 0, newSVsv(((SVOP*)id)->op_sv));
2103 /* Fake up a method call to VERSION */
2104 meth = newSVOP(OP_CONST, 0, newSVpv("VERSION", 7));
2105 veop = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL,
2106 append_elem(OP_LIST,
2107 prepend_elem(OP_LIST, pack, list(version)),
2108 newUNOP(OP_METHOD, 0, meth)));
2112 /* Fake up an import/unimport */
2113 if (arg && arg->op_type == OP_STUB)
2114 imop = arg; /* no import on explicit () */
2115 else if(SvNIOK(((SVOP*)id)->op_sv)) {
2116 imop = Nullop; /* use 5.0; */
2119 /* Make copy of id so we don't free it twice */
2120 pack = newSVOP(OP_CONST, 0, newSVsv(((SVOP*)id)->op_sv));
2121 meth = newSVOP(OP_CONST, 0,
2123 ? newSVpv("import", 6)
2124 : newSVpv("unimport", 8)
2126 imop = convert(OP_ENTERSUB, OPf_STACKED|OPf_SPECIAL,
2127 append_elem(OP_LIST,
2128 prepend_elem(OP_LIST, pack, list(arg)),
2129 newUNOP(OP_METHOD, 0, meth)));
2132 /* Fake up a require */
2133 rqop = newUNOP(OP_REQUIRE, 0, id);
2135 /* Fake up the BEGIN {}, which does its thing immediately. */
2137 newSVOP(OP_CONST, 0, newSVpv("BEGIN", 5)),
2139 append_elem(OP_LINESEQ,
2140 append_elem(OP_LINESEQ,
2141 newSTATEOP(0, Nullch, rqop),
2142 newSTATEOP(0, Nullch, veop)),
2143 newSTATEOP(0, Nullch, imop) ));
2150 newSLICEOP(flags, subscript, listval)
2155 return newBINOP(OP_LSLICE, flags,
2156 list(force_list(subscript)),
2157 list(force_list(listval)) );
2167 if (op->op_type == OP_NULL && op->op_flags & OPf_KIDS)
2168 op = cUNOP->op_first;
2170 if (op->op_type == OP_COND_EXPR) {
2171 I32 t = list_assignment(cCONDOP->op_first->op_sibling);
2172 I32 f = list_assignment(cCONDOP->op_first->op_sibling->op_sibling);
2177 yyerror("Assignment to both a list and a scalar");
2181 if (op->op_type == OP_LIST || op->op_flags & OPf_PARENS ||
2182 op->op_type == OP_RV2AV || op->op_type == OP_RV2HV ||
2183 op->op_type == OP_ASLICE || op->op_type == OP_HSLICE)
2186 if (op->op_type == OP_PADAV || op->op_type == OP_PADHV)
2189 if (op->op_type == OP_RV2SV)
2196 newASSIGNOP(flags, left, optype, right)
2205 if (optype == OP_ANDASSIGN || optype == OP_ORASSIGN) {
2206 return newLOGOP(optype, 0,
2207 mod(scalar(left), optype),
2208 newUNOP(OP_SASSIGN, 0, scalar(right)));
2211 return newBINOP(optype, OPf_STACKED,
2212 mod(scalar(left), optype), scalar(right));
2216 if (list_assignment(left)) {
2218 eval_start = right; /* Grandfathering $[ assignment here. Bletch.*/
2219 left = mod(left, OP_AASSIGN);
2227 op = newBINOP(OP_AASSIGN, flags,
2228 list(force_list(right)),
2229 list(force_list(left)) );
2230 op->op_private = 0 | (flags >> 8);
2231 if (!(left->op_private & OPpLVAL_INTRO)) {
2232 static int generation = 100;
2236 for (curop = LINKLIST(op); curop != op; curop = LINKLIST(curop)) {
2237 if (opargs[curop->op_type] & OA_DANGEROUS) {
2238 if (curop->op_type == OP_GV) {
2239 GV *gv = ((GVOP*)curop)->op_gv;
2240 if (gv == defgv || SvCUR(gv) == generation)
2242 SvCUR(gv) = generation;
2244 else if (curop->op_type == OP_PADSV ||
2245 curop->op_type == OP_PADAV ||
2246 curop->op_type == OP_PADHV ||
2247 curop->op_type == OP_PADANY) {
2248 SV **svp = AvARRAY(comppad_name);
2249 SV *sv = svp[curop->op_targ];
2250 if (SvCUR(sv) == generation)
2252 SvCUR(sv) = generation; /* (SvCUR not used any more) */
2254 else if (curop->op_type == OP_RV2CV)
2256 else if (curop->op_type == OP_RV2SV ||
2257 curop->op_type == OP_RV2AV ||
2258 curop->op_type == OP_RV2HV ||
2259 curop->op_type == OP_RV2GV) {
2260 if (lastop->op_type != OP_GV) /* funny deref? */
2269 op->op_private = OPpASSIGN_COMMON;
2271 if (right && right->op_type == OP_SPLIT) {
2273 if ((tmpop = ((LISTOP*)right)->op_first) &&
2274 tmpop->op_type == OP_PUSHRE)
2276 PMOP *pm = (PMOP*)tmpop;
2277 if (left->op_type == OP_RV2AV &&
2278 !(left->op_private & OPpLVAL_INTRO) &&
2279 !(op->op_private & OPpASSIGN_COMMON) )
2281 tmpop = ((UNOP*)left)->op_first;
2282 if (tmpop->op_type == OP_GV && !pm->op_pmreplroot) {
2283 pm->op_pmreplroot = (OP*)((GVOP*)tmpop)->op_gv;
2284 pm->op_pmflags |= PMf_ONCE;
2285 tmpop = ((UNOP*)op)->op_first; /* to list (nulled) */
2286 tmpop = ((UNOP*)tmpop)->op_first; /* to pushmark */
2287 tmpop->op_sibling = Nullop; /* don't free split */
2288 right->op_next = tmpop->op_next; /* fix starting loc */
2289 op_free(op); /* blow off assign */
2290 right->op_flags &= ~(OPf_KNOW|OPf_LIST);
2291 /* "I don't know and I don't care." */
2296 if (modcount < 10000 &&
2297 ((LISTOP*)right)->op_last->op_type == OP_CONST)
2299 SV *sv = ((SVOP*)((LISTOP*)right)->op_last)->op_sv;
2301 sv_setiv(sv, modcount+1);
2309 right = newOP(OP_UNDEF, 0);
2310 if (right->op_type == OP_READLINE) {
2311 right->op_flags |= OPf_STACKED;
2312 return newBINOP(OP_NULL, flags, mod(scalar(left), OP_SASSIGN), scalar(right));
2315 eval_start = right; /* Grandfathering $[ assignment here. Bletch.*/
2316 op = newBINOP(OP_SASSIGN, flags,
2317 scalar(right), mod(scalar(left), OP_SASSIGN) );
2329 newSTATEOP(flags, label, op)
2334 U32 seq = intro_my();
2337 Newz(1101, cop, 1, COP);
2338 if (perldb && curcop->cop_line && curstash != debstash) {
2339 cop->op_type = OP_DBSTATE;
2340 cop->op_ppaddr = ppaddr[ OP_DBSTATE ];
2343 cop->op_type = OP_NEXTSTATE;
2344 cop->op_ppaddr = ppaddr[ OP_NEXTSTATE ];
2346 cop->op_flags = flags;
2347 cop->op_private = 0 | (flags >> 8);
2348 cop->op_next = (OP*)cop;
2351 cop->cop_label = label;
2352 hints |= HINT_BLOCK_SCOPE;
2355 cop->cop_arybase = curcop->cop_arybase;
2357 if (copline == NOLINE)
2358 cop->cop_line = curcop->cop_line;
2360 cop->cop_line = copline;
2363 cop->cop_filegv = GvREFCNT_inc(curcop->cop_filegv);
2364 cop->cop_stash = curstash;
2366 if (perldb && curstash != debstash) {
2367 SV **svp = av_fetch(GvAV(curcop->cop_filegv),(I32)cop->cop_line, FALSE);
2368 if (svp && *svp != &sv_undef && !SvIOK(*svp)) {
2369 (void)SvIOK_on(*svp);
2371 SvSTASH(*svp) = (HV*)cop;
2375 return prepend_elem(OP_LINESEQ, (OP*)cop, op);
2378 /* "Introduce" my variables to visible status. */
2386 if (! min_intro_pending)
2389 svp = AvARRAY(comppad_name);
2390 for (i = min_intro_pending; i <= max_intro_pending; i++) {
2391 if ((sv = svp[i]) && sv != &sv_undef && !SvIVX(sv)) {
2392 SvIVX(sv) = 999999999; /* Don't know scope end yet. */
2393 SvNVX(sv) = (double)cop_seqmax;
2396 min_intro_pending = 0;
2397 comppad_name_fill = max_intro_pending; /* Needn't search higher */
2398 return cop_seqmax++;
2402 newLOGOP(type, flags, first, other)
2411 if (type == OP_XOR) /* Not short circuit, but here by precedence. */
2412 return newBINOP(type, flags, scalar(first), scalar(other));
2414 scalarboolean(first);
2415 /* optimize "!a && b" to "a || b", and "!a || b" to "a && b" */
2416 if (first->op_type == OP_NOT && (first->op_flags & OPf_SPECIAL)) {
2417 if (type == OP_AND || type == OP_OR) {
2423 first = cUNOP->op_first;
2425 first->op_next = op->op_next;
2426 cUNOP->op_first = Nullop;
2430 if (first->op_type == OP_CONST) {
2431 if (dowarn && (first->op_private & OPpCONST_BARE))
2432 warn("Probable precedence problem on %s", op_desc[type]);
2433 if ((type == OP_AND) == (SvTRUE(((SVOP*)first)->op_sv))) {
2442 else if (first->op_type == OP_WANTARRAY) {
2448 else if (dowarn && (first->op_flags & OPf_KIDS)) {
2449 OP *k1 = ((UNOP*)first)->op_first;
2450 OP *k2 = k1->op_sibling;
2452 switch (first->op_type)
2455 if (k2 && k2->op_type == OP_READLINE
2456 && (k2->op_flags & OPf_STACKED)
2457 && (k1->op_type == OP_RV2SV || k1->op_type == OP_PADSV))
2458 warnop = k2->op_type;
2462 if (k1->op_type == OP_READDIR || k1->op_type == OP_GLOB)
2463 warnop = k1->op_type;
2467 warn("Value of %s may be \"0\"; use \"defined\"", op_desc[warnop]);
2473 if (type == OP_ANDASSIGN || type == OP_ORASSIGN)
2474 other->op_private |= OPpASSIGN_BACKWARDS; /* other is an OP_SASSIGN */
2476 Newz(1101, logop, 1, LOGOP);
2478 logop->op_type = type;
2479 logop->op_ppaddr = ppaddr[type];
2480 logop->op_first = first;
2481 logop->op_flags = flags | OPf_KIDS;
2482 logop->op_other = LINKLIST(other);
2483 logop->op_private = 1 | (flags >> 8);
2485 /* establish postfix order */
2486 logop->op_next = LINKLIST(first);
2487 first->op_next = (OP*)logop;
2488 first->op_sibling = other;
2490 op = newUNOP(OP_NULL, 0, (OP*)logop);
2491 other->op_next = op;
2497 newCONDOP(flags, first, trueop, falseop)
2507 return newLOGOP(OP_AND, 0, first, trueop);
2509 return newLOGOP(OP_OR, 0, first, falseop);
2511 scalarboolean(first);
2512 if (first->op_type == OP_CONST) {
2513 if (SvTRUE(((SVOP*)first)->op_sv)) {
2524 else if (first->op_type == OP_WANTARRAY) {
2528 Newz(1101, condop, 1, CONDOP);
2530 condop->op_type = OP_COND_EXPR;
2531 condop->op_ppaddr = ppaddr[OP_COND_EXPR];
2532 condop->op_first = first;
2533 condop->op_flags = flags | OPf_KIDS;
2534 condop->op_true = LINKLIST(trueop);
2535 condop->op_false = LINKLIST(falseop);
2536 condop->op_private = 1 | (flags >> 8);
2538 /* establish postfix order */
2539 condop->op_next = LINKLIST(first);
2540 first->op_next = (OP*)condop;
2542 first->op_sibling = trueop;
2543 trueop->op_sibling = falseop;
2544 op = newUNOP(OP_NULL, 0, (OP*)condop);
2546 trueop->op_next = op;
2547 falseop->op_next = op;
2553 newRANGE(flags, left, right)
2563 Newz(1101, condop, 1, CONDOP);
2565 condop->op_type = OP_RANGE;
2566 condop->op_ppaddr = ppaddr[OP_RANGE];
2567 condop->op_first = left;
2568 condop->op_flags = OPf_KIDS;
2569 condop->op_true = LINKLIST(left);
2570 condop->op_false = LINKLIST(right);
2571 condop->op_private = 1 | (flags >> 8);
2573 left->op_sibling = right;
2575 condop->op_next = (OP*)condop;
2576 flip = newUNOP(OP_FLIP, flags, (OP*)condop);
2577 flop = newUNOP(OP_FLOP, 0, flip);
2578 op = newUNOP(OP_NULL, 0, flop);
2581 left->op_next = flip;
2582 right->op_next = flop;
2584 condop->op_targ = pad_alloc(OP_RANGE, SVs_PADMY);
2585 sv_upgrade(PAD_SV(condop->op_targ), SVt_PVNV);
2586 flip->op_targ = pad_alloc(OP_RANGE, SVs_PADMY);
2587 sv_upgrade(PAD_SV(flip->op_targ), SVt_PVNV);
2589 flip->op_private = left->op_type == OP_CONST ? OPpFLIP_LINENUM : 0;
2590 flop->op_private = right->op_type == OP_CONST ? OPpFLIP_LINENUM : 0;
2593 if (!flip->op_private || !flop->op_private)
2594 linklist(op); /* blow off optimizer unless constant */
2600 newLOOPOP(flags, debuggable, expr, block)
2608 int once = block && block->op_flags & OPf_SPECIAL &&
2609 (block->op_type == OP_ENTERSUB || block->op_type == OP_NULL);
2612 if (once && expr->op_type == OP_CONST && !SvTRUE(((SVOP*)expr)->op_sv))
2613 return block; /* do {} while 0 does once */
2614 else if (expr->op_type == OP_READLINE || expr->op_type == OP_GLOB)
2615 expr = newASSIGNOP(0, newSVREF(newGVOP(OP_GV, 0, defgv)), 0, expr);
2618 listop = append_elem(OP_LINESEQ, block, newOP(OP_UNSTACK, 0));
2619 op = newLOGOP(OP_AND, 0, expr, listop);
2621 ((LISTOP*)listop)->op_last->op_next = LINKLIST(op);
2623 if (once && op != listop)
2624 op->op_next = ((LOGOP*)cUNOP->op_first)->op_other;
2627 op = newUNOP(OP_NULL, 0, op); /* or do {} while 1 loses outer block */
2629 op->op_flags |= flags;
2631 op->op_flags |= OPf_SPECIAL; /* suppress POPBLOCK curpm restoration*/
2636 newWHILEOP(flags, debuggable, loop, expr, block, cont)
2650 if (expr && (expr->op_type == OP_READLINE || expr->op_type == OP_GLOB)) {
2651 expr = newUNOP(OP_DEFINED, 0,
2652 newASSIGNOP(0, newSVREF(newGVOP(OP_GV, 0, defgv)), 0, expr) );
2656 block = newOP(OP_NULL, 0);
2659 next = LINKLIST(cont);
2661 cont = append_elem(OP_LINESEQ, cont, newOP(OP_UNSTACK, 0));
2663 listop = append_list(OP_LINESEQ, (LISTOP*)block, (LISTOP*)cont);
2664 redo = LINKLIST(listop);
2667 op = newLOGOP(OP_AND, 0, expr, scalar(listop));
2668 if (op == expr && op->op_type == OP_CONST && !SvTRUE(cSVOP->op_sv)) {
2669 op_free(expr); /* oops, it's a while (0) */
2671 return Nullop; /* (listop already freed by newLOGOP) */
2673 ((LISTOP*)listop)->op_last->op_next = condop =
2674 (op == listop ? redo : LINKLIST(op));
2682 Newz(1101,loop,1,LOOP);
2683 loop->op_type = OP_ENTERLOOP;
2684 loop->op_ppaddr = ppaddr[OP_ENTERLOOP];
2685 loop->op_private = 0;
2686 loop->op_next = (OP*)loop;
2689 op = newBINOP(OP_LEAVELOOP, 0, (OP*)loop, op);
2691 loop->op_redoop = redo;
2692 loop->op_lastop = op;
2695 loop->op_nextop = next;
2697 loop->op_nextop = op;
2699 op->op_flags |= flags;
2700 op->op_private |= (flags >> 8);
2705 #ifndef CAN_PROTOTYPE
2706 newFOROP(flags,label,forline,sv,expr,block,cont)
2715 newFOROP(I32 flags,char *label,line_t forline,OP *sv,OP *expr,OP *block,OP *cont)
2716 #endif /* CAN_PROTOTYPE */
2724 if (sv->op_type == OP_RV2SV) { /* symbol table variable */
2725 sv->op_type = OP_RV2GV;
2726 sv->op_ppaddr = ppaddr[OP_RV2GV];
2728 else if (sv->op_type == OP_PADSV) { /* private variable */
2729 padoff = sv->op_targ;
2734 croak("Can't use %s for loop variable", op_desc[sv->op_type]);
2737 sv = newGVOP(OP_GV, 0, defgv);
2739 if (expr->op_type == OP_RV2AV || expr->op_type == OP_PADAV) {
2740 expr = scalar(ref(expr, OP_ITER));
2741 iterflags |= OPf_STACKED;
2743 loop = (LOOP*)list(convert(OP_ENTERITER, iterflags,
2744 append_elem(OP_LIST, mod(force_list(expr), OP_GREPSTART),
2746 assert(!loop->op_next);
2747 Renew(loop, 1, LOOP);
2748 loop->op_targ = padoff;
2749 return newSTATEOP(0, label, newWHILEOP(flags, 1, loop,
2750 newOP(OP_ITER, 0), block, cont));
2754 newLOOPEX(type, label)
2759 if (type != OP_GOTO || label->op_type == OP_CONST) {
2760 op = newPVOP(type, 0, savepv(
2761 label->op_type == OP_CONST
2762 ? SvPVx(((SVOP*)label)->op_sv, na)
2767 if (label->op_type == OP_ENTERSUB)
2768 label = newUNOP(OP_REFGEN, 0, mod(label, OP_REFGEN));
2769 op = newUNOP(type, OPf_STACKED, label);
2771 hints |= HINT_BLOCK_SCOPE;
2779 if (!CvXSUB(cv) && CvROOT(cv)) {
2781 croak("Can't undef active subroutine");
2788 op_free(CvROOT(cv));
2789 CvROOT(cv) = Nullop;
2792 SvREFCNT_dec(CvGV(cv));
2794 SvREFCNT_dec(CvOUTSIDE(cv));
2795 CvOUTSIDE(cv) = Nullcv;
2796 if (CvPADLIST(cv)) {
2797 I32 i = AvFILL(CvPADLIST(cv));
2799 SV** svp = av_fetch(CvPADLIST(cv), i--, FALSE);
2803 SvREFCNT_dec((SV*)CvPADLIST(cv));
2804 CvPADLIST(cv) = Nullav;
2808 #ifdef DEBUG_CLOSURES
2813 CV *outside = CvOUTSIDE(cv);
2814 AV* padlist = CvPADLIST(cv);
2815 AV* pad_name = (AV*)*av_fetch(padlist, 0, FALSE);
2816 AV* pad = (AV*)*av_fetch(padlist, 1, FALSE);
2817 SV** pname = AvARRAY(pad_name);
2818 SV** ppad = AvARRAY(pad);
2821 PerlIO_printf(Perl_debug_log, "\tCV=0x%p (%s), OUTSIDE=0x%p (%s)\n",
2823 (CvANON(cv) ? "ANON"
2824 : (cv == main_cv) ? "MAIN"
2825 : CvUNIQUE(outside) ? "UNIQUE"
2826 : CvGV(cv) ? GvNAME(CvGV(cv)) : "?mystery?"),
2829 : CvANON(outside) ? "ANON"
2830 : (outside == main_cv) ? "MAIN"
2831 : CvUNIQUE(outside) ? "UNIQUE"
2832 : CvGV(outside) ? GvNAME(CvGV(outside)) : "?mystery?"));
2834 for (ix = 1; ix <= AvFILL(pad); ix++) {
2835 if (SvPOK(pname[ix]))
2836 PerlIO_printf(Perl_debug_log, "\t%4d. 0x%p (\"%s\" %ld-%ld)\n",
2837 ix, ppad[ix], SvPVX(pname[ix]),
2838 (long)I_32(SvNVX(pname[ix])),
2839 (long)SvIVX(pname[ix]));
2842 #endif /* DEBUG_CLOSURES */
2845 cv_clone2(proto, outside)
2851 AV* protopadlist = CvPADLIST(proto);
2852 AV* protopad_name = (AV*)*av_fetch(protopadlist, 0, FALSE);
2853 AV* protopad = (AV*)*av_fetch(protopadlist, 1, FALSE);
2854 SV** pname = AvARRAY(protopad_name);
2855 SV** ppad = AvARRAY(protopad);
2859 assert(!CvUNIQUE(proto));
2866 cv = compcv = (CV*)NEWSV(1104,0);
2867 sv_upgrade((SV *)cv, SVt_PVCV);
2872 CvFILEGV(cv) = CvFILEGV(proto);
2873 CvGV(cv) = GvREFCNT_inc(CvGV(proto));
2874 CvSTASH(cv) = CvSTASH(proto);
2875 CvROOT(cv) = CvROOT(proto);
2876 CvSTART(cv) = CvSTART(proto);
2878 CvOUTSIDE(cv) = (CV*)SvREFCNT_inc(outside);
2882 comppadlist = newAV();
2883 AvREAL_off(comppadlist);
2884 av_store(comppadlist, 0, SvREFCNT_inc((SV*)protopad_name));
2885 av_store(comppadlist, 1, (SV*)comppad);
2886 CvPADLIST(cv) = comppadlist;
2887 av_fill(comppad, AvFILL(protopad));
2888 curpad = AvARRAY(comppad);
2890 av = newAV(); /* will be @_ */
2892 av_store(comppad, 0, (SV*)av);
2893 AvFLAGS(av) = AVf_REIFY;
2895 for (ix = AvFILL(protopad); ix > 0; ix--) {
2897 if (pname[ix] != &sv_undef) {
2898 char *name = SvPVX(pname[ix]); /* XXX */
2899 if (SvFLAGS(pname[ix]) & SVf_FAKE) { /* lexical from outside? */
2900 I32 off = pad_findlex(name, ix, SvIVX(pname[ix]),
2901 CvOUTSIDE(cv), cxstack_ix);
2903 curpad[ix] = SvREFCNT_inc(ppad[ix]);
2905 croak("panic: cv_clone: %s", name);
2907 else { /* our own lexical */
2909 /* anon code -- we'll come back for it */
2910 sv = SvREFCNT_inc(ppad[ix]);
2912 else if (*name == '@')
2914 else if (*name == '%')
2930 /* Now that vars are all in place, clone nested closures. */
2932 for (ix = AvFILL(protopad); ix > 0; ix--) {
2933 if (pname[ix] != &sv_undef
2934 && !(SvFLAGS(pname[ix]) & SVf_FAKE)
2935 && *SvPVX(pname[ix]) == '&'
2936 && CvCLONE(ppad[ix]))
2938 CV *kid = cv_clone2((CV*)ppad[ix], cv);
2939 SvREFCNT_dec(ppad[ix]);
2942 curpad[ix] = (SV*)kid;
2946 #ifdef DEBUG_CLOSURES
2947 PerlIO_printf(Perl_debug_log, "Cloned inside:\n");
2949 PerlIO_printf(Perl_debug_log, " from:\n");
2951 PerlIO_printf(Perl_debug_log, " to:\n");
2963 return cv_clone2(proto, CvOUTSIDE(proto));
2973 if(cv && SvPOK(cv) && !SvCUR(cv)) {
2974 for (o = CvSTART(cv); o; o = o->op_next) {
2975 OPCODE type = o->op_type;
2977 if (type == OP_NEXTSTATE || type == OP_NULL || type == OP_PUSHMARK)
2979 if (type == OP_LEAVESUB || type == OP_RETURN)
2981 if (type != OP_CONST || sv)
2984 sv = ((SVOP*)o)->op_sv;
2991 newSUB(floor,op,proto,block)
2998 char *name = op ? SvPVx(cSVOP->op_sv, na) : "__ANON__";
2999 GV* gv = gv_fetchpv(name, GV_ADDMULTI, SVt_PVCV);
3006 if (cv = GvCV(gv)) {
3008 /* just a cached method */
3012 else if (CvROOT(cv) || CvXSUB(cv) || GvASSUMECV(gv)) {
3013 SV* const_sv = cv_const_sv(cv);
3015 char *p = proto ? SvPVx(((SVOP*)proto)->op_sv, na) : Nullch;
3017 if((!proto != !SvPOK(cv)) || (p && strNE(SvPV((SV*)cv,na), p))) {
3018 warn("Prototype mismatch: (%s) vs (%s)",
3019 SvPOK(cv) ? SvPV((SV*)cv,na) : "none",
3023 if ((const_sv || dowarn) && strNE(name, "BEGIN")) {/* already defined (or promised)? */
3024 line_t oldline = curcop->cop_line;
3026 curcop->cop_line = copline;
3027 warn(const_sv ? "Constant subroutine %s redefined"
3028 : "Subroutine %s redefined",name);
3029 curcop->cop_line = oldline;
3035 if (cv) { /* must reuse cv if autoloaded */
3037 CvFLAGS(cv) = (CvFLAGS(cv)&~CVf_CLONE) | (CvFLAGS(compcv)&CVf_CLONE);
3038 CvOUTSIDE(cv) = CvOUTSIDE(compcv);
3039 CvOUTSIDE(compcv) = 0;
3040 CvPADLIST(cv) = CvPADLIST(compcv);
3041 CvPADLIST(compcv) = 0;
3042 if (SvREFCNT(compcv) > 1) /* XXX Make closures transit through stub. */
3043 CvOUTSIDE(compcv) = (CV*)SvREFCNT_inc((SV*)cv);
3044 SvREFCNT_dec(compcv);
3051 CvFILEGV(cv) = curcop->cop_filegv;
3052 CvGV(cv) = GvREFCNT_inc(gv);
3053 CvSTASH(cv) = curstash;
3056 char *p = SvPVx(((SVOP*)proto)->op_sv, na);
3057 sv_setpv((SV*)cv, p);
3073 /* XXX: Named functions at file scope cannot be closures */
3074 if (op && CvUNIQUE(CvOUTSIDE(cv)))
3077 av = newAV(); /* Will be @_ */
3079 av_store(comppad, 0, (SV*)av);
3080 AvFLAGS(av) = AVf_REIFY;
3082 for (ix = AvFILL(comppad); ix > 0; ix--) {
3083 if (!SvPADMY(curpad[ix]))
3084 SvPADTMP_on(curpad[ix]);
3087 if (AvFILL(comppad_name) < AvFILL(comppad))
3088 av_store(comppad_name, AvFILL(comppad), Nullsv);
3090 CvROOT(cv) = newUNOP(OP_LEAVESUB, 0, scalarseq(block));
3091 CvSTART(cv) = LINKLIST(CvROOT(cv));
3092 CvROOT(cv)->op_next = 0;
3095 if (s = strrchr(name,':'))
3099 if (strEQ(s, "BEGIN") && !error_count) {
3101 SAVESPTR(compiling.cop_filegv);
3102 SAVEI16(compiling.cop_line);
3109 DEBUG_x( dump_sub(gv) );
3110 av_push(beginav, (SV *)cv);
3114 curcop = &compiling;
3117 else if (strEQ(s, "END") && !error_count) {
3120 av_unshift(endav, 1);
3121 av_store(endav, 0, (SV *)cv);
3125 if (perldb && curstash != debstash) {
3127 SV *tmpstr = sv_newmortal();
3128 static GV *db_postponed;
3132 sprintf(buf,"%s:%ld",SvPVX(GvSV(curcop->cop_filegv)), (long)subline);
3133 sv = newSVpv(buf,0);
3135 sprintf(buf,"%ld",(long)curcop->cop_line);
3137 gv_efullname3(tmpstr, gv, Nullch);
3138 hv_store(GvHV(DBsub), SvPVX(tmpstr), SvCUR(tmpstr), sv, 0);
3139 if (!db_postponed) {
3140 db_postponed = gv_fetchpv("DB::postponed", TRUE, SVt_PVHV);
3142 hv = GvHVn(db_postponed);
3143 if (HvFILL(hv) >= 0 && hv_exists(hv, SvPVX(tmpstr), SvCUR(tmpstr))
3144 && (cv = GvCV(db_postponed))) {
3149 perl_call_sv((SV*)cv, G_DISCARD);
3154 GvCV(gv) = 0; /* Will remember in SVOP instead. */
3165 newXSUB(name, ix, subaddr, filename)
3171 CV* cv = newXS(name, (void(*)())subaddr, filename);
3173 CvXSUBANY(cv).any_i32 = ix;
3179 newXS(name, subaddr, filename)
3181 void (*subaddr) _((CV*));
3185 GV *gv = gv_fetchpv((name ? name : "__ANON__"), GV_ADDMULTI, SVt_PVCV);
3190 if (cv = GvCV(gv)) {
3192 cv = 0; /* just a cached method */
3193 else if (CvROOT(cv) || CvXSUB(cv)) { /* already defined? */
3195 line_t oldline = curcop->cop_line;
3197 curcop->cop_line = copline;
3198 warn("Subroutine %s redefined",name);
3199 curcop->cop_line = oldline;
3205 if (cv) { /* must reuse cv if autoloaded */
3206 assert(SvREFCNT(CvGV(cv)) > 1);
3207 SvREFCNT_dec(CvGV(cv));
3210 cv = (CV*)NEWSV(1105,0);
3211 sv_upgrade((SV *)cv, SVt_PVCV);
3214 CvGV(cv) = GvREFCNT_inc(gv);
3216 CvFILEGV(cv) = gv_fetchfile(filename);
3217 CvXSUB(cv) = subaddr;
3220 else if (s = strrchr(name,':'))
3224 if (strEQ(s, "BEGIN")) {
3227 av_push(beginav, SvREFCNT_inc(gv));
3229 else if (strEQ(s, "END")) {
3232 av_unshift(endav, 1);
3233 av_store(endav, 0, SvREFCNT_inc(gv));
3236 GvCV(gv) = 0; /* Will remember elsewhere instead. */
3243 newFORM(floor,op,block)
3254 name = SvPVx(cSVOP->op_sv, na);
3257 gv = gv_fetchpv(name,TRUE, SVt_PVFM);
3259 if (cv = GvFORM(gv)) {
3261 line_t oldline = curcop->cop_line;
3263 curcop->cop_line = copline;
3264 warn("Format %s redefined",name);
3265 curcop->cop_line = oldline;
3271 CvGV(cv) = GvREFCNT_inc(gv);
3272 CvFILEGV(cv) = curcop->cop_filegv;
3274 for (ix = AvFILL(comppad); ix > 0; ix--) {
3275 if (!SvPADMY(curpad[ix]))
3276 SvPADTMP_on(curpad[ix]);
3279 CvROOT(cv) = newUNOP(OP_LEAVEWRITE, 0, scalarseq(block));
3280 CvSTART(cv) = LINKLIST(CvROOT(cv));
3281 CvROOT(cv)->op_next = 0;
3293 return newUNOP(OP_REFGEN, 0,
3294 mod(list(convert(OP_ANONLIST, 0, op)), OP_REFGEN));
3301 return newUNOP(OP_REFGEN, 0,
3302 mod(list(convert(OP_ANONHASH, 0, op)), OP_REFGEN));
3306 newANONSUB(floor, proto, block)
3311 return newUNOP(OP_REFGEN, 0,
3312 newSVOP(OP_ANONCODE, 0, (SV*)newSUB(floor, 0, proto, block)));
3319 switch (o->op_type) {
3321 o->op_type = OP_PADAV;
3322 o->op_ppaddr = ppaddr[OP_PADAV];
3323 return ref(newUNOP(OP_RV2AV, 0, scalar(o)), OP_RV2AV);
3326 o->op_type = OP_RV2AV;
3327 o->op_ppaddr = ppaddr[OP_RV2AV];
3332 warn("oops: oopsAV");
3342 switch (o->op_type) {
3345 o->op_type = OP_PADHV;
3346 o->op_ppaddr = ppaddr[OP_PADHV];
3347 return ref(newUNOP(OP_RV2HV, 0, scalar(o)), OP_RV2HV);
3351 o->op_type = OP_RV2HV;
3352 o->op_ppaddr = ppaddr[OP_RV2HV];
3357 warn("oops: oopsHV");
3367 if (o->op_type == OP_PADANY) {
3368 o->op_type = OP_PADAV;
3369 o->op_ppaddr = ppaddr[OP_PADAV];
3372 return newUNOP(OP_RV2AV, 0, scalar(o));
3380 if (type == OP_MAPSTART)
3381 return newUNOP(OP_NULL, 0, o);
3382 return ref(newUNOP(OP_RV2GV, OPf_REF, o), type);
3389 if (o->op_type == OP_PADANY) {
3390 o->op_type = OP_PADHV;
3391 o->op_ppaddr = ppaddr[OP_PADHV];
3394 return newUNOP(OP_RV2HV, 0, scalar(o));
3401 croak("NOT IMPL LINE %d",__LINE__);
3411 return newUNOP(OP_RV2CV, flags, scalar(o));
3418 if (o->op_type == OP_PADANY) {
3419 o->op_type = OP_PADSV;
3420 o->op_ppaddr = ppaddr[OP_PADSV];
3423 return newUNOP(OP_RV2SV, 0, scalar(o));
3426 /* Check routines. */
3435 name = NEWSV(1106,0);
3436 sv_upgrade(name, SVt_PVNV);
3437 sv_setpvn(name, "&", 1);
3440 ix = pad_alloc(op->op_type, SVs_PADMY);
3441 av_store(comppad_name, ix, name);
3442 av_store(comppad, ix, cSVOP->op_sv);
3443 SvPADMY_on(cSVOP->op_sv);
3444 cSVOP->op_sv = Nullsv;
3445 cSVOP->op_targ = ix;
3453 op->op_private = hints;
3461 if (cUNOP->op_first->op_type == OP_CONCAT)
3462 op->op_flags |= OPf_STACKED;
3470 if (op->op_flags & OPf_KIDS) {
3473 op = modkids(ck_fun(op), op->op_type);
3474 kid = cUNOP->op_first;
3475 newop = kUNOP->op_first->op_sibling;
3477 (newop->op_sibling ||
3478 !(opargs[newop->op_type] & OA_RETSCALAR) ||
3479 newop->op_type == OP_PADAV || newop->op_type == OP_PADHV ||
3480 newop->op_type == OP_RV2AV || newop->op_type == OP_RV2HV)) {
3484 op_free(kUNOP->op_first);
3485 kUNOP->op_first = newop;
3487 op->op_ppaddr = ppaddr[++op->op_type];
3497 if (op->op_flags & OPf_KIDS) {
3498 OP *kid = cUNOP->op_first;
3499 if (kid->op_type == OP_HSLICE)
3500 op->op_private |= OPpSLICE;
3501 else if (kid->op_type != OP_HELEM)
3502 croak("%s argument is not a HASH element or slice",
3503 op_desc[op->op_type]);
3513 I32 type = op->op_type;
3515 if (op->op_flags & OPf_KIDS) {
3516 if (cLISTOP->op_first->op_type == OP_STUB) {
3518 op = newUNOP(type, OPf_SPECIAL,
3519 newGVOP(OP_GV, 0, gv_fetchpv("main'ARGV", TRUE, SVt_PVAV)));
3530 hints |= HINT_BLOCK_SCOPE;
3531 if (op->op_flags & OPf_KIDS) {
3532 SVOP *kid = (SVOP*)cUNOP->op_first;
3535 op->op_flags &= ~OPf_KIDS;
3538 else if (kid->op_type == OP_LINESEQ) {
3541 kid->op_next = op->op_next;
3542 cUNOP->op_first = 0;
3545 Newz(1101, enter, 1, LOGOP);
3546 enter->op_type = OP_ENTERTRY;
3547 enter->op_ppaddr = ppaddr[OP_ENTERTRY];
3548 enter->op_private = 0;
3550 /* establish postfix order */
3551 enter->op_next = (OP*)enter;
3553 op = prepend_elem(OP_LINESEQ, (OP*)enter, (OP*)kid);
3554 op->op_type = OP_LEAVETRY;
3555 op->op_ppaddr = ppaddr[OP_LEAVETRY];
3556 enter->op_other = op;
3562 op = newUNOP(OP_ENTEREVAL, 0, newSVREF(newGVOP(OP_GV, 0, defgv)));
3564 op->op_targ = (PADOFFSET)hints;
3573 if (op->op_flags & OPf_STACKED) {
3575 kid = cUNOP->op_first->op_sibling;
3576 if (kid->op_type == OP_RV2GV)
3589 if (op->op_flags & OPf_KIDS) {
3590 OP *kid = cUNOP->op_first;
3591 if (kid->op_type != OP_HELEM)
3592 croak("%s argument is not a HASH element", op_desc[op->op_type]);
3602 o = fold_constants(o);
3603 if (o->op_type == OP_CONST)
3612 SVOP *kid = (SVOP*)cUNOP->op_first;
3614 op->op_private |= (hints & HINT_STRICT_REFS);
3615 if (kid->op_type == OP_CONST) {
3616 int iscv = (op->op_type==OP_RV2CV)*2;
3618 kid->op_type = OP_GV;
3619 for (gv = 0; !gv; iscv++) {
3621 * This is a little tricky. We only want to add the symbol if we
3622 * didn't add it in the lexer. Otherwise we get duplicate strict
3623 * warnings. But if we didn't add it in the lexer, we must at
3624 * least pretend like we wanted to add it even if it existed before,
3625 * or we get possible typo warnings. OPpCONST_ENTERED says
3626 * whether the lexer already added THIS instance of this symbol.
3628 gv = gv_fetchpv(SvPVx(kid->op_sv, na),
3629 iscv | !(kid->op_private & OPpCONST_ENTERED),
3632 : op->op_type == OP_RV2SV
3634 : op->op_type == OP_RV2AV
3636 : op->op_type == OP_RV2HV
3640 SvREFCNT_dec(kid->op_sv);
3641 kid->op_sv = SvREFCNT_inc(gv);
3650 I32 type = op->op_type;
3652 if (op->op_flags & OPf_REF)
3655 if (op->op_flags & OPf_KIDS) {
3656 SVOP *kid = (SVOP*)cUNOP->op_first;
3658 if (kid->op_type == OP_CONST && (kid->op_private & OPpCONST_BARE)) {
3659 OP *newop = newGVOP(type, OPf_REF,
3660 gv_fetchpv(SvPVx(kid->op_sv, na), TRUE, SVt_PVIO));
3667 if (type == OP_FTTTY)
3668 return newGVOP(type, OPf_REF, gv_fetchpv("main'STDIN", TRUE,
3671 return newUNOP(type, 0, newSVREF(newGVOP(OP_GV, 0, defgv)));
3684 int type = op->op_type;
3685 register I32 oa = opargs[type] >> OASHIFT;
3687 if (op->op_flags & OPf_STACKED) {
3688 if ((oa & OA_OPTIONAL) && (oa >> 4) && !((oa >> 4) & OA_OPTIONAL))
3691 return no_fh_allowed(op);
3694 if (op->op_flags & OPf_KIDS) {
3695 tokid = &cLISTOP->op_first;
3696 kid = cLISTOP->op_first;
3697 if (kid->op_type == OP_PUSHMARK ||
3698 kid->op_type == OP_NULL && kid->op_targ == OP_PUSHMARK)
3700 tokid = &kid->op_sibling;
3701 kid = kid->op_sibling;
3703 if (!kid && opargs[type] & OA_DEFGV)
3704 *tokid = kid = newSVREF(newGVOP(OP_GV, 0, defgv));
3708 sibl = kid->op_sibling;
3722 if (kid->op_type == OP_CONST &&
3723 (kid->op_private & OPpCONST_BARE)) {
3724 char *name = SvPVx(((SVOP*)kid)->op_sv, na);
3725 OP *newop = newAVREF(newGVOP(OP_GV, 0,
3726 gv_fetchpv(name, TRUE, SVt_PVAV) ));
3728 warn("Array @%s missing the @ in argument %d of %s()",
3729 name, numargs, op_desc[type]);
3732 kid->op_sibling = sibl;
3735 else if (kid->op_type != OP_RV2AV && kid->op_type != OP_PADAV)
3736 bad_type(numargs, "array", op_desc[op->op_type], kid);
3740 if (kid->op_type == OP_CONST &&
3741 (kid->op_private & OPpCONST_BARE)) {
3742 char *name = SvPVx(((SVOP*)kid)->op_sv, na);
3743 OP *newop = newHVREF(newGVOP(OP_GV, 0,
3744 gv_fetchpv(name, TRUE, SVt_PVHV) ));
3746 warn("Hash %%%s missing the %% in argument %d of %s()",
3747 name, numargs, op_desc[type]);
3750 kid->op_sibling = sibl;
3753 else if (kid->op_type != OP_RV2HV && kid->op_type != OP_PADHV)
3754 bad_type(numargs, "hash", op_desc[op->op_type], kid);
3759 OP *newop = newUNOP(OP_NULL, 0, kid);
3760 kid->op_sibling = 0;
3762 newop->op_next = newop;
3764 kid->op_sibling = sibl;
3769 if (kid->op_type != OP_GV) {
3770 if (kid->op_type == OP_CONST &&
3771 (kid->op_private & OPpCONST_BARE)) {
3772 OP *newop = newGVOP(OP_GV, 0,
3773 gv_fetchpv(SvPVx(((SVOP*)kid)->op_sv, na), TRUE,
3779 kid->op_sibling = 0;
3780 kid = newUNOP(OP_RV2GV, 0, scalar(kid));
3782 kid->op_sibling = sibl;
3788 mod(scalar(kid), type);
3792 tokid = &kid->op_sibling;
3793 kid = kid->op_sibling;
3795 op->op_private |= numargs;
3797 return too_many_arguments(op,op_desc[op->op_type]);
3800 else if (opargs[type] & OA_DEFGV) {
3802 return newUNOP(type, 0, newSVREF(newGVOP(OP_GV, 0, defgv)));
3806 while (oa & OA_OPTIONAL)
3808 if (oa && oa != OA_LIST)
3809 return too_few_arguments(op,op_desc[op->op_type]);
3818 GV *gv = gv_fetchpv("glob", FALSE, SVt_PVCV);
3820 if (gv && GvIMPORTED_CV(gv)) {
3821 op->op_type = OP_LIST;
3822 op->op_ppaddr = ppaddr[OP_LIST];
3823 op = newUNOP(OP_ENTERSUB, OPf_STACKED,
3824 append_elem(OP_LIST, op,
3825 scalar(newUNOP(OP_RV2CV, 0,
3826 newGVOP(OP_GV, 0, gv)))));
3829 gv = newGVgen("main");
3831 append_elem(OP_GLOB, op, newGVOP(OP_GV, 0, gv));
3842 OPCODE type = op->op_type == OP_GREPSTART ? OP_GREPWHILE : OP_MAPWHILE;
3844 op->op_ppaddr = ppaddr[OP_GREPSTART];
3845 Newz(1101, gwop, 1, LOGOP);
3847 if (op->op_flags & OPf_STACKED) {
3850 kid = cLISTOP->op_first->op_sibling;
3851 for (k = cLISTOP->op_first->op_sibling->op_next; k; k = k->op_next) {
3854 kid->op_next = (OP*)gwop;
3855 op->op_flags &= ~OPf_STACKED;
3857 kid = cLISTOP->op_first->op_sibling;
3858 if (type == OP_MAPWHILE)
3865 kid = cLISTOP->op_first->op_sibling;
3866 if (kid->op_type != OP_NULL)
3867 croak("panic: ck_grep");
3868 kid = kUNOP->op_first;
3870 gwop->op_type = type;
3871 gwop->op_ppaddr = ppaddr[type];
3872 gwop->op_first = listkids(op);
3873 gwop->op_flags |= OPf_KIDS;
3874 gwop->op_private = 1;
3875 gwop->op_other = LINKLIST(kid);
3876 gwop->op_targ = pad_alloc(type, SVs_PADTMP);
3877 kid->op_next = (OP*)gwop;
3879 kid = cLISTOP->op_first->op_sibling;
3880 if (!kid || !kid->op_sibling)
3881 return too_few_arguments(op,op_desc[op->op_type]);
3882 for (kid = kid->op_sibling; kid; kid = kid->op_sibling)
3883 mod(kid, OP_GREPSTART);
3892 if (op->op_flags & OPf_KIDS) {
3893 OP *kid = cLISTOP->op_first->op_sibling; /* get past pushmark */
3894 if (kid && kid->op_type == OP_CONST)
3895 fbm_compile(((SVOP*)kid)->op_sv);
3904 /* XXX length optimization goes here */
3912 return modkids(ck_fun(op), op->op_type);
3919 return refkids(ck_fun(op), op->op_type);
3928 kid = cLISTOP->op_first;
3930 op = force_list(op);
3931 kid = cLISTOP->op_first;
3933 if (kid->op_type == OP_PUSHMARK)
3934 kid = kid->op_sibling;
3935 if (kid && op->op_flags & OPf_STACKED)
3936 kid = kid->op_sibling;
3937 else if (kid && !kid->op_sibling) { /* print HANDLE; */
3938 if (kid->op_type == OP_CONST && kid->op_private & OPpCONST_BARE) {
3939 op->op_flags |= OPf_STACKED; /* make it a filehandle */
3940 kid = newUNOP(OP_RV2GV, OPf_REF, scalar(kid));
3941 cLISTOP->op_first->op_sibling = kid;
3942 cLISTOP->op_last = kid;
3943 kid = kid->op_sibling;
3948 append_elem(op->op_type, op, newSVREF(newGVOP(OP_GV, 0, defgv)) );
3954 if (hints & HINT_LOCALE)
3955 op->op_private |= OPpLOCALE;
3969 if (hints & HINT_LOCALE)
3970 op->op_private |= OPpLOCALE;
3982 if (hints & HINT_LOCALE)
3983 op->op_private |= OPpLOCALE;
3993 cPMOP->op_pmflags |= PMf_RUNTIME;
3994 cPMOP->op_pmpermflags |= PMf_RUNTIME;
4009 if (cBINOP->op_first->op_flags & OPf_PARENS) {
4010 op->op_private |= OPpREPEAT_DOLIST;
4011 cBINOP->op_first = force_list(cBINOP->op_first);
4022 if (op->op_flags & OPf_KIDS) { /* Shall we supply missing .pm? */
4023 SVOP *kid = (SVOP*)cUNOP->op_first;
4025 if (kid->op_type == OP_CONST && (kid->op_private & OPpCONST_BARE)) {
4027 for (s = SvPVX(kid->op_sv); *s; s++) {
4028 if (*s == ':' && s[1] == ':') {
4030 Move(s+2, s+1, strlen(s+2)+1, char);
4031 --SvCUR(kid->op_sv);
4034 sv_catpvn(kid->op_sv, ".pm", 3);
4044 croak("NOT IMPL LINE %d",__LINE__);
4054 if (op->op_flags & OPf_KIDS) {
4055 kid = cLISTOP->op_first->op_sibling; /* get past pushmark */
4056 if (kid && kid->op_sibling) {
4057 op->op_type = OP_SSELECT;
4058 op->op_ppaddr = ppaddr[OP_SSELECT];
4060 return fold_constants(op);
4064 kid = cLISTOP->op_first->op_sibling; /* get past pushmark */
4065 if (kid && kid->op_type == OP_RV2GV)
4066 kid->op_private &= ~HINT_STRICT_REFS;
4074 I32 type = op->op_type;
4076 if (!(op->op_flags & OPf_KIDS)) {
4078 return newUNOP(type, 0,
4079 scalar(newUNOP(OP_RV2AV, 0,
4080 scalar(newGVOP(OP_GV, 0, subline
4082 : gv_fetchpv("ARGV", TRUE, SVt_PVAV) )))));
4084 return scalar(modkids(ck_fun(op), type));
4093 if (hints & HINT_LOCALE)
4094 op->op_private |= OPpLOCALE;
4097 if (op->op_flags & OPf_STACKED) {
4098 OP *kid = cLISTOP->op_first->op_sibling; /* get past pushmark */
4100 kid = kUNOP->op_first; /* get past rv2gv */
4102 if (kid->op_type == OP_SCOPE || kid->op_type == OP_LEAVE) {
4104 if (kid->op_type == OP_SCOPE) {
4108 else if (kid->op_type == OP_LEAVE) {
4109 if (op->op_type == OP_SORT) {
4110 null(kid); /* wipe out leave */
4113 for (k = kLISTOP->op_first->op_next; k; k = k->op_next) {
4114 if (k->op_next == kid)
4119 kid->op_next = 0; /* just disconnect the leave */
4120 k = kLISTOP->op_first;
4124 kid = cLISTOP->op_first->op_sibling; /* get past pushmark */
4125 null(kid); /* wipe out rv2gv */
4126 if (op->op_type == OP_SORT)
4130 op->op_flags |= OPf_SPECIAL;
4144 if (op->op_flags & OPf_STACKED)
4145 return no_fh_allowed(op);
4147 kid = cLISTOP->op_first;
4148 if (kid->op_type != OP_NULL)
4149 croak("panic: ck_split");
4150 kid = kid->op_sibling;
4151 op_free(cLISTOP->op_first);
4152 cLISTOP->op_first = kid;
4154 cLISTOP->op_first = kid = newSVOP(OP_CONST, 0, newSVpv(" ", 1));
4155 cLISTOP->op_last = kid; /* There was only one element previously */
4158 if (kid->op_type != OP_MATCH) {
4159 OP *sibl = kid->op_sibling;
4160 kid->op_sibling = 0;
4161 kid = pmruntime( newPMOP(OP_MATCH, OPf_SPECIAL), kid, Nullop);
4162 if (cLISTOP->op_first == cLISTOP->op_last)
4163 cLISTOP->op_last = kid;
4164 cLISTOP->op_first = kid;
4165 kid->op_sibling = sibl;
4168 if (pm->op_pmshort && !(pm->op_pmflags & PMf_ALL)) {
4169 SvREFCNT_dec(pm->op_pmshort); /* can't use substring to optimize */
4173 kid->op_type = OP_PUSHRE;
4174 kid->op_ppaddr = ppaddr[OP_PUSHRE];
4177 if (!kid->op_sibling)
4178 append_elem(OP_SPLIT, op, newSVREF(newGVOP(OP_GV, 0, defgv)) );
4180 kid = kid->op_sibling;
4183 if (!kid->op_sibling)
4184 append_elem(OP_SPLIT, op, newSVOP(OP_CONST, 0, newSViv(0)));
4186 kid = kid->op_sibling;
4189 if (kid->op_sibling)
4190 return too_many_arguments(op,op_desc[op->op_type]);
4199 OP *prev = ((cUNOP->op_first->op_sibling)
4200 ? cUNOP : ((UNOP*)cUNOP->op_first))->op_first;
4201 OP *o = prev->op_sibling;
4208 for (cvop = o; cvop->op_sibling; cvop = cvop->op_sibling) ;
4209 if (cvop->op_type == OP_RV2CV) {
4211 op->op_private |= (cvop->op_private & OPpENTERSUB_AMPER);
4212 null(cvop); /* disable rv2cv */
4213 tmpop = (SVOP*)((UNOP*)cvop)->op_first;
4214 if (tmpop->op_type == OP_GV) {
4215 cv = GvCV(tmpop->op_sv);
4216 if (cv && SvPOK(cv) && !(op->op_private & OPpENTERSUB_AMPER))
4217 proto = SvPV((SV*)cv,na);
4220 op->op_private |= (hints & HINT_STRICT_REFS);
4221 if (perldb && curstash != debstash)
4222 op->op_private |= OPpENTERSUB_DB;
4227 return too_many_arguments(op, CvNAME(cv));
4245 if (o->op_type != OP_REFGEN && o->op_type != OP_UNDEF)
4246 bad_type(arg, "block", CvNAME(cv), o);
4251 if (o->op_type == OP_RV2GV)
4255 o = newUNOP(OP_RV2GV, 0, kid);
4256 o->op_sibling = kid->op_sibling;
4257 kid->op_sibling = 0;
4258 prev->op_sibling = o;
4266 if (o->op_type != OP_RV2GV)
4267 bad_type(arg, "symbol", CvNAME(cv), o);
4270 if (o->op_type != OP_RV2CV)
4271 bad_type(arg, "sub", CvNAME(cv), o);
4274 if (o->op_type != OP_RV2SV && o->op_type != OP_PADSV)
4275 bad_type(arg, "scalar", CvNAME(cv), o);
4278 if (o->op_type != OP_RV2AV && o->op_type != OP_PADAV)
4279 bad_type(arg, "array", CvNAME(cv), o);
4282 if (o->op_type != OP_RV2HV && o->op_type != OP_PADHV)
4283 bad_type(arg, "hash", CvNAME(cv), o);
4287 o = newUNOP(OP_REFGEN, 0, kid);
4288 o->op_sibling = kid->op_sibling;
4289 kid->op_sibling = 0;
4290 prev->op_sibling = o;
4301 croak("Malformed prototype for %s: %s",
4302 CvNAME(cv),SvPV((SV*)cv,na));
4307 mod(o, OP_ENTERSUB);
4311 if (proto && !optional && *proto == '$')
4312 return too_few_arguments(op, CvNAME(cv));
4320 SvREADONLY_on(cSVOP->op_sv);
4328 if (op->op_flags & OPf_KIDS) {
4329 SVOP *kid = (SVOP*)cUNOP->op_first;
4331 if (kid->op_type == OP_NULL)
4332 kid = (SVOP*)kid->op_sibling;
4334 kid->op_type == OP_CONST && (kid->op_private & OPpCONST_BARE))
4335 op->op_flags |= OPf_SPECIAL;
4340 /* A peephole optimizer. We visit the ops in the order they're to execute. */
4346 register OP* oldop = 0;
4347 if (!o || o->op_seq)
4352 for (; o; o = o->op_next) {
4358 switch (o->op_type) {
4361 curcop = ((COP*)o); /* for warnings */
4362 o->op_seq = op_seqmax++;
4373 if (o->op_next->op_type == OP_STRINGIFY)
4375 o->op_seq = op_seqmax++;
4378 if ((o->op_flags & (OPf_KNOW|OPf_LIST)) != (OPf_KNOW|OPf_LIST)) {
4379 o->op_seq = op_seqmax++;
4380 break; /* Scalar stub must produce undef. List stub is noop */
4384 if (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE)
4385 curcop = ((COP*)op);
4391 if (oldop && o->op_next) {
4392 oldop->op_next = o->op_next;
4395 o->op_seq = op_seqmax++;
4399 if (o->op_next->op_type == OP_RV2SV) {
4400 if (!(o->op_next->op_private & OPpDEREF)) {
4402 o->op_private |= o->op_next->op_private & OPpLVAL_INTRO;
4403 o->op_next = o->op_next->op_next;
4404 o->op_type = OP_GVSV;
4405 o->op_ppaddr = ppaddr[OP_GVSV];
4408 else if (o->op_next->op_type == OP_RV2AV) {
4409 OP* pop = o->op_next->op_next;
4411 if (pop->op_type == OP_CONST &&
4412 (op = pop->op_next) &&
4413 pop->op_next->op_type == OP_AELEM &&
4414 !(pop->op_next->op_private & (OPpDEREF|OPpLVAL_INTRO)) &&
4415 (i = SvIV(((SVOP*)pop)->op_sv) - compiling.cop_arybase)
4419 SvREFCNT_dec(((SVOP*)pop)->op_sv);
4423 o->op_flags |= pop->op_next->op_flags & OPf_MOD;
4424 o->op_next = pop->op_next->op_next;
4425 o->op_type = OP_AELEMFAST;
4426 o->op_ppaddr = ppaddr[OP_AELEMFAST];
4427 o->op_private = (U8)i;
4428 GvAVn(((GVOP*)o)->op_gv);
4431 o->op_seq = op_seqmax++;
4438 o->op_seq = op_seqmax++;
4439 peep(cLOGOP->op_other);
4443 o->op_seq = op_seqmax++;
4444 peep(cCONDOP->op_true);
4445 peep(cCONDOP->op_false);
4449 o->op_seq = op_seqmax++;
4450 peep(cLOOP->op_redoop);
4451 peep(cLOOP->op_nextop);
4452 peep(cLOOP->op_lastop);
4457 o->op_seq = op_seqmax++;
4458 peep(cPMOP->op_pmreplstart);
4462 o->op_seq = op_seqmax++;
4463 if (dowarn && o->op_next && o->op_next->op_type == OP_NEXTSTATE) {
4464 if (o->op_next->op_sibling &&
4465 o->op_next->op_sibling->op_type != OP_DIE) {
4466 line_t oldline = curcop->cop_line;
4468 curcop->cop_line = ((COP*)o->op_next)->cop_line;
4469 warn("Statement unlikely to be reached");
4470 warn("(Maybe you meant system() when you said exec()?)\n");
4471 curcop->cop_line = oldline;
4476 o->op_seq = op_seqmax++;