else
PerlIO_printf(file, "DONE\n");
if (o->op_targ) {
- if (o->op_type == OP_NULL)
+ if (o->op_type == OP_NULL || o->op_type == OP_SETSTATE)
Perl_dump_indent(aTHX_ level, file, " (was %s)\n", PL_op_name[o->op_targ]);
else
Perl_dump_indent(aTHX_ level, file, "TARG = %d\n", o->op_targ);
case OP_CONST:
Perl_dump_indent(aTHX_ level, file, "SV = %s\n", SvPEEK(cSVOPo->op_sv));
break;
+ case OP_SETSTATE:
case OP_NEXTSTATE:
case OP_DBSTATE:
if (cCOPo->cop_line)
#define pp_seq Perl_pp_seq
#define pp_setpgrp Perl_pp_setpgrp
#define pp_setpriority Perl_pp_setpriority
+#define pp_setstate Perl_pp_setstate
#define pp_sge Perl_pp_sge
#define pp_sgrent Perl_pp_sgrent
#define pp_sgt Perl_pp_sgt
#define pp_seq() Perl_pp_seq(aTHX)
#define pp_setpgrp() Perl_pp_setpgrp(aTHX)
#define pp_setpriority() Perl_pp_setpriority(aTHX)
+#define pp_setstate() Perl_pp_setstate(aTHX)
#define pp_sge() Perl_pp_sge(aTHX)
#define pp_sgrent() Perl_pp_sgrent(aTHX)
#define pp_sgt() Perl_pp_sgt(aTHX)
#define pp_setpgrp Perl_pp_setpgrp
#define Perl_pp_setpriority CPerlObj::Perl_pp_setpriority
#define pp_setpriority Perl_pp_setpriority
+#define Perl_pp_setstate CPerlObj::Perl_pp_setstate
+#define pp_setstate Perl_pp_setstate
#define Perl_pp_sge CPerlObj::Perl_pp_sge
#define pp_sge Perl_pp_sge
#define Perl_pp_sgrent CPerlObj::Perl_pp_sgrent
# define dTHR int dummy_thr
#endif /* dTHR */
-/*#define DBG_SUB 1 /* */
-/*#define DBG_TIMER 1 /* */
+/*#define DBG_SUB 1 */
+/*#define DBG_TIMER 1 */
#ifdef DBG_SUB
# define DBG_SUB_NOTIFY(A,B) warn( A, B )
cond_expr flip flop andassign orassign and or xor
- warn die lineseq nextstate scope enter leave
+ warn die lineseq nextstate scope enter leave setstate
rv2cv anoncode prototype
#define Perl_pp_setpriority pPerl->Perl_pp_setpriority
#undef pp_setpriority
#define pp_setpriority Perl_pp_setpriority
+#undef Perl_pp_setstate
+#define Perl_pp_setstate pPerl->Perl_pp_setstate
+#undef pp_setstate
+#define pp_setstate Perl_pp_setstate
#undef Perl_pp_sge
#define Perl_pp_sge pPerl->Perl_pp_sge
#undef pp_sge
case OP_AELEMFAST:
SvREFCNT_dec(cGVOPo->op_gv);
break;
+ case OP_SETSTATE:
+ o->op_targ = 0; /* Was holding old type. */
+ /* FALL THROUGH */
case OP_NEXTSTATE:
case OP_DBSTATE:
cop_free((COP*)o);
STATIC void
S_null(pTHX_ OP *o)
{
+ if (o->op_type == OP_NEXTSTATE || o->op_type == OP_DBSTATE)
+ cop_free((COP*)o);
if (o->op_type != OP_NULL && o->op_type != OP_THREADSV && o->op_targ > 0)
pad_free(o->op_targ);
o->op_targ = o->op_type;
o->op_ppaddr = PL_ppaddr[OP_SCOPE];
kid = ((LISTOP*)o)->op_first;
if (kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE){
- cop_free((COP*)kid);
- null(kid);
+ if (kid->op_targ > 0)
+ pad_free(kid->op_targ);
+ kid->op_targ = kid->op_type;
+ kid->op_type = OP_SETSTATE;
+ kid->op_ppaddr = PL_ppaddr[OP_SETSTATE];
}
}
else
OP_SYSCALL, /* 345 */
OP_LOCK, /* 346 */
OP_THREADSV, /* 347 */
+ OP_SETSTATE, /* 348 */
OP_max
} opcode;
-#define MAXO 348
+#define MAXO 349
START_EXTERN_C
"syscall",
"lock",
"threadsv",
+ "setstate",
};
#endif
"syscall",
"lock",
"per-thread variable",
+ "set statement info",
};
#endif
Perl_pp_syscall,
Perl_pp_lock,
Perl_pp_threadsv,
+ Perl_pp_setstate,
};
#endif
Perl_ck_fun, /* syscall */
Perl_ck_rfun, /* lock */
Perl_ck_null, /* threadsv */
+ Perl_ck_null, /* setstate */
};
#endif
0x0004281d, /* syscall */
0x00003604, /* lock */
0x00000044, /* threadsv */
+ 0x00000000, /* setstate */
};
#endif
__END__
+# New ops always go at the very end
+
# Nothing.
null null operation ck_null 0
dump dump ck_null ds}
goto goto ck_null ds}
exit exit ck_fun ds% S?
+# continued below
#nswitch numeric switch ck_null d
#cswitch character switch ck_null d
# For multi-threading
lock lock ck_rfun s% S
threadsv per-thread variable ck_null ds0
+
+# Control (contd.)
+setstate set statement info ck_null 0
return ((CPerlObj*)pPerl)->Perl_pp_setpriority();
}
+#undef Perl_pp_setstate
+OP *
+Perl_pp_setstate(pTHXo)
+{
+ return ((CPerlObj*)pPerl)->Perl_pp_setstate();
+}
+
#undef Perl_pp_sge
OP *
Perl_pp_sge(pTHXo)
Perl_pp_syscall
Perl_pp_lock
Perl_pp_threadsv
+Perl_pp_setstate
return NORMAL;
}
+PP(pp_setstate)
+{
+ PL_curcop = (COP*)PL_op;
+ return NORMAL;
+}
+
PP(pp_pushmark)
{
PUSHMARK(PL_stack_sp);
PERL_PPDEF(Perl_pp_syscall)
PERL_PPDEF(Perl_pp_lock)
PERL_PPDEF(Perl_pp_threadsv)
+PERL_PPDEF(Perl_pp_setstate)
';
EXPECT
ZZZ
+########
+-w
+if (@ARGV) { print "" }
+else {
+ if ($x == 0) { print "" } else { print $x }
+}
+EXPECT
+Use of uninitialized value at - line 4.