summaryrefslogtreecommitdiff
path: root/embed.h
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-08-30 09:31:47 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-08-30 12:39:39 -0700
commit23496c6ea4cd9e3c09a9fe1878f55f241bdc17e5 (patch)
tree308baee5cf0e50b4fd4b0170aff3f1be4b9b66f2 /embed.h
parent38552987f01ba3c9fbea08e94b95b439e5ded364 (diff)
downloadperl-23496c6ea4cd9e3c09a9fe1878f55f241bdc17e5.tar.gz
Eliminate is_gv_magical_sv
This resolves perl bug #97978. Many built-in variables, like $], are actually created on the fly when first accessed. Perl likes to pretend that these variables have always existed, so it autovivifies the *] glob even in rvalue context (e.g., defined *{"]"}, close "]"). The list of variables that were autovivified was maintained separ- ately (in is_gv_magical_sv) from the code that actually creates them (gv_fetchpvn_flags). ‘Maintained’ is not actually precise: it *wasn’t* being maintained, and there were new variables that never got added to is_gv_magical_sv and one deleted variable that was never removed. There are only two pieces of code that call is_gv_magical_sv, both in pp.c: S_rv2gv (called by *{} and also the implicit *{} that functions like close() provide) and Perl_softrefxv (called by ${}, @{}, %{}). In both cases, the glob is immediately autovivified if is_gv_magical_sv returns true. So this commit eliminates the extra maintenance burden by extirpat- ing is_gv_magical_sv altogether, and replacing it with a new flag to gv_fetchpvn_flags, GvADDMG, which will autovivify a glob *if* it’s a magical one. It does make defined(*{"frobbly"}) slightly slower, in that it creates a temporary glob and then frees it when it sees nothing magical has been done with it. But this case is rare enough it should not matter. At least I got rid of the bugginess.
Diffstat (limited to 'embed.h')
-rw-r--r--embed.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/embed.h b/embed.h
index c7659310e1..4ac70e747c 100644
--- a/embed.h
+++ b/embed.h
@@ -1049,7 +1049,6 @@
#define intro_my() Perl_intro_my(aTHX)
#define invert(a) Perl_invert(aTHX_ a)
#define io_close(a,b) Perl_io_close(aTHX_ a,b)
-#define is_gv_magical_sv(a,b) Perl_is_gv_magical_sv(aTHX_ a,b)
#define jmaybe(a) Perl_jmaybe(aTHX_ a)
#define keyword(a,b,c) Perl_keyword(aTHX_ a,b,c)
#define list(a) Perl_list(aTHX_ a)