From 13f89586fe60fad5f4be3e8b89d5e605a7552658 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 2 Aug 2012 22:11:08 -0700 Subject: [PATCH] Add clonecv op type MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 | 2 +- opcode.h | 5 +++++ opnames.h | 3 ++- pp.c | 5 +++++ pp_proto.h | 1 + regen/opcode.pl | 2 +- regen/opcodes | 1 + 7 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ext/Opcode/Opcode.pm b/ext/Opcode/Opcode.pm index 8cc432f..06a66f6 100644 --- a/ext/Opcode/Opcode.pm +++ b/ext/Opcode/Opcode.pm @@ -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 diff --git a/opcode.h b/opcode.h index be5bc03..02769ba 100644 --- 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 diff --git a/opnames.h b/opnames.h index b99fb8f..4b9bd8c 100644 --- 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 --- 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[] = diff --git a/pp_proto.h b/pp_proto.h index db19bfb..4eafd78 100644 --- a/pp_proto.h +++ b/pp_proto.h @@ -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); diff --git a/regen/opcode.pl b/regen/opcode.pl index 7401562..a081c64 100755 --- a/regen/opcode.pl +++ b/regen/opcode.pl @@ -44,7 +44,7 @@ while () { $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'; diff --git a/regen/opcodes b/regen/opcodes index 4bb41e5..1ab82de 100644 --- a/regen/opcodes +++ b/regen/opcodes @@ -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 -- 2.7.4