This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add clonecv op type
authorFather Chrysostomos <sprout@cpan.org>
Fri, 3 Aug 2012 05:11:08 +0000 (22:11 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 16 Sep 2012 05:45:04 +0000 (22:45 -0700)
This will be used for cloning a ‘my’ sub on scope entry.
I was going to use pp_padcv for this, but it would end up having a
top-level if/else.

ext/Opcode/Opcode.pm
opcode.h
opnames.h
pp.c
pp_proto.h
regen/opcode.pl
regen/opcodes

index 8cc432f..06a66f6 100644 (file)
@@ -397,7 +397,7 @@ These are a hotchpotch of opcodes still waiting to be considered
 
     gvsv gv gelem
 
-    padsv padav padhv padcv padany introcv
+    padsv padav padhv padcv padany introcv clonecv
 
     once
 
index be5bc03..02769ba 100644 (file)
--- a/opcode.h
+++ b/opcode.h
@@ -523,6 +523,7 @@ EXTCONST char* const PL_op_name[] = {
        "fc",
        "padcv",
        "introcv",
+       "clonecv",
        "freed",
 };
 #endif
@@ -906,6 +907,7 @@ EXTCONST char* const PL_op_desc[] = {
        "fc",
        "private subroutine",
        "private subroutine",
+       "private subroutine",
        "freed op",
 };
 #endif
@@ -1303,6 +1305,7 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */
        Perl_pp_fc,
        Perl_pp_padcv,
        Perl_pp_introcv,
+       Perl_pp_clonecv,
 }
 #endif
 #ifdef PERL_PPADDR_INITED
@@ -1696,6 +1699,7 @@ EXT Perl_check_t PL_check[] /* or perlvars.h */
        Perl_ck_fun,            /* fc */
        Perl_ck_null,           /* padcv */
        Perl_ck_null,           /* introcv */
+       Perl_ck_null,           /* clonecv */
 }
 #endif
 #ifdef PERL_CHECK_INITED
@@ -2083,6 +2087,7 @@ EXTCONST U32 PL_opargs[] = {
        0x00009b8e,     /* fc */
        0x00000040,     /* padcv */
        0x00000040,     /* introcv */
+       0x00000040,     /* clonecv */
 };
 #endif
 
index b99fb8f..4b9bd8c 100644 (file)
--- a/opnames.h
+++ b/opnames.h
@@ -389,10 +389,11 @@ typedef enum opcode {
        OP_FC            = 372,
        OP_PADCV         = 373,
        OP_INTROCV       = 374,
+       OP_CLONECV       = 375,
        OP_max          
 } opcode;
 
-#define MAXO 375
+#define MAXO 376
 #define OP_FREED MAXO
 
 /* the OP_IS_* macros are optimized to a simple range check because
diff --git a/pp.c b/pp.c
index f8669c5..51b6788 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -157,6 +157,11 @@ PP(pp_introcv)
     DIE(aTHX_ "panic: introcv");
 }
 
+PP(pp_clonecv)
+{
+    DIE(aTHX_ "panic: clonecv");
+}
+
 /* Translations. */
 
 static const char S_no_symref_sv[] =
index db19bfb..4eafd78 100644 (file)
@@ -34,6 +34,7 @@ PERL_CALLCONV OP *Perl_pp_chop(pTHX);
 PERL_CALLCONV OP *Perl_pp_chown(pTHX);
 PERL_CALLCONV OP *Perl_pp_chr(pTHX);
 PERL_CALLCONV OP *Perl_pp_chroot(pTHX);
+PERL_CALLCONV OP *Perl_pp_clonecv(pTHX);
 PERL_CALLCONV OP *Perl_pp_close(pTHX);
 PERL_CALLCONV OP *Perl_pp_closedir(pTHX);
 PERL_CALLCONV OP *Perl_pp_complement(pTHX);
index 7401562..a081c64 100755 (executable)
@@ -44,7 +44,7 @@ while (<OPS>) {
     $args = '' unless defined $args;
 
     warn qq[Description "$desc" duplicates $seen{$desc}\n]
-     if $seen{$desc} and $key !~ "transr|introcv";
+     if $seen{$desc} and $key !~ "transr|(?:intro|clone)cv";
     die qq[Opcode "$key" duplicates $seen{$key}\n] if $seen{$key};
     die qq[Opcode "freed" is reserved for the slab allocator\n]
        if $key eq 'freed';
index 4bb41e5..1ab82de 100644 (file)
@@ -549,3 +549,4 @@ fc          fc                      ck_fun          fstu%   S?
 
 padcv          private subroutine      ck_null         d0
 introcv                private subroutine      ck_null         d0
+clonecv                private subroutine      ck_null         d0