From 4c5bab508cf172e32fdb9e8567ff635b6d783791 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Wed, 24 Sep 2014 00:58:23 -0700 Subject: [PATCH] Add lvref op type --- ext/Opcode/Opcode.pm | 2 +- lib/B/Op_private.pm | 1 + opcode.h | 8 ++++++++ opnames.h | 3 ++- pp.c | 4 ++++ pp_proto.h | 1 + regen/opcode.pl | 2 +- regen/opcodes | 1 + 8 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ext/Opcode/Opcode.pm b/ext/Opcode/Opcode.pm index 54cc0dc..71b60df 100644 --- a/ext/Opcode/Opcode.pm +++ b/ext/Opcode/Opcode.pm @@ -402,7 +402,7 @@ These are a hotchpotch of opcodes still waiting to be considered once - rv2gv refgen srefgen ref refassign + rv2gv refgen srefgen ref refassign lvref bless -- could be used to change ownership of objects (reblessing) diff --git a/lib/B/Op_private.pm b/lib/B/Op_private.pm index d1270d9..34564a9 100644 --- a/lib/B/Op_private.pm +++ b/lib/B/Op_private.pm @@ -381,6 +381,7 @@ $bits{log}{0} = $bf[0]; @{$bits{lslice}}{1,0} = ($bf[1], $bf[1]); $bits{lstat}{0} = $bf[0]; @{$bits{lt}}{1,0} = ($bf[1], $bf[1]); +$bits{lvref}{0} = $bf[0]; $bits{mapwhile}{0} = $bf[0]; $bits{method}{0} = $bf[0]; $bits{method_named}{0} = $bf[0]; diff --git a/opcode.h b/opcode.h index ff65502..4a0a91a 100644 --- a/opcode.h +++ b/opcode.h @@ -528,6 +528,7 @@ EXTCONST char* const PL_op_name[] = { "clonecv", "padrange", "refassign", + "lvref", "freed", }; #endif @@ -916,6 +917,7 @@ EXTCONST char* const PL_op_desc[] = { "private subroutine", "list of private variables", "lvalue ref assignment", + "lvalue ref assignment", "freed op", }; #endif @@ -1318,6 +1320,7 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */ Perl_pp_clonecv, Perl_pp_padrange, Perl_pp_refassign, + Perl_pp_lvref, } #endif #ifdef PERL_PPADDR_INITED @@ -1716,6 +1719,7 @@ EXT Perl_check_t PL_check[] /* or perlvars.h */ Perl_ck_null, /* clonecv */ Perl_ck_null, /* padrange */ Perl_ck_refassign, /* refassign */ + Perl_ck_null, /* lvref */ } #endif #ifdef PERL_CHECK_INITED @@ -2108,6 +2112,7 @@ EXTCONST U32 PL_opargs[] = { 0x00000040, /* clonecv */ 0x00000040, /* padrange */ 0x00000240, /* refassign */ + 0x00000140, /* lvref */ }; #endif @@ -2716,6 +2721,7 @@ EXTCONST I16 PL_op_private_bitdef_ix[] = { -1, /* clonecv */ 630, /* padrange */ 632, /* refassign */ + 634, /* lvref */ }; @@ -3075,6 +3081,7 @@ EXTCONST U16 PL_op_private_bitdefs[] = { /* fc */ 0x0003, /* padrange */ 0x25bc, 0x019b, /* refassign */ 0x25bc, 0x0067, + /* lvref */ 0x0003, }; @@ -3463,6 +3470,7 @@ EXTCONST U8 PL_op_private_valid[] = { /* CLONECV */ (0), /* PADRANGE */ (OPpPADRANGE_COUNTMASK|OPpLVAL_INTRO), /* REFASSIGN */ (OPpARG2_MASK|OPpLVAL_INTRO), + /* LVREF */ (OPpARG1_MASK), }; diff --git a/opnames.h b/opnames.h index 52c29b5..5125e16 100644 --- a/opnames.h +++ b/opnames.h @@ -394,10 +394,11 @@ typedef enum opcode { OP_CLONECV = 377, OP_PADRANGE = 378, OP_REFASSIGN = 379, + OP_LVREF = 380, OP_max } opcode; -#define MAXO 380 +#define MAXO 381 #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 87db5bb..1afacd4 100644 --- a/pp.c +++ b/pp.c @@ -6190,6 +6190,10 @@ PP(pp_refassign) RETURN; } +PP(pp_lvref) +{ + DIE(aTHX_ "Unimplemented"); +} /* * Local variables: diff --git a/pp_proto.h b/pp_proto.h index 611725c..7122103 100644 --- a/pp_proto.h +++ b/pp_proto.h @@ -145,6 +145,7 @@ PERL_CALLCONV OP *Perl_pp_listen(pTHX); PERL_CALLCONV OP *Perl_pp_lock(pTHX); PERL_CALLCONV OP *Perl_pp_lslice(pTHX); PERL_CALLCONV OP *Perl_pp_lt(pTHX); +PERL_CALLCONV OP *Perl_pp_lvref(pTHX); PERL_CALLCONV OP *Perl_pp_mapwhile(pTHX); PERL_CALLCONV OP *Perl_pp_match(pTHX); PERL_CALLCONV OP *Perl_pp_method(pTHX); diff --git a/regen/opcode.pl b/regen/opcode.pl index fe1488c..10c708b 100755 --- a/regen/opcode.pl +++ b/regen/opcode.pl @@ -55,7 +55,7 @@ while () { $args = '' unless defined $args; warn qq[Description "$desc" duplicates $seen{$desc}\n] - if $seen{$desc} and $key !~ "transr|(?:intro|clone)cv"; + if $seen{$desc} and $key !~ "transr|(?:intro|clone)cv|lvref"; 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 c40e3f9..0278fa5 100644 --- a/regen/opcodes +++ b/regen/opcodes @@ -554,3 +554,4 @@ introcv private subroutine ck_null d0 clonecv private subroutine ck_null d0 padrange list of private variables ck_null d0 refassign lvalue ref assignment ck_refassign d2 +lvref lvalue ref assignment ck_null d1 -- 1.8.3.1