summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-07-12 23:31:52 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-15 22:45:03 -0700
commit2a388207e072a645aa29f0b2b18f07d9a55cbf5e (patch)
treee5cc426ec00c7925570598b6dd420b6050d9598e
parent194774c2461cd523598d669111a3251e2ceb0147 (diff)
downloadperl-2a388207e072a645aa29f0b2b18f07d9a55cbf5e.tar.gz
Add proto magic type
This will be used for storing the prototype CV of a ‘my’ sub. The clone needs to occupy the pad entry so that padcv ops will be able to find it. That means the clone has to displace its prototype. In case the same sub is called recursively, we still need to be able to access the prototype.
-rw-r--r--mg_names.c1
-rw-r--r--mg_raw.h2
-rw-r--r--mg_vtable.h1
-rw-r--r--pod/perlguts.pod1
-rw-r--r--regen/mg_vtable.pl1
5 files changed, 6 insertions, 0 deletions
diff --git a/mg_names.c b/mg_names.c
index 51a49626f5..73dc3f9502 100644
--- a/mg_names.c
+++ b/mg_names.c
@@ -9,6 +9,7 @@
{ PERL_MAGIC_sv, "sv(\\0)" },
{ PERL_MAGIC_arylen, "arylen(#)" },
{ PERL_MAGIC_rhash, "rhash(%)" },
+ { PERL_MAGIC_proto, "proto(&)" },
{ PERL_MAGIC_pos, "pos(.)" },
{ PERL_MAGIC_symtab, "symtab(:)" },
{ PERL_MAGIC_backref, "backref(<)" },
diff --git a/mg_raw.h b/mg_raw.h
index f577087434..3fd29920f1 100644
--- a/mg_raw.h
+++ b/mg_raw.h
@@ -12,6 +12,8 @@
"/* arylen '#' Array length ($#ary) */" },
{ '%', "magic_vtable_max | PERL_MAGIC_VALUE_MAGIC",
"/* rhash '%' extra data for restricted hashes */" },
+ { '&', "magic_vtable_max",
+ "/* proto '&' my sub prototype CV */" },
{ '.', "want_vtbl_pos | PERL_MAGIC_VALUE_MAGIC",
"/* pos '.' pos() lvalue */" },
{ ':', "magic_vtable_max | PERL_MAGIC_VALUE_MAGIC",
diff --git a/mg_vtable.h b/mg_vtable.h
index 2490394895..8526fc5ffd 100644
--- a/mg_vtable.h
+++ b/mg_vtable.h
@@ -15,6 +15,7 @@
#define PERL_MAGIC_sv '\0' /* Special scalar variable */
#define PERL_MAGIC_arylen '#' /* Array length ($#ary) */
#define PERL_MAGIC_rhash '%' /* extra data for restricted hashes */
+#define PERL_MAGIC_proto '&' /* my sub prototype CV */
#define PERL_MAGIC_pos '.' /* pos() lvalue */
#define PERL_MAGIC_symtab ':' /* extra data for symbol tables */
#define PERL_MAGIC_backref '<' /* for weak ref data */
diff --git a/pod/perlguts.pod b/pod/perlguts.pod
index 215f51804a..76acf5722c 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -1061,6 +1061,7 @@ will be lost.
# PERL_MAGIC_arylen vtbl_arylen Array length ($#ary)
% PERL_MAGIC_rhash (none) extra data for restricted
hashes
+ & PERL_MAGIC_proto (none) my sub prototype CV
. PERL_MAGIC_pos vtbl_pos pos() lvalue
: PERL_MAGIC_symtab (none) extra data for symbol
tables
diff --git a/regen/mg_vtable.pl b/regen/mg_vtable.pl
index 5fcdc4c78f..9c722cf8e3 100644
--- a/regen/mg_vtable.pl
+++ b/regen/mg_vtable.pl
@@ -94,6 +94,7 @@ my %mg =
desc => "Shadow \"foreach\" iterator variable /\nsmart parameter vivification" },
arylen => { char => '#', vtable => 'arylen', value_magic => 1,
desc => 'Array length ($#ary)' },
+ proto => { char => '&', desc => 'my sub prototype CV' },
pos => { char => '.', vtable => 'pos', value_magic => 1,
desc => 'pos() lvalue' },
backref => { char => '<', vtable => 'backref', value_magic => 1,