This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add proto magic type
authorFather Chrysostomos <sprout@cpan.org>
Fri, 13 Jul 2012 06:31:52 +0000 (23:31 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 16 Sep 2012 05:45:03 +0000 (22:45 -0700)
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.

mg_names.c
mg_raw.h
mg_vtable.h
pod/perlguts.pod
regen/mg_vtable.pl

index 51a4962..73dc3f9 100644 (file)
@@ -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(<)" },
index f577087..3fd2992 100644 (file)
--- 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",
index 2490394..8526fc5 100644 (file)
@@ -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 */
index 215f518..76acf57 100644 (file)
@@ -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
index 5fcdc4c..9c722cf 100644 (file)
@@ -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,