summaryrefslogtreecommitdiff
path: root/op.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2014-08-29 20:18:23 -0700
committerFather Chrysostomos <sprout@cpan.org>2014-08-29 21:50:43 -0700
commit211a4342c9ab2a1353f618cb96de02610eaa1989 (patch)
tree57e83e8ad42d795ee4b26c23367b0c91af3651f3 /op.h
parentcff06bc4e9340e61387bd9505055ed3a19aa25ef (diff)
downloadperl-211a4342c9ab2a1353f618cb96de02610eaa1989.tar.gz
Avoid vivifying stuff when looking up barewords
Till now, when a bareword was looked up to see whether it was a sub- routine, an rv2cv op was created (to allow PL_check hooks to override the process), which was then asked for its GV. Afterwards, the GV was downgraded back to nothing if possible. So a lot of the time a GV was autovivified and then discarded. This has been the case since f74617600 (5.12). If we know there is a good chance that the rv2cv op is about to be deleted, we can avoid that by passing a flag to the new op. Also f74617600 actually changed the behaviour by vivifying stashes that used not be vivified: sub foo { print shift, "\n" } SUPER::foo bar if 0; foo SUPER; Output in 5.10: SUPER Output as of this commit: SUPER Output in 5.12 to 5.21.3: Can't locate object method "foo" via package "SUPER" at - line 3.
Diffstat (limited to 'op.h')
-rw-r--r--op.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/op.h b/op.h
index c76f37d74a..6070326b20 100644
--- a/op.h
+++ b/op.h
@@ -214,13 +214,13 @@ is no conversion of op type.
bit entersub flag phase rv2cv flag phase
--- ------------- ----- ---------- -----
- 1 OPpENTERSUB_INARGS context OPpMAY_RETURN_CONSTANT context
+ 1 OPpENTERSUB_INARGS context
2 HINT_STRICT_REFS check HINT_STRICT_REFS check
4 OPpENTERSUB_HASTARG check
8 OPpENTERSUB_AMPER parser
16 OPpENTERSUB_DB check
32 OPpDEREF_AV context
- 64 OPpDEREF_HV context
+ 64 OPpDEREF_HV context OPpMAY_RETURN_CONSTANT context
128 OPpLVAL_INTRO context OPpENTERSUB_NOPAREN parser
*/
@@ -238,7 +238,7 @@ is no conversion of op type.
/* OP_RV2CV only */
#define OPpENTERSUB_AMPER 8 /* Used & form to call. */
#define OPpENTERSUB_NOPAREN 128 /* bare sub call (without parens) */
-#define OPpMAY_RETURN_CONSTANT 1 /* If a constant sub, return the constant */
+#define OPpMAY_RETURN_CONSTANT 64 /* If a constant sub, return the constant */
/* OP_GV only */
#define OPpEARLY_CV 32 /* foo() called before sub foo was parsed */
@@ -878,6 +878,8 @@ preprocessing token; the type of I<arg> depends on I<which>.
#define RV2CVOPCV_MARK_EARLY 0x00000001
#define RV2CVOPCV_RETURN_NAME_GV 0x00000002
+#define RV2CVOPCV_RETURN_STUB 0x00000004
+#define RV2CVOPCV_FLAG_MASK 0x00000007 /* all of the above */
#define op_lvalue(op,t) Perl_op_lvalue_flags(aTHX_ op,t,0)