Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove smartmatch, given, when, default and non-loop continue #22370

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -6107,7 +6107,6 @@ t/lib/feature/multidimensional Tests for enabling/disabling $foo{$x, $y} => $fo
t/lib/feature/nonesuch Tests for enabling/disabling nonexistent feature
t/lib/feature/removed Tests for enabling/disabling removed feature
t/lib/feature/say Tests for enabling/disabling say feature
t/lib/feature/switch Tests for enabling/disabling switch feature
t/lib/h2ph.h Test header file for h2ph
t/lib/h2ph.pht Generated output from h2ph.h by h2ph, for comparison
t/lib/locale/latin1 Part of locale.t in Latin 1
Expand Down Expand Up @@ -6407,7 +6406,6 @@ t/op/signatures.t See if sub signatures work
t/op/sigsystem.t See if system and SIGCHLD handlers play together nicely
t/op/sleep.t See if sleep works
t/op/smartkve.t See if smart deref for keys/values/each works
t/op/smartmatch.t See if the ~~ operator works
t/op/sort.t See if sort works
t/op/splice.t See if splice works
t/op/split.t See if split works
Expand All @@ -6430,7 +6428,6 @@ t/op/substr_thr.t See if substr works in another thread
t/op/svflags.t See if POK is set as expected.
t/op/svleak.pl Test file for svleak.t
t/op/svleak.t See if stuff leaks SVs
t/op/switch.t See if switches (given/when) work
t/op/symbolcache.t See if undef/delete works on stashes with functions
t/op/sysio.t See if sysread and syswrite work
t/op/taint.t See if tainting works
Expand Down
28 changes: 11 additions & 17 deletions cop.h
Original file line number Diff line number Diff line change
Expand Up @@ -1119,27 +1119,21 @@ struct context {
and a static array of context names in pp_ctl.c */
#define CXTYPEMASK 0xf
#define CXt_NULL 0 /* currently only used for sort BLOCK */
#define CXt_WHEN 1
#define CXt_BLOCK 2
/* When micro-optimising :-) keep GIVEN next to the LOOPs, as these 5 share a
jump table in pp_ctl.c
The first 4 don't have a 'case' in at least one switch statement in pp_ctl.c
*/
#define CXt_GIVEN 3
#define CXt_BLOCK 1

/* be careful of the ordering of these five. Macros like CxTYPE_is_LOOP,
* CxFOREACH compare ranges */
#define CXt_LOOP_ARY 4 /* for (@ary) { ...; } */
#define CXt_LOOP_LAZYSV 5 /* for ('a'..'z') { ...; } */
#define CXt_LOOP_LAZYIV 6 /* for (1..9) { ...; } */
#define CXt_LOOP_LIST 7 /* for (1,2,3) { ...; } */
#define CXt_LOOP_PLAIN 8 /* while (...) { ...; }
#define CXt_LOOP_ARY 2 /* for (@ary) { ...; } */
#define CXt_LOOP_LAZYSV 3 /* for ('a'..'z') { ...; } */
#define CXt_LOOP_LAZYIV 4 /* for (1..9) { ...; } */
#define CXt_LOOP_LIST 5 /* for (1,2,3) { ...; } */
#define CXt_LOOP_PLAIN 6 /* while (...) { ...; }
or plain block { ...; } */
#define CXt_SUB 9
#define CXt_FORMAT 10
#define CXt_EVAL 11 /* eval'', eval{}, try{} */
#define CXt_SUBST 12
#define CXt_DEFER 13
#define CXt_SUB 7
#define CXt_FORMAT 8
#define CXt_EVAL 9 /* eval'', eval{}, try{} */
#define CXt_SUBST 10
#define CXt_DEFER 11
/* SUBST doesn't feature in all switch statements. */

/* private flags for CXt_SUB and CXt_FORMAT */
Expand Down
2 changes: 1 addition & 1 deletion dist/Safe/Safe.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package Safe;
use 5.003_11;
use Scalar::Util qw(reftype refaddr);

$Safe::VERSION = "2.46";
$Safe::VERSION = "2.47";

# *** Don't declare any lexicals above this point ***
#
Expand Down
3 changes: 1 addition & 2 deletions dist/Safe/t/safeops.t
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ plan(tests => scalar @op + 3);
sub testop {
my ($op, $opname, $code) = @_;
pass("$op : skipped") and return if $code =~ /^SKIP/;
pass("$op : skipped") and return if $code =~ m://|~~: && $] < 5.010;
pass("$op : skipped") and return if $code eq "//" && $] < 5.010;
my $c = new Safe;
$c->deny_only($op);
$c->reval($code);
Expand Down Expand Up @@ -453,7 +453,6 @@ dor $x // $y
dorassign $x //= $y
once SKIP {use feature 'state'; state $foo = 42;}
say SKIP {use feature 'say'; say "foo";}
smartmatch no warnings 'deprecated'; $x ~~ $y
aeach SKIP each @t
akeys SKIP keys @t
avalues SKIP values @t
Expand Down
2 changes: 0 additions & 2 deletions dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1375,8 +1375,6 @@ S_do_op_dump_bar(pTHX_ I32 level, UV bar, PerlIO *file, const OP *o)
case OP_DORASSIGN:
case OP_ANDASSIGN:
case OP_ARGDEFELEM:
case OP_ENTERGIVEN:
case OP_ENTERWHEN:
case OP_ENTERTRY:
case OP_ONCE:
S_opdump_indent(aTHX_ o, level, bar, file, "OTHER");
Expand Down
28 changes: 0 additions & 28 deletions embed.fnc
Original file line number Diff line number Diff line change
Expand Up @@ -2170,9 +2170,6 @@ ARdp |OP * |newFOROP |I32 flags \
|NN OP *expr \
|NULLOK OP *block \
|NULLOK OP *cont
ARdp |OP * |newGIVENOP |NN OP *cond \
|NN OP *block \
|PADOFFSET defsv_off
: Used in scope.c
eopx |GP * |newGP |NN GV * const gv
Adm |GV * |newGVgen |NN const char *pack
Expand Down Expand Up @@ -2316,8 +2313,6 @@ ERXopx |char * |new_warnings_bitfield \
|NULLOK char *buffer \
|NN const char * const bits \
|STRLEN size
ARdp |OP * |newWHENOP |NULLOK OP *cond \
|NN OP *block
ARdp |OP * |newWHILEOP |I32 flags \
|I32 debuggable \
|NULLOK LOOP *loop \
Expand Down Expand Up @@ -4726,7 +4721,6 @@ RST |bool |is_handle_constructor \
Ti |bool |is_standard_filehandle_name \
|NN const char *fhname
S |OP * |listkids |NULLOK OP *o
S |bool |looks_like_bool|NN const OP *o
S |OP * |modkids |NULLOK OP *o \
|I32 type
S |void |move_proto_attr|NN OP **proto \
Expand All @@ -4736,11 +4730,6 @@ S |void |move_proto_attr|NN OP **proto \
S |OP * |my_kid |NULLOK OP *o \
|NULLOK OP *attrs \
|NN OP **imopsp
S |OP * |newGIVWHENOP |NULLOK OP *cond \
|NN OP *block \
|I32 enter_opcode \
|I32 leave_opcode \
|PADOFFSET entertarg
RS |OP * |new_logop |I32 type \
|I32 flags \
|NN OP **firstp \
Expand All @@ -4761,8 +4750,6 @@ S |bool |process_special_blocks \
|NN const char * const fullname \
|NN GV * const gv \
|NN CV * const cv
S |OP * |ref_array_or_hash \
|NULLOK OP *cond
S |OP * |refkids |NULLOK OP *o \
|I32 type
S |OP * |scalarboolean |NN OP *o
Expand Down Expand Up @@ -4940,7 +4927,6 @@ p |UV |_to_upper_title_latin1 \
#if defined(PERL_IN_PP_CTL_C)
RS |PerlIO *|check_type_and_open \
|NN SV *name
S |void |destroy_matcher|NN PMOP *matcher
RSd |OP * |docatch |Perl_ppaddr_t firstpp
S |bool |doeval_compile |U8 gimme \
|NULLOK CV *outside \
Expand All @@ -4954,21 +4940,12 @@ RS |OP * |dofindlabel |NN OP *o \
|NN OP **oplimit
S |MAGIC *|doparseform |NN SV *sv
RS |I32 |dopoptoeval |I32 startingblock
RS |I32 |dopoptogivenfor|I32 startingblock
RS |I32 |dopoptolabel |NN const char *label \
|STRLEN len \
|U32 flags
RS |I32 |dopoptoloop |I32 startingblock
RS |I32 |dopoptosub_at |NN const PERL_CONTEXT *cxstk \
|I32 startingblock
RS |I32 |dopoptowhen |I32 startingblock
S |OP * |do_smartmatch |NULLOK HV *seen_this \
|NULLOK HV *seen_other \
|const bool copied
RS |PMOP * |make_matcher |NN REGEXP *re
RS |bool |matcher_matches_sv \
|NN PMOP *matcher \
|NN SV *sv
RST |bool |num_overflow |NV value \
|I32 fldsize \
|I32 frcsize
Expand Down Expand Up @@ -6082,13 +6059,11 @@ CTp |Malloc_t|mem_log_realloc \
Cipx |void |cx_popblock |NN PERL_CONTEXT *cx
Cipx |void |cx_popeval |NN PERL_CONTEXT *cx
Cipx |void |cx_popformat |NN PERL_CONTEXT *cx
Cipx |void |cx_popgiven |NN PERL_CONTEXT *cx
Cipx |void |cx_poploop |NN PERL_CONTEXT *cx
Cipx |void |cx_popsub |NN PERL_CONTEXT *cx
Cipx |void |cx_popsub_args |NN PERL_CONTEXT *cx
Cipx |void |cx_popsub_common \
|NN PERL_CONTEXT *cx
Cipx |void |cx_popwhen |NN PERL_CONTEXT *cx
Cipx |PERL_CONTEXT *|cx_pushblock \
|U8 type \
|U8 gimme \
Expand All @@ -6101,8 +6076,6 @@ Cipx |void |cx_pushformat |NN PERL_CONTEXT *cx \
|NN CV *cv \
|NULLOK OP *retop \
|NULLOK GV *gv
Cipx |void |cx_pushgiven |NN PERL_CONTEXT *cx \
|NULLOK SV *orig_defsv
Cipx |void |cx_pushloop_for|NN PERL_CONTEXT *cx \
|NN void *itervarp \
|NULLOK SV *itersave
Expand All @@ -6114,7 +6087,6 @@ Cipx |void |cx_pushsub |NN PERL_CONTEXT *cx \
|bool hasargs
Cipx |void |cx_pushtry |NN PERL_CONTEXT *cx \
|NULLOK OP *retop
Cipx |void |cx_pushwhen |NN PERL_CONTEXT *cx
Cipx |void |cx_topblock |NN PERL_CONTEXT *cx
Cipx |U8 |gimme_V
#endif /* !defined(PERL_NO_INLINE_FUNCTIONS) */
Expand Down
16 changes: 0 additions & 16 deletions embed.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@
# define newDEFSVOP() Perl_newDEFSVOP(aTHX)
# define newFORM(a,b,c) Perl_newFORM(aTHX_ a,b,c)
# define newFOROP(a,b,c,d,e) Perl_newFOROP(aTHX_ a,b,c,d,e)
# define newGIVENOP(a,b,c) Perl_newGIVENOP(aTHX_ a,b,c)
# define newGVOP(a,b,c) Perl_newGVOP(aTHX_ a,b,c)
# define newGVREF(a,b) Perl_newGVREF(aTHX_ a,b)
# define newGVgen_flags(a,b) Perl_newGVgen_flags(aTHX_ a,b)
Expand Down Expand Up @@ -446,7 +445,6 @@
# define newTRYCATCHOP(a,b,c,d) Perl_newTRYCATCHOP(aTHX_ a,b,c,d)
# define newUNOP(a,b,c) Perl_newUNOP(aTHX_ a,b,c)
# define newUNOP_AUX(a,b,c,d) Perl_newUNOP_AUX(aTHX_ a,b,c,d)
# define newWHENOP(a,b) Perl_newWHENOP(aTHX_ a,b)
# define newWHILEOP(a,b,c,d,e,f,g) Perl_newWHILEOP(aTHX_ a,b,c,d,e,f,g)
# define newXS(a,b,c) Perl_newXS(aTHX_ a,b,c)
# define newXS_flags(a,b,c,d,e) Perl_newXS_flags(aTHX_ a,b,c,d,e)
Expand Down Expand Up @@ -1246,7 +1244,6 @@
# define ck_sassign(a) Perl_ck_sassign(aTHX_ a)
# define ck_select(a) Perl_ck_select(aTHX_ a)
# define ck_shift(a) Perl_ck_shift(aTHX_ a)
# define ck_smartmatch(a) Perl_ck_smartmatch(aTHX_ a)
# define ck_sort(a) Perl_ck_sort(aTHX_ a)
# define ck_spair(a) Perl_ck_spair(aTHX_ a)
# define ck_split(a) Perl_ck_split(aTHX_ a)
Expand Down Expand Up @@ -1437,19 +1434,16 @@
# define is_handle_constructor S_is_handle_constructor
# define is_standard_filehandle_name S_is_standard_filehandle_name
# define listkids(a) S_listkids(aTHX_ a)
# define looks_like_bool(a) S_looks_like_bool(aTHX_ a)
# define modkids(a,b) S_modkids(aTHX_ a,b)
# define move_proto_attr(a,b,c,d) S_move_proto_attr(aTHX_ a,b,c,d)
# define my_kid(a,b,c) S_my_kid(aTHX_ a,b,c)
# define newGIVWHENOP(a,b,c,d,e) S_newGIVWHENOP(aTHX_ a,b,c,d,e)
# define newMETHOP_internal(a,b,c,d) S_newMETHOP_internal(aTHX_ a,b,c,d)
# define new_logop(a,b,c,d) S_new_logop(aTHX_ a,b,c,d)
# define no_fh_allowed(a) S_no_fh_allowed(aTHX_ a)
# define op_integerize(a) S_op_integerize(aTHX_ a)
# define op_std_init(a) S_op_std_init(aTHX_ a)
# define pmtrans(a,b,c) S_pmtrans(aTHX_ a,b,c)
# define process_special_blocks(a,b,c,d) S_process_special_blocks(aTHX_ a,b,c,d)
# define ref_array_or_hash(a) S_ref_array_or_hash(aTHX_ a)
# define refkids(a,b) S_refkids(aTHX_ a,b)
# define scalar_mod_type S_scalar_mod_type
# define scalarboolean(a) S_scalarboolean(aTHX_ a)
Expand Down Expand Up @@ -1524,20 +1518,14 @@
# endif
# if defined(PERL_IN_PP_CTL_C)
# define check_type_and_open(a) S_check_type_and_open(aTHX_ a)
# define destroy_matcher(a) S_destroy_matcher(aTHX_ a)
# define do_smartmatch(a,b,c) S_do_smartmatch(aTHX_ a,b,c)
# define docatch(a) S_docatch(aTHX_ a)
# define doeval_compile(a,b,c,d) S_doeval_compile(aTHX_ a,b,c,d)
# define dofindlabel(a,b,c,d,e,f) S_dofindlabel(aTHX_ a,b,c,d,e,f)
# define doparseform(a) S_doparseform(aTHX_ a)
# define dopoptoeval(a) S_dopoptoeval(aTHX_ a)
# define dopoptogivenfor(a) S_dopoptogivenfor(aTHX_ a)
# define dopoptolabel(a,b,c) S_dopoptolabel(aTHX_ a,b,c)
# define dopoptoloop(a) S_dopoptoloop(aTHX_ a)
# define dopoptosub_at(a,b) S_dopoptosub_at(aTHX_ a,b)
# define dopoptowhen(a) S_dopoptowhen(aTHX_ a)
# define make_matcher(a) S_make_matcher(aTHX_ a)
# define matcher_matches_sv(a,b) S_matcher_matches_sv(aTHX_ a,b)
# define num_overflow S_num_overflow
# define path_is_searchable S_path_is_searchable
# define run_user_filter(a,b,c) S_run_user_filter(aTHX_ a,b,c)
Expand Down Expand Up @@ -2124,21 +2112,17 @@
# define cx_popblock(a) Perl_cx_popblock(aTHX_ a)
# define cx_popeval(a) Perl_cx_popeval(aTHX_ a)
# define cx_popformat(a) Perl_cx_popformat(aTHX_ a)
# define cx_popgiven(a) Perl_cx_popgiven(aTHX_ a)
# define cx_poploop(a) Perl_cx_poploop(aTHX_ a)
# define cx_popsub(a) Perl_cx_popsub(aTHX_ a)
# define cx_popsub_args(a) Perl_cx_popsub_args(aTHX_ a)
# define cx_popsub_common(a) Perl_cx_popsub_common(aTHX_ a)
# define cx_popwhen(a) Perl_cx_popwhen(aTHX_ a)
# define cx_pushblock(a,b,c,d) Perl_cx_pushblock(aTHX_ a,b,c,d)
# define cx_pusheval(a,b,c) Perl_cx_pusheval(aTHX_ a,b,c)
# define cx_pushformat(a,b,c,d) Perl_cx_pushformat(aTHX_ a,b,c,d)
# define cx_pushgiven(a,b) Perl_cx_pushgiven(aTHX_ a,b)
# define cx_pushloop_for(a,b,c) Perl_cx_pushloop_for(aTHX_ a,b,c)
# define cx_pushloop_plain(a) Perl_cx_pushloop_plain(aTHX_ a)
# define cx_pushsub(a,b,c,d) Perl_cx_pushsub(aTHX_ a,b,c,d)
# define cx_pushtry(a,b) Perl_cx_pushtry(aTHX_ a,b)
# define cx_pushwhen(a) Perl_cx_pushwhen(aTHX_ a)
# define cx_topblock(a) Perl_cx_topblock(aTHX_ a)
# define gimme_V() Perl_gimme_V(aTHX)
# endif /* !defined(PERL_NO_INLINE_FUNCTIONS) */
Expand Down
7 changes: 1 addition & 6 deletions ext/Opcode/Opcode.pm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package Opcode 1.65;
package Opcode 1.66;

use strict;

Expand Down Expand Up @@ -434,11 +434,6 @@ These are a hotchpotch of opcodes still waiting to be considered
entertry leavetry -- can be used to 'hide' fatal errors
entertrycatch poptry catch leavetrycatch -- similar

entergiven leavegiven
enterwhen leavewhen
break continue
smartmatch

pushdefer

custom -- where should this go
Expand Down
26 changes: 3 additions & 23 deletions feature.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions gv.c
Original file line number Diff line number Diff line change
Expand Up @@ -611,13 +611,13 @@ S_maybe_add_coresub(pTHX_ HV * const stash, GV *gv,
case KEY___DATA__: case KEY___END__ :
case KEY_ADJUST : case KEY_AUTOLOAD: case KEY_BEGIN : case KEY_CHECK :
case KEY_DESTROY : case KEY_END : case KEY_INIT : case KEY_UNITCHECK:
case KEY_and : case KEY_catch : case KEY_class :
case KEY_cmp : case KEY_default: case KEY_defer :
case KEY_and : case KEY_catch : case KEY_class :
case KEY_continue: case KEY_cmp : case KEY_defer :
case KEY_do : case KEY_dump : case KEY_else : case KEY_elsif :
case KEY_eq : case KEY_eval : case KEY_field :
case KEY_finally:
case KEY_for : case KEY_foreach: case KEY_format: case KEY_ge :
case KEY_given : case KEY_goto : case KEY_grep : case KEY_gt :
case KEY_goto : case KEY_grep : case KEY_gt :
case KEY_if : case KEY_isa :
case KEY_last :
case KEY_le : case KEY_local : case KEY_lt : case KEY_m :
Expand All @@ -630,7 +630,7 @@ S_maybe_add_coresub(pTHX_ HV * const stash, GV *gv,
case KEY_state: case KEY_sub :
case KEY_tr : case KEY_try :
case KEY_unless:
case KEY_until: case KEY_use : case KEY_when : case KEY_while :
case KEY_until: case KEY_use : case KEY_while :
case KEY_x : case KEY_xor : case KEY_y :
return NULL;
case KEY_chomp: case KEY_chop: case KEY_defined: case KEY_delete:
Expand Down
Loading
Loading