summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dump.c5
-rw-r--r--op.c1
-rw-r--r--op.h3
-rw-r--r--pp.h2
4 files changed, 9 insertions, 2 deletions
diff --git a/dump.c b/dump.c
index ac6a07ed6e..0e7de382ea 100644
--- a/dump.c
+++ b/dump.c
@@ -472,8 +472,11 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, OP *o)
sv_catpv(tmpsv, ",AMPER");
if (o->op_private & OPpENTERSUB_DB)
sv_catpv(tmpsv, ",DB");
+ if (o->op_private & OPpENTERSUB_HASTARG)
+ sv_catpv(tmpsv, ",HASTARG");
}
- switch (o->op_private & OPpDEREF) {
+ else
+ switch (o->op_private & OPpDEREF) {
case OPpDEREF_SV:
sv_catpv(tmpsv, ",SV");
break;
diff --git a/op.c b/op.c
index 42ed8b201e..8ff0353491 100644
--- a/op.c
+++ b/op.c
@@ -5624,6 +5624,7 @@ Perl_ck_subr(pTHX_ OP *o)
I32 arg = 0;
STRLEN n_a;
+ o->op_private |= OPpENTERSUB_HASTARG;
for (cvop = o2; cvop->op_sibling; cvop = cvop->op_sibling) ;
if (cvop->op_type == OP_RV2CV) {
SVOP* tmpop;
diff --git a/op.h b/op.h
index dd6307c479..d1e2f27509 100644
--- a/op.h
+++ b/op.h
@@ -117,13 +117,14 @@ typedef U32 PADOFFSET;
/* Private for OP_REPEAT */
#define OPpREPEAT_DOLIST 64 /* List replication. */
-/* Private for OP_ENTERSUB, OP_RV2?V, OP_?ELEM */
+/* Private for OP_RV2?V, OP_?ELEM */
#define OPpDEREF (32|64) /* Want ref to something: */
#define OPpDEREF_AV 32 /* Want ref to AV. */
#define OPpDEREF_HV 64 /* Want ref to HV. */
#define OPpDEREF_SV (32|64) /* Want ref to SV. */
/* OP_ENTERSUB only */
#define OPpENTERSUB_DB 16 /* Debug subroutine. */
+#define OPpENTERSUB_HASTARG 32 /* Called from OP tree. */
/* OP_RV2CV only */
#define OPpENTERSUB_AMPER 8 /* Used & form to call. */
#define OPpENTERSUB_NOPAREN 128 /* bare sub call (without parens) */
diff --git a/pp.h b/pp.h
index ec701f3054..11dd9d0e82 100644
--- a/pp.h
+++ b/pp.h
@@ -49,6 +49,8 @@
#define dTARG SV *targ
+#define dXS_TARGET SV * targ = (PL_op->op_private & OPpENTERSUB_HASTARG ? PAD_SV(PL_op->op_targ) : sv_newmortal())
+
#define NORMAL PL_op->op_next
#define DIE return Perl_die