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 ? (op_free((OP*)op), croak("%s trapped by operation mask", op_desc[type]), (OP*)op=Nullop) \
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_ENTERSUB || type == OP_RV2HV || type == OP_PADHV)
108 warn("(Did you mean $ or @ instead of %c?)\n",
109 type == OP_ENTERSUB ? '&' : '%');
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 line_t oldline = curcop->cop_line;
2468 curcop->cop_line = copline;
2469 warn("Value of %s construct can be \"0\"; test with defined()",
2471 curcop->cop_line = oldline;
2478 if (type == OP_ANDASSIGN || type == OP_ORASSIGN)
2479 other->op_private |= OPpASSIGN_BACKWARDS; /* other is an OP_SASSIGN */
2481 Newz(1101, logop, 1, LOGOP);
2483 logop->op_type = type;
2484 logop->op_ppaddr = ppaddr[type];
2485 logop->op_first = first;
2486 logop->op_flags = flags | OPf_KIDS;
2487 logop->op_other = LINKLIST(other);
2488 logop->op_private = 1 | (flags >> 8);
2490 /* establish postfix order */
2491 logop->op_next = LINKLIST(first);
2492 first->op_next = (OP*)logop;
2493 first->op_sibling = other;
2495 op = newUNOP(OP_NULL, 0, (OP*)logop);
2496 other->op_next = op;
2502 newCONDOP(flags, first, trueop, falseop)
2512 return newLOGOP(OP_AND, 0, first, trueop);
2514 return newLOGOP(OP_OR, 0, first, falseop);
2516 scalarboolean(first);
2517 if (first->op_type == OP_CONST) {
2518 if (SvTRUE(((SVOP*)first)->op_sv)) {
2529 else if (first->op_type == OP_WANTARRAY) {
2533 Newz(1101, condop, 1, CONDOP);
2535 condop->op_type = OP_COND_EXPR;
2536 condop->op_ppaddr = ppaddr[OP_COND_EXPR];
2537 condop->op_first = first;
2538 condop->op_flags = flags | OPf_KIDS;
2539 condop->op_true = LINKLIST(trueop);
2540 condop->op_false = LINKLIST(falseop);
2541 condop->op_private = 1 | (flags >> 8);
2543 /* establish postfix order */
2544 condop->op_next = LINKLIST(first);
2545 first->op_next = (OP*)condop;
2547 first->op_sibling = trueop;
2548 trueop->op_sibling = falseop;
2549 op = newUNOP(OP_NULL, 0, (OP*)condop);
2551 trueop->op_next = op;
2552 falseop->op_next = op;
2558 newRANGE(flags, left, right)
2568 Newz(1101, condop, 1, CONDOP);
2570 condop->op_type = OP_RANGE;
2571 condop->op_ppaddr = ppaddr[OP_RANGE];
2572 condop->op_first = left;
2573 condop->op_flags = OPf_KIDS;
2574 condop->op_true = LINKLIST(left);
2575 condop->op_false = LINKLIST(right);
2576 condop->op_private = 1 | (flags >> 8);
2578 left->op_sibling = right;
2580 condop->op_next = (OP*)condop;
2581 flip = newUNOP(OP_FLIP, flags, (OP*)condop);
2582 flop = newUNOP(OP_FLOP, 0, flip);
2583 op = newUNOP(OP_NULL, 0, flop);
2586 left->op_next = flip;
2587 right->op_next = flop;
2589 condop->op_targ = pad_alloc(OP_RANGE, SVs_PADMY);
2590 sv_upgrade(PAD_SV(condop->op_targ), SVt_PVNV);
2591 flip->op_targ = pad_alloc(OP_RANGE, SVs_PADMY);
2592 sv_upgrade(PAD_SV(flip->op_targ), SVt_PVNV);
2594 flip->op_private = left->op_type == OP_CONST ? OPpFLIP_LINENUM : 0;
2595 flop->op_private = right->op_type == OP_CONST ? OPpFLIP_LINENUM : 0;
2598 if (!flip->op_private || !flop->op_private)
2599 linklist(op); /* blow off optimizer unless constant */
2605 newLOOPOP(flags, debuggable, expr, block)
2613 int once = block && block->op_flags & OPf_SPECIAL &&
2614 (block->op_type == OP_ENTERSUB || block->op_type == OP_NULL);
2617 if (once && expr->op_type == OP_CONST && !SvTRUE(((SVOP*)expr)->op_sv))
2618 return block; /* do {} while 0 does once */
2619 else if (expr->op_type == OP_READLINE || expr->op_type == OP_GLOB)
2620 expr = newASSIGNOP(0, newSVREF(newGVOP(OP_GV, 0, defgv)), 0, expr);
2623 listop = append_elem(OP_LINESEQ, block, newOP(OP_UNSTACK, 0));
2624 op = newLOGOP(OP_AND, 0, expr, listop);
2626 ((LISTOP*)listop)->op_last->op_next = LINKLIST(op);
2628 if (once && op != listop)
2629 op->op_next = ((LOGOP*)cUNOP->op_first)->op_other;
2632 op = newUNOP(OP_NULL, 0, op); /* or do {} while 1 loses outer block */
2634 op->op_flags |= flags;
2636 op->op_flags |= OPf_SPECIAL; /* suppress POPBLOCK curpm restoration*/
2641 newWHILEOP(flags, debuggable, loop, expr, block, cont)
2655 if (expr && (expr->op_type == OP_READLINE || expr->op_type == OP_GLOB)) {
2656 expr = newUNOP(OP_DEFINED, 0,
2657 newASSIGNOP(0, newSVREF(newGVOP(OP_GV, 0, defgv)), 0, expr) );
2661 block = newOP(OP_NULL, 0);
2664 next = LINKLIST(cont);
2666 cont = append_elem(OP_LINESEQ, cont, newOP(OP_UNSTACK, 0));
2668 listop = append_list(OP_LINESEQ, (LISTOP*)block, (LISTOP*)cont);
2669 redo = LINKLIST(listop);
2672 op = newLOGOP(OP_AND, 0, expr, scalar(listop));
2673 if (op == expr && op->op_type == OP_CONST && !SvTRUE(cSVOP->op_sv)) {
2674 op_free(expr); /* oops, it's a while (0) */
2676 return Nullop; /* (listop already freed by newLOGOP) */
2678 ((LISTOP*)listop)->op_last->op_next = condop =
2679 (op == listop ? redo : LINKLIST(op));
2687 Newz(1101,loop,1,LOOP);
2688 loop->op_type = OP_ENTERLOOP;
2689 loop->op_ppaddr = ppaddr[OP_ENTERLOOP];
2690 loop->op_private = 0;
2691 loop->op_next = (OP*)loop;
2694 op = newBINOP(OP_LEAVELOOP, 0, (OP*)loop, op);
2696 loop->op_redoop = redo;
2697 loop->op_lastop = op;
2700 loop->op_nextop = next;
2702 loop->op_nextop = op;
2704 op->op_flags |= flags;
2705 op->op_private |= (flags >> 8);
2710 #ifndef CAN_PROTOTYPE
2711 newFOROP(flags,label,forline,sv,expr,block,cont)
2720 newFOROP(I32 flags,char *label,line_t forline,OP *sv,OP *expr,OP *block,OP *cont)
2721 #endif /* CAN_PROTOTYPE */
2729 if (sv->op_type == OP_RV2SV) { /* symbol table variable */
2730 sv->op_type = OP_RV2GV;
2731 sv->op_ppaddr = ppaddr[OP_RV2GV];
2733 else if (sv->op_type == OP_PADSV) { /* private variable */
2734 padoff = sv->op_targ;
2739 croak("Can't use %s for loop variable", op_desc[sv->op_type]);
2742 sv = newGVOP(OP_GV, 0, defgv);
2744 if (expr->op_type == OP_RV2AV || expr->op_type == OP_PADAV) {
2745 expr = scalar(ref(expr, OP_ITER));
2746 iterflags |= OPf_STACKED;
2748 loop = (LOOP*)list(convert(OP_ENTERITER, iterflags,
2749 append_elem(OP_LIST, mod(force_list(expr), OP_GREPSTART),
2751 assert(!loop->op_next);
2752 Renew(loop, 1, LOOP);
2753 loop->op_targ = padoff;
2754 return newSTATEOP(0, label, newWHILEOP(flags, 1, loop,
2755 newOP(OP_ITER, 0), block, cont));
2759 newLOOPEX(type, label)
2764 if (type != OP_GOTO || label->op_type == OP_CONST) {
2765 op = newPVOP(type, 0, savepv(
2766 label->op_type == OP_CONST
2767 ? SvPVx(((SVOP*)label)->op_sv, na)
2772 if (label->op_type == OP_ENTERSUB)
2773 label = newUNOP(OP_REFGEN, 0, mod(label, OP_REFGEN));
2774 op = newUNOP(type, OPf_STACKED, label);
2776 hints |= HINT_BLOCK_SCOPE;
2784 if (!CvXSUB(cv) && CvROOT(cv)) {
2786 croak("Can't undef active subroutine");
2793 op_free(CvROOT(cv));
2794 CvROOT(cv) = Nullop;
2797 SvREFCNT_dec(CvGV(cv));
2799 SvREFCNT_dec(CvOUTSIDE(cv));
2800 CvOUTSIDE(cv) = Nullcv;
2801 if (CvPADLIST(cv)) {
2802 /* may be during global destruction */
2803 if (SvREFCNT(CvPADLIST(cv))) {
2804 I32 i = AvFILL(CvPADLIST(cv));
2806 SV** svp = av_fetch(CvPADLIST(cv), i--, FALSE);
2810 SvREFCNT_dec((SV*)CvPADLIST(cv));
2812 CvPADLIST(cv) = Nullav;
2816 #ifdef DEBUG_CLOSURES
2821 CV *outside = CvOUTSIDE(cv);
2822 AV* padlist = CvPADLIST(cv);
2823 AV* pad_name = (AV*)*av_fetch(padlist, 0, FALSE);
2824 AV* pad = (AV*)*av_fetch(padlist, 1, FALSE);
2825 SV** pname = AvARRAY(pad_name);
2826 SV** ppad = AvARRAY(pad);
2829 PerlIO_printf(Perl_debug_log, "\tCV=0x%p (%s), OUTSIDE=0x%p (%s)\n",
2831 (CvANON(cv) ? "ANON"
2832 : (cv == main_cv) ? "MAIN"
2833 : CvUNIQUE(outside) ? "UNIQUE"
2834 : CvGV(cv) ? GvNAME(CvGV(cv)) : "?mystery?"),
2837 : CvANON(outside) ? "ANON"
2838 : (outside == main_cv) ? "MAIN"
2839 : CvUNIQUE(outside) ? "UNIQUE"
2840 : CvGV(outside) ? GvNAME(CvGV(outside)) : "?mystery?"));
2842 for (ix = 1; ix <= AvFILL(pad); ix++) {
2843 if (SvPOK(pname[ix]))
2844 PerlIO_printf(Perl_debug_log, "\t%4d. 0x%p (\"%s\" %ld-%ld)\n",
2845 ix, ppad[ix], SvPVX(pname[ix]),
2846 (long)I_32(SvNVX(pname[ix])),
2847 (long)SvIVX(pname[ix]));
2850 #endif /* DEBUG_CLOSURES */
2853 cv_clone2(proto, outside)
2859 AV* protopadlist = CvPADLIST(proto);
2860 AV* protopad_name = (AV*)*av_fetch(protopadlist, 0, FALSE);
2861 AV* protopad = (AV*)*av_fetch(protopadlist, 1, FALSE);
2862 SV** pname = AvARRAY(protopad_name);
2863 SV** ppad = AvARRAY(protopad);
2867 assert(!CvUNIQUE(proto));
2874 cv = compcv = (CV*)NEWSV(1104,0);
2875 sv_upgrade((SV *)cv, SVt_PVCV);
2880 CvFILEGV(cv) = CvFILEGV(proto);
2881 CvGV(cv) = GvREFCNT_inc(CvGV(proto));
2882 CvSTASH(cv) = CvSTASH(proto);
2883 CvROOT(cv) = CvROOT(proto);
2884 CvSTART(cv) = CvSTART(proto);
2886 CvOUTSIDE(cv) = (CV*)SvREFCNT_inc(outside);
2890 comppadlist = newAV();
2891 AvREAL_off(comppadlist);
2892 av_store(comppadlist, 0, SvREFCNT_inc((SV*)protopad_name));
2893 av_store(comppadlist, 1, (SV*)comppad);
2894 CvPADLIST(cv) = comppadlist;
2895 av_fill(comppad, AvFILL(protopad));
2896 curpad = AvARRAY(comppad);
2898 av = newAV(); /* will be @_ */
2900 av_store(comppad, 0, (SV*)av);
2901 AvFLAGS(av) = AVf_REIFY;
2903 for (ix = AvFILL(protopad); ix > 0; ix--) {
2905 if (pname[ix] != &sv_undef) {
2906 char *name = SvPVX(pname[ix]); /* XXX */
2907 if (SvFLAGS(pname[ix]) & SVf_FAKE) { /* lexical from outside? */
2908 I32 off = pad_findlex(name, ix, SvIVX(pname[ix]),
2909 CvOUTSIDE(cv), cxstack_ix);
2911 curpad[ix] = SvREFCNT_inc(ppad[ix]);
2913 croak("panic: cv_clone: %s", name);
2915 else { /* our own lexical */
2917 /* anon code -- we'll come back for it */
2918 sv = SvREFCNT_inc(ppad[ix]);
2920 else if (*name == '@')
2922 else if (*name == '%')
2938 /* Now that vars are all in place, clone nested closures. */
2940 for (ix = AvFILL(protopad); ix > 0; ix--) {
2941 if (pname[ix] != &sv_undef
2942 && !(SvFLAGS(pname[ix]) & SVf_FAKE)
2943 && *SvPVX(pname[ix]) == '&'
2944 && CvCLONE(ppad[ix]))
2946 CV *kid = cv_clone2((CV*)ppad[ix], cv);
2947 SvREFCNT_dec(ppad[ix]);
2950 curpad[ix] = (SV*)kid;
2954 #ifdef DEBUG_CLOSURES
2955 PerlIO_printf(Perl_debug_log, "Cloned inside:\n");
2957 PerlIO_printf(Perl_debug_log, " from:\n");
2959 PerlIO_printf(Perl_debug_log, " to:\n");
2971 return cv_clone2(proto, CvOUTSIDE(proto));
2981 if(cv && SvPOK(cv) && !SvCUR(cv)) {
2982 for (o = CvSTART(cv); o; o = o->op_next) {
2983 OPCODE type = o->op_type;
2985 if (type == OP_NEXTSTATE || type == OP_NULL || type == OP_PUSHMARK)
2987 if (type == OP_LEAVESUB || type == OP_RETURN)
2989 if (type != OP_CONST || sv)
2992 sv = ((SVOP*)o)->op_sv;
2999 newSUB(floor,op,proto,block)
3006 char *name = op ? SvPVx(cSVOP->op_sv, na) : "__ANON__";
3007 GV* gv = gv_fetchpv(name, GV_ADDMULTI, SVt_PVCV);
3016 if (cv = GvCV(gv)) {
3018 /* just a cached method */
3022 else if (CvROOT(cv) || CvXSUB(cv) || GvASSUMECV(gv)) {
3023 SV* const_sv = cv_const_sv(cv);
3025 char *p = proto ? SvPVx(((SVOP*)proto)->op_sv, na) : Nullch;
3027 if((!proto != !SvPOK(cv)) || (p && strNE(SvPV((SV*)cv,na), p))) {
3028 warn("Prototype mismatch: (%s) vs (%s)",
3029 SvPOK(cv) ? SvPV((SV*)cv,na) : "none",
3033 if ((const_sv || dowarn) && strNE(name, "BEGIN")) {/* already defined (or promised)? */
3034 line_t oldline = curcop->cop_line;
3036 curcop->cop_line = copline;
3037 warn(const_sv ? "Constant subroutine %s redefined"
3038 : "Subroutine %s redefined",name);
3039 curcop->cop_line = oldline;
3045 if (cv) { /* must reuse cv if autoloaded */
3047 CvFLAGS(cv) = (CvFLAGS(cv)&~CVf_CLONE) | (CvFLAGS(compcv)&CVf_CLONE);
3048 CvOUTSIDE(cv) = CvOUTSIDE(compcv);
3049 CvOUTSIDE(compcv) = 0;
3050 CvPADLIST(cv) = CvPADLIST(compcv);
3051 CvPADLIST(compcv) = 0;
3052 if (SvREFCNT(compcv) > 1) /* XXX Make closures transit through stub. */
3053 CvOUTSIDE(compcv) = (CV*)SvREFCNT_inc((SV*)cv);
3054 SvREFCNT_dec(compcv);
3061 CvFILEGV(cv) = curcop->cop_filegv;
3062 CvGV(cv) = GvREFCNT_inc(gv);
3063 CvSTASH(cv) = curstash;
3066 char *p = SvPVx(((SVOP*)proto)->op_sv, na);
3067 sv_setpv((SV*)cv, p);
3082 /* XXX: Named functions at file scope cannot be closures */
3083 if (op && CvUNIQUE(CvOUTSIDE(cv)))
3086 av = newAV(); /* Will be @_ */
3088 av_store(comppad, 0, (SV*)av);
3089 AvFLAGS(av) = AVf_REIFY;
3091 for (ix = AvFILL(comppad); ix > 0; ix--) {
3092 if (!SvPADMY(curpad[ix]))
3093 SvPADTMP_on(curpad[ix]);
3096 if (AvFILL(comppad_name) < AvFILL(comppad))
3097 av_store(comppad_name, AvFILL(comppad), Nullsv);
3099 CvROOT(cv) = newUNOP(OP_LEAVESUB, 0, scalarseq(block));
3100 CvSTART(cv) = LINKLIST(CvROOT(cv));
3101 CvROOT(cv)->op_next = 0;
3104 if (s = strrchr(name,':'))
3108 if (strEQ(s, "BEGIN") && !error_count) {
3110 SAVESPTR(compiling.cop_filegv);
3111 SAVEI16(compiling.cop_line);
3118 DEBUG_x( dump_sub(gv) );
3119 av_push(beginav, (SV *)cv);
3123 curcop = &compiling;
3126 else if (strEQ(s, "END") && !error_count) {
3129 av_unshift(endav, 1);
3130 av_store(endav, 0, (SV *)cv);
3134 if (perldb && curstash != debstash) {
3136 SV *tmpstr = sv_newmortal();
3137 static GV *db_postponed;
3141 sprintf(buf,"%s:%ld",SvPVX(GvSV(curcop->cop_filegv)), (long)subline);
3142 sv = newSVpv(buf,0);
3144 sprintf(buf,"%ld",(long)curcop->cop_line);
3146 gv_efullname3(tmpstr, gv, Nullch);
3147 hv_store(GvHV(DBsub), SvPVX(tmpstr), SvCUR(tmpstr), sv, 0);
3148 if (!db_postponed) {
3149 db_postponed = gv_fetchpv("DB::postponed", TRUE, SVt_PVHV);
3151 hv = GvHVn(db_postponed);
3152 if (HvFILL(hv) >= 0 && hv_exists(hv, SvPVX(tmpstr), SvCUR(tmpstr))
3153 && (cv = GvCV(db_postponed))) {
3158 perl_call_sv((SV*)cv, G_DISCARD);
3163 GvCV(gv) = 0; /* Will remember in SVOP instead. */
3173 newXSUB(name, ix, subaddr, filename)
3179 CV* cv = newXS(name, (void(*)())subaddr, filename);
3181 CvXSUBANY(cv).any_i32 = ix;
3187 newXS(name, subaddr, filename)
3189 void (*subaddr) _((CV*));
3193 GV *gv = gv_fetchpv((name ? name : "__ANON__"), GV_ADDMULTI, SVt_PVCV);
3198 if (cv = GvCV(gv)) {
3200 cv = 0; /* just a cached method */
3201 else if (CvROOT(cv) || CvXSUB(cv)) { /* already defined? */
3203 line_t oldline = curcop->cop_line;
3205 curcop->cop_line = copline;
3206 warn("Subroutine %s redefined",name);
3207 curcop->cop_line = oldline;
3213 if (cv) { /* must reuse cv if autoloaded */
3214 assert(SvREFCNT(CvGV(cv)) > 1);
3215 SvREFCNT_dec(CvGV(cv));
3218 cv = (CV*)NEWSV(1105,0);
3219 sv_upgrade((SV *)cv, SVt_PVCV);
3222 CvGV(cv) = GvREFCNT_inc(gv);
3224 CvFILEGV(cv) = gv_fetchfile(filename);
3225 CvXSUB(cv) = subaddr;
3228 else if (s = strrchr(name,':'))
3232 if (strEQ(s, "BEGIN")) {
3235 av_push(beginav, SvREFCNT_inc(gv));
3237 else if (strEQ(s, "END")) {
3240 av_unshift(endav, 1);
3241 av_store(endav, 0, SvREFCNT_inc(gv));
3244 GvCV(gv) = 0; /* Will remember elsewhere instead. */
3251 newFORM(floor,op,block)
3262 name = SvPVx(cSVOP->op_sv, na);
3265 gv = gv_fetchpv(name,TRUE, SVt_PVFM);
3267 if (cv = GvFORM(gv)) {
3269 line_t oldline = curcop->cop_line;
3271 curcop->cop_line = copline;
3272 warn("Format %s redefined",name);
3273 curcop->cop_line = oldline;
3279 CvGV(cv) = GvREFCNT_inc(gv);
3280 CvFILEGV(cv) = curcop->cop_filegv;
3282 for (ix = AvFILL(comppad); ix > 0; ix--) {
3283 if (!SvPADMY(curpad[ix]))
3284 SvPADTMP_on(curpad[ix]);
3287 CvROOT(cv) = newUNOP(OP_LEAVEWRITE, 0, scalarseq(block));
3288 CvSTART(cv) = LINKLIST(CvROOT(cv));
3289 CvROOT(cv)->op_next = 0;
3301 return newUNOP(OP_REFGEN, 0,
3302 mod(list(convert(OP_ANONLIST, 0, op)), OP_REFGEN));
3309 return newUNOP(OP_REFGEN, 0,
3310 mod(list(convert(OP_ANONHASH, 0, op)), OP_REFGEN));
3314 newANONSUB(floor, proto, block)
3319 return newUNOP(OP_REFGEN, 0,
3320 newSVOP(OP_ANONCODE, 0, (SV*)newSUB(floor, 0, proto, block)));
3327 switch (o->op_type) {
3329 o->op_type = OP_PADAV;
3330 o->op_ppaddr = ppaddr[OP_PADAV];
3331 return ref(newUNOP(OP_RV2AV, 0, scalar(o)), OP_RV2AV);
3334 o->op_type = OP_RV2AV;
3335 o->op_ppaddr = ppaddr[OP_RV2AV];
3340 warn("oops: oopsAV");
3350 switch (o->op_type) {
3353 o->op_type = OP_PADHV;
3354 o->op_ppaddr = ppaddr[OP_PADHV];
3355 return ref(newUNOP(OP_RV2HV, 0, scalar(o)), OP_RV2HV);
3359 o->op_type = OP_RV2HV;
3360 o->op_ppaddr = ppaddr[OP_RV2HV];
3365 warn("oops: oopsHV");
3375 if (o->op_type == OP_PADANY) {
3376 o->op_type = OP_PADAV;
3377 o->op_ppaddr = ppaddr[OP_PADAV];
3380 return newUNOP(OP_RV2AV, 0, scalar(o));
3388 if (type == OP_MAPSTART)
3389 return newUNOP(OP_NULL, 0, o);
3390 return ref(newUNOP(OP_RV2GV, OPf_REF, o), type);
3397 if (o->op_type == OP_PADANY) {
3398 o->op_type = OP_PADHV;
3399 o->op_ppaddr = ppaddr[OP_PADHV];
3402 return newUNOP(OP_RV2HV, 0, scalar(o));
3409 croak("NOT IMPL LINE %d",__LINE__);
3419 return newUNOP(OP_RV2CV, flags, scalar(o));
3426 if (o->op_type == OP_PADANY) {
3427 o->op_type = OP_PADSV;
3428 o->op_ppaddr = ppaddr[OP_PADSV];
3431 return newUNOP(OP_RV2SV, 0, scalar(o));
3434 /* Check routines. */
3443 name = NEWSV(1106,0);
3444 sv_upgrade(name, SVt_PVNV);
3445 sv_setpvn(name, "&", 1);
3448 ix = pad_alloc(op->op_type, SVs_PADMY);
3449 av_store(comppad_name, ix, name);
3450 av_store(comppad, ix, cSVOP->op_sv);
3451 SvPADMY_on(cSVOP->op_sv);
3452 cSVOP->op_sv = Nullsv;
3453 cSVOP->op_targ = ix;
3461 op->op_private = hints;
3469 if (cUNOP->op_first->op_type == OP_CONCAT)
3470 op->op_flags |= OPf_STACKED;
3478 if (op->op_flags & OPf_KIDS) {
3481 OPCODE type = op->op_type;
3482 op = modkids(ck_fun(op), type);
3483 kid = cUNOP->op_first;
3484 newop = kUNOP->op_first->op_sibling;
3486 (newop->op_sibling ||
3487 !(opargs[newop->op_type] & OA_RETSCALAR) ||
3488 newop->op_type == OP_PADAV || newop->op_type == OP_PADHV ||
3489 newop->op_type == OP_RV2AV || newop->op_type == OP_RV2HV)) {
3493 op_free(kUNOP->op_first);
3494 kUNOP->op_first = newop;
3496 op->op_ppaddr = ppaddr[++op->op_type];
3506 if (op->op_flags & OPf_KIDS) {
3507 OP *kid = cUNOP->op_first;
3508 if (kid->op_type == OP_HSLICE)
3509 op->op_private |= OPpSLICE;
3510 else if (kid->op_type != OP_HELEM)
3511 croak("%s argument is not a HASH element or slice",
3512 op_desc[op->op_type]);
3522 I32 type = op->op_type;
3524 if (op->op_flags & OPf_KIDS) {
3525 if (cLISTOP->op_first->op_type == OP_STUB) {
3527 op = newUNOP(type, OPf_SPECIAL,
3528 newGVOP(OP_GV, 0, gv_fetchpv("main'ARGV", TRUE, SVt_PVAV)));
3539 hints |= HINT_BLOCK_SCOPE;
3540 if (op->op_flags & OPf_KIDS) {
3541 SVOP *kid = (SVOP*)cUNOP->op_first;
3544 op->op_flags &= ~OPf_KIDS;
3547 else if (kid->op_type == OP_LINESEQ) {
3550 kid->op_next = op->op_next;
3551 cUNOP->op_first = 0;
3554 Newz(1101, enter, 1, LOGOP);
3555 enter->op_type = OP_ENTERTRY;
3556 enter->op_ppaddr = ppaddr[OP_ENTERTRY];
3557 enter->op_private = 0;
3559 /* establish postfix order */
3560 enter->op_next = (OP*)enter;
3562 op = prepend_elem(OP_LINESEQ, (OP*)enter, (OP*)kid);
3563 op->op_type = OP_LEAVETRY;
3564 op->op_ppaddr = ppaddr[OP_LEAVETRY];
3565 enter->op_other = op;
3571 op = newUNOP(OP_ENTEREVAL, 0, newSVREF(newGVOP(OP_GV, 0, defgv)));
3573 op->op_targ = (PADOFFSET)hints;
3582 if (op->op_flags & OPf_STACKED) {
3584 kid = cUNOP->op_first->op_sibling;
3585 if (kid->op_type == OP_RV2GV)
3598 if (op->op_flags & OPf_KIDS) {
3599 OP *kid = cUNOP->op_first;
3600 if (kid->op_type != OP_HELEM)
3601 croak("%s argument is not a HASH element", op_desc[op->op_type]);
3611 o = fold_constants(o);
3612 if (o->op_type == OP_CONST)
3621 SVOP *kid = (SVOP*)cUNOP->op_first;
3623 op->op_private |= (hints & HINT_STRICT_REFS);
3624 if (kid->op_type == OP_CONST) {
3625 int iscv = (op->op_type==OP_RV2CV)*2;
3627 kid->op_type = OP_GV;
3628 for (gv = 0; !gv; iscv++) {
3630 * This is a little tricky. We only want to add the symbol if we
3631 * didn't add it in the lexer. Otherwise we get duplicate strict
3632 * warnings. But if we didn't add it in the lexer, we must at
3633 * least pretend like we wanted to add it even if it existed before,
3634 * or we get possible typo warnings. OPpCONST_ENTERED says
3635 * whether the lexer already added THIS instance of this symbol.
3637 gv = gv_fetchpv(SvPVx(kid->op_sv, na),
3638 iscv | !(kid->op_private & OPpCONST_ENTERED),
3641 : op->op_type == OP_RV2SV
3643 : op->op_type == OP_RV2AV
3645 : op->op_type == OP_RV2HV
3649 SvREFCNT_dec(kid->op_sv);
3650 kid->op_sv = SvREFCNT_inc(gv);
3659 I32 type = op->op_type;
3661 if (op->op_flags & OPf_REF)
3664 if (op->op_flags & OPf_KIDS) {
3665 SVOP *kid = (SVOP*)cUNOP->op_first;
3667 if (kid->op_type == OP_CONST && (kid->op_private & OPpCONST_BARE)) {
3668 OP *newop = newGVOP(type, OPf_REF,
3669 gv_fetchpv(SvPVx(kid->op_sv, na), TRUE, SVt_PVIO));
3676 if (type == OP_FTTTY)
3677 return newGVOP(type, OPf_REF, gv_fetchpv("main'STDIN", TRUE,
3680 return newUNOP(type, 0, newSVREF(newGVOP(OP_GV, 0, defgv)));
3693 int type = op->op_type;
3694 register I32 oa = opargs[type] >> OASHIFT;
3696 if (op->op_flags & OPf_STACKED) {
3697 if ((oa & OA_OPTIONAL) && (oa >> 4) && !((oa >> 4) & OA_OPTIONAL))
3700 return no_fh_allowed(op);
3703 if (op->op_flags & OPf_KIDS) {
3704 tokid = &cLISTOP->op_first;
3705 kid = cLISTOP->op_first;
3706 if (kid->op_type == OP_PUSHMARK ||
3707 kid->op_type == OP_NULL && kid->op_targ == OP_PUSHMARK)
3709 tokid = &kid->op_sibling;
3710 kid = kid->op_sibling;
3712 if (!kid && opargs[type] & OA_DEFGV)
3713 *tokid = kid = newSVREF(newGVOP(OP_GV, 0, defgv));
3717 sibl = kid->op_sibling;
3731 if (kid->op_type == OP_CONST &&
3732 (kid->op_private & OPpCONST_BARE)) {
3733 char *name = SvPVx(((SVOP*)kid)->op_sv, na);
3734 OP *newop = newAVREF(newGVOP(OP_GV, 0,
3735 gv_fetchpv(name, TRUE, SVt_PVAV) ));
3737 warn("Array @%s missing the @ in argument %d of %s()",
3738 name, numargs, op_desc[type]);
3741 kid->op_sibling = sibl;
3744 else if (kid->op_type != OP_RV2AV && kid->op_type != OP_PADAV)
3745 bad_type(numargs, "array", op_desc[op->op_type], kid);
3749 if (kid->op_type == OP_CONST &&
3750 (kid->op_private & OPpCONST_BARE)) {
3751 char *name = SvPVx(((SVOP*)kid)->op_sv, na);
3752 OP *newop = newHVREF(newGVOP(OP_GV, 0,
3753 gv_fetchpv(name, TRUE, SVt_PVHV) ));
3755 warn("Hash %%%s missing the %% in argument %d of %s()",
3756 name, numargs, op_desc[type]);
3759 kid->op_sibling = sibl;
3762 else if (kid->op_type != OP_RV2HV && kid->op_type != OP_PADHV)
3763 bad_type(numargs, "hash", op_desc[op->op_type], kid);
3768 OP *newop = newUNOP(OP_NULL, 0, kid);
3769 kid->op_sibling = 0;
3771 newop->op_next = newop;
3773 kid->op_sibling = sibl;
3778 if (kid->op_type != OP_GV) {
3779 if (kid->op_type == OP_CONST &&
3780 (kid->op_private & OPpCONST_BARE)) {
3781 OP *newop = newGVOP(OP_GV, 0,
3782 gv_fetchpv(SvPVx(((SVOP*)kid)->op_sv, na), TRUE,
3788 kid->op_sibling = 0;
3789 kid = newUNOP(OP_RV2GV, 0, scalar(kid));
3791 kid->op_sibling = sibl;
3797 mod(scalar(kid), type);
3801 tokid = &kid->op_sibling;
3802 kid = kid->op_sibling;
3804 op->op_private |= numargs;
3806 return too_many_arguments(op,op_desc[op->op_type]);
3809 else if (opargs[type] & OA_DEFGV) {
3811 return newUNOP(type, 0, newSVREF(newGVOP(OP_GV, 0, defgv)));
3815 while (oa & OA_OPTIONAL)
3817 if (oa && oa != OA_LIST)
3818 return too_few_arguments(op,op_desc[op->op_type]);
3827 GV *gv = gv_fetchpv("glob", FALSE, SVt_PVCV);
3829 if (gv && GvIMPORTED_CV(gv)) {
3830 op->op_type = OP_LIST;
3831 op->op_ppaddr = ppaddr[OP_LIST];
3832 op = newUNOP(OP_ENTERSUB, OPf_STACKED,
3833 append_elem(OP_LIST, op,
3834 scalar(newUNOP(OP_RV2CV, 0,
3835 newGVOP(OP_GV, 0, gv)))));
3838 gv = newGVgen("main");
3840 append_elem(OP_GLOB, op, newGVOP(OP_GV, 0, gv));
3851 OPCODE type = op->op_type == OP_GREPSTART ? OP_GREPWHILE : OP_MAPWHILE;
3853 op->op_ppaddr = ppaddr[OP_GREPSTART];
3854 Newz(1101, gwop, 1, LOGOP);
3856 if (op->op_flags & OPf_STACKED) {
3859 kid = cLISTOP->op_first->op_sibling;
3860 for (k = cLISTOP->op_first->op_sibling->op_next; k; k = k->op_next) {
3863 kid->op_next = (OP*)gwop;
3864 op->op_flags &= ~OPf_STACKED;
3866 kid = cLISTOP->op_first->op_sibling;
3867 if (type == OP_MAPWHILE)
3874 kid = cLISTOP->op_first->op_sibling;
3875 if (kid->op_type != OP_NULL)
3876 croak("panic: ck_grep");
3877 kid = kUNOP->op_first;
3879 gwop->op_type = type;
3880 gwop->op_ppaddr = ppaddr[type];
3881 gwop->op_first = listkids(op);
3882 gwop->op_flags |= OPf_KIDS;
3883 gwop->op_private = 1;
3884 gwop->op_other = LINKLIST(kid);
3885 gwop->op_targ = pad_alloc(type, SVs_PADTMP);
3886 kid->op_next = (OP*)gwop;
3888 kid = cLISTOP->op_first->op_sibling;
3889 if (!kid || !kid->op_sibling)
3890 return too_few_arguments(op,op_desc[op->op_type]);
3891 for (kid = kid->op_sibling; kid; kid = kid->op_sibling)
3892 mod(kid, OP_GREPSTART);
3901 if (op->op_flags & OPf_KIDS) {
3902 OP *kid = cLISTOP->op_first->op_sibling; /* get past pushmark */
3903 if (kid && kid->op_type == OP_CONST)
3904 fbm_compile(((SVOP*)kid)->op_sv);
3913 /* XXX length optimization goes here */
3921 OPCODE type = op->op_type;
3922 return modkids(ck_fun(op), type);
3929 OPCODE type = op->op_type;
3930 return refkids(ck_fun(op), type);
3939 kid = cLISTOP->op_first;
3941 op = force_list(op);
3942 kid = cLISTOP->op_first;
3944 if (kid->op_type == OP_PUSHMARK)
3945 kid = kid->op_sibling;
3946 if (kid && op->op_flags & OPf_STACKED)
3947 kid = kid->op_sibling;
3948 else if (kid && !kid->op_sibling) { /* print HANDLE; */
3949 if (kid->op_type == OP_CONST && kid->op_private & OPpCONST_BARE) {
3950 op->op_flags |= OPf_STACKED; /* make it a filehandle */
3951 kid = newUNOP(OP_RV2GV, OPf_REF, scalar(kid));
3952 cLISTOP->op_first->op_sibling = kid;
3953 cLISTOP->op_last = kid;
3954 kid = kid->op_sibling;
3959 append_elem(op->op_type, op, newSVREF(newGVOP(OP_GV, 0, defgv)) );
3965 if (hints & HINT_LOCALE)
3966 op->op_private |= OPpLOCALE;
3980 if (hints & HINT_LOCALE)
3981 op->op_private |= OPpLOCALE;
3993 if (hints & HINT_LOCALE)
3994 op->op_private |= OPpLOCALE;
4004 cPMOP->op_pmflags |= PMf_RUNTIME;
4005 cPMOP->op_pmpermflags |= PMf_RUNTIME;
4020 if (cBINOP->op_first->op_flags & OPf_PARENS) {
4021 op->op_private |= OPpREPEAT_DOLIST;
4022 cBINOP->op_first = force_list(cBINOP->op_first);
4033 if (op->op_flags & OPf_KIDS) { /* Shall we supply missing .pm? */
4034 SVOP *kid = (SVOP*)cUNOP->op_first;
4036 if (kid->op_type == OP_CONST && (kid->op_private & OPpCONST_BARE)) {
4038 for (s = SvPVX(kid->op_sv); *s; s++) {
4039 if (*s == ':' && s[1] == ':') {
4041 Move(s+2, s+1, strlen(s+2)+1, char);
4042 --SvCUR(kid->op_sv);
4045 sv_catpvn(kid->op_sv, ".pm", 3);
4055 croak("NOT IMPL LINE %d",__LINE__);
4065 if (op->op_flags & OPf_KIDS) {
4066 kid = cLISTOP->op_first->op_sibling; /* get past pushmark */
4067 if (kid && kid->op_sibling) {
4068 op->op_type = OP_SSELECT;
4069 op->op_ppaddr = ppaddr[OP_SSELECT];
4071 return fold_constants(op);
4075 kid = cLISTOP->op_first->op_sibling; /* get past pushmark */
4076 if (kid && kid->op_type == OP_RV2GV)
4077 kid->op_private &= ~HINT_STRICT_REFS;
4085 I32 type = op->op_type;
4087 if (!(op->op_flags & OPf_KIDS)) {
4089 return newUNOP(type, 0,
4090 scalar(newUNOP(OP_RV2AV, 0,
4091 scalar(newGVOP(OP_GV, 0, subline
4093 : gv_fetchpv("ARGV", TRUE, SVt_PVAV) )))));
4095 return scalar(modkids(ck_fun(op), type));
4104 if (hints & HINT_LOCALE)
4105 op->op_private |= OPpLOCALE;
4108 if (op->op_flags & OPf_STACKED) {
4109 OP *kid = cLISTOP->op_first->op_sibling; /* get past pushmark */
4111 kid = kUNOP->op_first; /* get past rv2gv */
4113 if (kid->op_type == OP_SCOPE || kid->op_type == OP_LEAVE) {
4115 if (kid->op_type == OP_SCOPE) {
4119 else if (kid->op_type == OP_LEAVE) {
4120 if (op->op_type == OP_SORT) {
4121 null(kid); /* wipe out leave */
4124 for (k = kLISTOP->op_first->op_next; k; k = k->op_next) {
4125 if (k->op_next == kid)
4130 kid->op_next = 0; /* just disconnect the leave */
4131 k = kLISTOP->op_first;
4135 kid = cLISTOP->op_first->op_sibling; /* get past pushmark */
4136 null(kid); /* wipe out rv2gv */
4137 if (op->op_type == OP_SORT)
4141 op->op_flags |= OPf_SPECIAL;
4155 if (op->op_flags & OPf_STACKED)
4156 return no_fh_allowed(op);
4158 kid = cLISTOP->op_first;
4159 if (kid->op_type != OP_NULL)
4160 croak("panic: ck_split");
4161 kid = kid->op_sibling;
4162 op_free(cLISTOP->op_first);
4163 cLISTOP->op_first = kid;
4165 cLISTOP->op_first = kid = newSVOP(OP_CONST, 0, newSVpv(" ", 1));
4166 cLISTOP->op_last = kid; /* There was only one element previously */
4169 if (kid->op_type != OP_MATCH) {
4170 OP *sibl = kid->op_sibling;
4171 kid->op_sibling = 0;
4172 kid = pmruntime( newPMOP(OP_MATCH, OPf_SPECIAL), kid, Nullop);
4173 if (cLISTOP->op_first == cLISTOP->op_last)
4174 cLISTOP->op_last = kid;
4175 cLISTOP->op_first = kid;
4176 kid->op_sibling = sibl;
4179 if (pm->op_pmshort && !(pm->op_pmflags & PMf_ALL)) {
4180 SvREFCNT_dec(pm->op_pmshort); /* can't use substring to optimize */
4184 kid->op_type = OP_PUSHRE;
4185 kid->op_ppaddr = ppaddr[OP_PUSHRE];
4188 if (!kid->op_sibling)
4189 append_elem(OP_SPLIT, op, newSVREF(newGVOP(OP_GV, 0, defgv)) );
4191 kid = kid->op_sibling;
4194 if (!kid->op_sibling)
4195 append_elem(OP_SPLIT, op, newSVOP(OP_CONST, 0, newSViv(0)));
4197 kid = kid->op_sibling;
4200 if (kid->op_sibling)
4201 return too_many_arguments(op,op_desc[op->op_type]);
4210 OP *prev = ((cUNOP->op_first->op_sibling)
4211 ? cUNOP : ((UNOP*)cUNOP->op_first))->op_first;
4212 OP *o = prev->op_sibling;
4219 for (cvop = o; cvop->op_sibling; cvop = cvop->op_sibling) ;
4220 if (cvop->op_type == OP_RV2CV) {
4222 op->op_private |= (cvop->op_private & OPpENTERSUB_AMPER);
4223 null(cvop); /* disable rv2cv */
4224 tmpop = (SVOP*)((UNOP*)cvop)->op_first;
4225 if (tmpop->op_type == OP_GV) {
4226 cv = GvCVu(tmpop->op_sv);
4227 if (cv && SvPOK(cv) && !(op->op_private & OPpENTERSUB_AMPER))
4228 proto = SvPV((SV*)cv,na);
4231 op->op_private |= (hints & HINT_STRICT_REFS);
4232 if (perldb && curstash != debstash)
4233 op->op_private |= OPpENTERSUB_DB;
4238 return too_many_arguments(op, CvNAME(cv));
4256 if (o->op_type != OP_REFGEN && o->op_type != OP_UNDEF)
4257 bad_type(arg, "block", CvNAME(cv), o);
4262 if (o->op_type == OP_RV2GV)
4266 o = newUNOP(OP_RV2GV, 0, kid);
4267 o->op_sibling = kid->op_sibling;
4268 kid->op_sibling = 0;
4269 prev->op_sibling = o;
4277 if (o->op_type != OP_RV2GV)
4278 bad_type(arg, "symbol", CvNAME(cv), o);
4281 if (o->op_type != OP_RV2CV)
4282 bad_type(arg, "sub", CvNAME(cv), o);
4285 if (o->op_type != OP_RV2SV && o->op_type != OP_PADSV)
4286 bad_type(arg, "scalar", CvNAME(cv), o);
4289 if (o->op_type != OP_RV2AV && o->op_type != OP_PADAV)
4290 bad_type(arg, "array", CvNAME(cv), o);
4293 if (o->op_type != OP_RV2HV && o->op_type != OP_PADHV)
4294 bad_type(arg, "hash", CvNAME(cv), o);
4298 o = newUNOP(OP_REFGEN, 0, kid);
4299 o->op_sibling = kid->op_sibling;
4300 kid->op_sibling = 0;
4301 prev->op_sibling = o;
4312 croak("Malformed prototype for %s: %s",
4313 CvNAME(cv),SvPV((SV*)cv,na));
4318 mod(o, OP_ENTERSUB);
4322 if (proto && !optional && *proto == '$')
4323 return too_few_arguments(op, CvNAME(cv));
4331 SvREADONLY_on(cSVOP->op_sv);
4339 if (op->op_flags & OPf_KIDS) {
4340 SVOP *kid = (SVOP*)cUNOP->op_first;
4342 if (kid->op_type == OP_NULL)
4343 kid = (SVOP*)kid->op_sibling;
4345 kid->op_type == OP_CONST && (kid->op_private & OPpCONST_BARE))
4346 op->op_flags |= OPf_SPECIAL;
4351 /* A peephole optimizer. We visit the ops in the order they're to execute. */
4357 register OP* oldop = 0;
4358 if (!o || o->op_seq)
4363 for (; o; o = o->op_next) {
4369 switch (o->op_type) {
4372 curcop = ((COP*)o); /* for warnings */
4373 o->op_seq = op_seqmax++;
4384 if (o->op_next->op_type == OP_STRINGIFY)
4386 o->op_seq = op_seqmax++;
4389 if ((o->op_flags & (OPf_KNOW|OPf_LIST)) != (OPf_KNOW|OPf_LIST)) {
4390 o->op_seq = op_seqmax++;
4391 break; /* Scalar stub must produce undef. List stub is noop */
4395 if (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE)
4396 curcop = ((COP*)op);
4402 if (oldop && o->op_next) {
4403 oldop->op_next = o->op_next;
4406 o->op_seq = op_seqmax++;
4410 if (o->op_next->op_type == OP_RV2SV) {
4411 if (!(o->op_next->op_private & OPpDEREF)) {
4413 o->op_private |= o->op_next->op_private & OPpLVAL_INTRO;
4414 o->op_next = o->op_next->op_next;
4415 o->op_type = OP_GVSV;
4416 o->op_ppaddr = ppaddr[OP_GVSV];
4419 else if (o->op_next->op_type == OP_RV2AV) {
4420 OP* pop = o->op_next->op_next;
4422 if (pop->op_type == OP_CONST &&
4423 (op = pop->op_next) &&
4424 pop->op_next->op_type == OP_AELEM &&
4425 !(pop->op_next->op_private & (OPpDEREF|OPpLVAL_INTRO)) &&
4426 (i = SvIV(((SVOP*)pop)->op_sv) - compiling.cop_arybase)
4430 SvREFCNT_dec(((SVOP*)pop)->op_sv);
4434 o->op_flags |= pop->op_next->op_flags & OPf_MOD;
4435 o->op_next = pop->op_next->op_next;
4436 o->op_type = OP_AELEMFAST;
4437 o->op_ppaddr = ppaddr[OP_AELEMFAST];
4438 o->op_private = (U8)i;
4439 GvAVn(((GVOP*)o)->op_gv);
4442 o->op_seq = op_seqmax++;
4449 o->op_seq = op_seqmax++;
4450 peep(cLOGOP->op_other);
4454 o->op_seq = op_seqmax++;
4455 peep(cCONDOP->op_true);
4456 peep(cCONDOP->op_false);
4460 o->op_seq = op_seqmax++;
4461 peep(cLOOP->op_redoop);
4462 peep(cLOOP->op_nextop);
4463 peep(cLOOP->op_lastop);
4468 o->op_seq = op_seqmax++;
4469 peep(cPMOP->op_pmreplstart);
4473 o->op_seq = op_seqmax++;
4474 if (dowarn && o->op_next && o->op_next->op_type == OP_NEXTSTATE) {
4475 if (o->op_next->op_sibling &&
4476 o->op_next->op_sibling->op_type != OP_DIE) {
4477 line_t oldline = curcop->cop_line;
4479 curcop->cop_line = ((COP*)o->op_next)->cop_line;
4480 warn("Statement unlikely to be reached");
4481 warn("(Maybe you meant system() when you said exec()?)\n");
4482 curcop->cop_line = oldline;
4487 o->op_seq = op_seqmax++;