From: Nicholas Clark Date: Mon, 31 Oct 2005 18:34:59 +0000 (+0000) Subject: Replace the 3 currently "unreachable" ops with a single op body X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=65bca31a689e744d19bc76458567e5ae895ca3dd;p=p5sagit%2Fp5-mst-13.2.git Replace the 3 currently "unreachable" ops with a single op body unimplemented_op() that panics descriptively if ever reached. p4raw-id: //depot/perl@25937 --- diff --git a/opcode.h b/opcode.h index 5aef24e..ab72fed 100644 --- a/opcode.h +++ b/opcode.h @@ -20,6 +20,8 @@ #define Perl_pp_i_postinc Perl_pp_postinc #define Perl_pp_i_postdec Perl_pp_postdec +PERL_PPDEF(Perl_unimplemented_op) + START_EXTERN_C #define OP_NAME(o) ((o)->op_type == OP_CUSTOM ? custom_op_name(o) : \ @@ -776,7 +778,7 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */ MEMBER_TO_FPTR(Perl_pp_padsv), MEMBER_TO_FPTR(Perl_pp_padav), MEMBER_TO_FPTR(Perl_pp_padhv), - MEMBER_TO_FPTR(Perl_pp_padany), + MEMBER_TO_FPTR(Perl_unimplemented_op), /* Perl_pp_padany */ MEMBER_TO_FPTR(Perl_pp_pushre), MEMBER_TO_FPTR(Perl_pp_rv2gv), MEMBER_TO_FPTR(Perl_pp_rv2sv), @@ -918,7 +920,7 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */ MEMBER_TO_FPTR(Perl_pp_reverse), MEMBER_TO_FPTR(Perl_pp_grepstart), MEMBER_TO_FPTR(Perl_pp_grepwhile), - MEMBER_TO_FPTR(Perl_pp_mapstart), + MEMBER_TO_FPTR(Perl_unimplemented_op), /* Perl_pp_mapstart */ MEMBER_TO_FPTR(Perl_pp_mapwhile), MEMBER_TO_FPTR(Perl_pp_range), MEMBER_TO_FPTR(Perl_pp_flip), @@ -1112,7 +1114,7 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */ MEMBER_TO_FPTR(Perl_pp_getlogin), MEMBER_TO_FPTR(Perl_pp_syscall), MEMBER_TO_FPTR(Perl_pp_lock), - MEMBER_TO_FPTR(Perl_pp_threadsv), + MEMBER_TO_FPTR(Perl_unimplemented_op), /* Perl_pp_threadsv */ MEMBER_TO_FPTR(Perl_pp_setstate), MEMBER_TO_FPTR(Perl_pp_method_named), MEMBER_TO_FPTR(Perl_pp_dor), diff --git a/opcode.pl b/opcode.pl index ffe4901..e3b9056 100755 --- a/opcode.pl +++ b/opcode.pl @@ -40,7 +40,8 @@ my %alias; # Format is "this function" => "does these op names" my @raw_alias = ( Perl_do_kv => [qw( keys values )], - ); + Perl_unimplemented_op => [qw(padany threadsv mapstart)], + ); while (my ($func, $names) = splice @raw_alias, 0, 2) { $alias{$_} = $func for @$names; @@ -72,6 +73,8 @@ print <<"END"; #define Perl_pp_i_postinc Perl_pp_postinc #define Perl_pp_i_postdec Perl_pp_postdec +PERL_PPDEF(Perl_unimplemented_op) + END print ON <<"END"; diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 42a1fcb..3c16b0d 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2916,10 +2916,6 @@ references to an object. (P) Something requested a negative number of bytes of malloc. -=item panic: mapstart - -(P) The compiler is screwed up with respect to the map() function. - =item panic: memory wrap (P) Something tried to allocate more memory than possible. @@ -3000,6 +2996,11 @@ was string. (P) The compiler attempted to do a goto, or something weird like that. +=item panic: unimplemented op %s (#%d) called + +(P) The compiler is screwed up and attempted to use an op that isn't permitted +at run time. + =item panic: utf16_to_utf8: odd bytelen (P) Something tried to call utf16_to_utf8 with an odd (as opposed diff --git a/pp.c b/pp.c index 8ae5a07..ddffda8 100644 --- a/pp.c +++ b/pp.c @@ -4785,6 +4785,13 @@ PP(pp_lock) RETURN; } + +PP(unimplemented_op) +{ + DIE(aTHX_ "panic: unimplemented op %s (#%d) called", OP_NAME(PL_op), + PL_op->op_type); +} + /* * Local variables: * c-indentation-style: bsd