In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/88938aa807eec74bf613701c9b6e851df9859b2a?hp=9d28cd7bddb99a3d781b8c7c03c31332d43af021>
- Log ----------------------------------------------------------------- commit 88938aa807eec74bf613701c9b6e851df9859b2a Author: David Mitchell <[email protected]> Date: Fri Sep 19 18:28:09 2014 +0100 B.xs: fix syntax err in PERL_VERSION < 17 The blead version of B.xs obviously hasn't been able to be compiled on old perls for a while. This fixes one such syntax error, blind. M ext/B/B.xs commit 62ead80fb7574026b211ef1fe6b1e10b0e376ccc Author: David Mitchell <[email protected]> Date: Fri Sep 19 18:24:11 2014 +0100 regen/op_private: tidy up rv2cv entry Remove some temporary comments, and merge the two places where rv2cv flags are defined. M regen/op_private commit 16a6edfa0e11bf585bf5bf62d8299a7a34d45319 Author: David Mitchell <[email protected]> Date: Fri Sep 19 18:14:01 2014 +0100 move OPpTARGET_MY comments from opcode.pl There is a section in regen/opcode.pl explaining when its okay to use the T flag / OPpTARGET_MY define. Move that text to regen/op_private, at the spot where it defines OPpTARGET_MY. It's more likely to be seen there. M regen/op_private M regen/opcode.pl commit b4941db24e5b5bf41a100f8944f5845de2bdf8ab Author: David Mitchell <[email protected]> Date: Fri Sep 19 18:10:27 2014 +0100 regen/op_private: update TARGLEX comments. Explain a bit more about how OPpTARGET_MY is used, and remove a temporary comment I make about inconsistencies in which ops can use the flag as defined by the old Concise.pm and regen/opcodes T flags. M regen/op_private commit 49d1dbaac672111bbe58149977f523e1fee67574 Author: David Mitchell <[email protected]> Date: Fri Sep 19 17:52:59 2014 +0100 pp.h: remove spurious comment about OPpTARGET_MY OPpTARGET_MY is unrelated to MAXARG as far as I can tell. M pp.h commit c10dbd97a88bebb222dadf3e4f104d42917e21bc Author: David Mitchell <[email protected]> Date: Fri Sep 19 17:49:05 2014 +0100 regen/op_private: fix assorted typos M regen/op_private commit b1c05ba5b06e0d1b9fedf625f1c647b7ea832ed0 Author: David Mitchell <[email protected]> Date: Fri Sep 19 17:40:25 2014 +0100 comment pp_foo aliases in pp*.c Where pp_foo() also handles OP_BAR, add a comment above the function mentioning that it also does pp_bar. This means that "grep pp_bar pp*.c" quickly locates the file/function that handles OP_BAR. M doop.c M pp.c M pp_ctl.c M pp_hot.c M pp_sys.c commit dacd2ca73583513edf8eeb5ab9a877e84de91d15 Author: David Mitchell <[email protected]> Date: Fri Sep 19 17:12:02 2014 +0100 remove vestigal threadsv/threadsv_named the threadsv op and the PL_threadsv_names var were part of the 5.005 threads model, long since removed. Remove some remaining references to them. M dist/Safe/t/safeops.t M ext/B/B.pm M lib/B/Deparse.pm M lib/B/Deparse.t ----------------------------------------------------------------------- Summary of changes: dist/Safe/t/safeops.t | 1 - doop.c | 3 ++ ext/B/B.pm | 4 +- ext/B/B.xs | 2 +- lib/B/Deparse.pm | 14 +------ lib/B/Deparse.t | 5 --- pp.c | 39 ++++++++++++++++++ pp.h | 1 - pp_ctl.c | 8 +++- pp_hot.c | 23 +++++++++++ pp_sys.c | 80 ++++++++++++++++++++++++++++++++++++ regen/op_private | 110 ++++++++++++++++++++++++++++++++++++-------------- regen/opcode.pl | 55 ------------------------- 13 files changed, 235 insertions(+), 110 deletions(-) diff --git a/dist/Safe/t/safeops.t b/dist/Safe/t/safeops.t index cc25bcb..cb37445 100644 --- a/dist/Safe/t/safeops.t +++ b/dist/Safe/t/safeops.t @@ -446,7 +446,6 @@ egrent endgrent getlogin getlogin syscall syscall lock SKIP -threadsv SKIP setstate SKIP method_named $x->y() dor $x // $y diff --git a/doop.c b/doop.c index 6a136d9..3b6f1e7 100644 --- a/doop.c +++ b/doop.c @@ -1215,6 +1215,9 @@ finish: SvTAINT(sv); } + +/* used for: pp_keys(), pp_values() */ + OP * Perl_do_kv(pTHX) { diff --git a/ext/B/B.pm b/ext/B/B.pm index edeab59..d50a9d6 100644 --- a/ext/B/B.pm +++ b/ext/B/B.pm @@ -556,8 +556,8 @@ C<"UNOP"> for example. =item threadsv_names -In a perl compiled for threads, this returns a list of the special -per-thread threadsv variables. +This used to provide support for the old 5.005 threading module. It now +does nothing. =back diff --git a/ext/B/B.xs b/ext/B/B.xs index 54e4c10..17614cb 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -676,7 +676,7 @@ struct OP_methods { #if PERL_VERSION >= 17 { STR_WITH_LEN("code_list"),OPp, STRUCT_OFFSET(struct pmop, op_code_list),},/*13*/ #else - { STR_WITH_LEN("code_list"),op_offset_special, 0, + { STR_WITH_LEN("code_list"),op_offset_special, 0, }, /*13*/ #endif { STR_WITH_LEN("sv"), SVp, STRUCT_OFFSET(struct svop, op_sv), },/*14*/ { STR_WITH_LEN("gv"), SVp, STRUCT_OFFSET(struct svop, op_sv), },/*15*/ diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm index 0e7fa57..ab85acf 100644 --- a/lib/B/Deparse.pm +++ b/lib/B/Deparse.pm @@ -3168,12 +3168,7 @@ sub loop_common { $ary = $self->deparse($ary, 1); } if (null $var) { - if (($enter->flags & OPf_SPECIAL) && ($] < 5.009)) { - # thread special var, under 5005threads - $var = $self->pp_threadsv($enter, 1); - } else { # regular my() variable - $var = $self->pp_padsv($enter, 1, 1); - } + $var = $self->pp_padsv($enter, 1, 1); } elsif ($var->name eq "rv2gv") { $var = $self->pp_rv2sv($var, 1); if ($enter->private & OPpOUR_INTRO) { @@ -3342,13 +3337,6 @@ sub pp_padsv { sub pp_padav { pp_padsv(@_) } sub pp_padhv { pp_padsv(@_) } -my @threadsv_names = B::threadsv_names; -sub pp_threadsv { - my $self = shift; - my($op, $cx) = @_; - return $self->maybe_local($op, $cx, "\$" . $threadsv_names[$op->targ]); -} - sub gv_or_padgv { my $self = shift; my $op = shift; diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index 81f0f37..620d430 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -982,11 +982,6 @@ print /a/u, s/b/c/u; # [perl #119807] s//\(3)/ge should not warn when deparsed (\3 warns) s/foo/\(3);/eg; #### -# Test @threadsv_names under 5005threads -foreach $' (1, 2) { - sleep $'; -} -#### # y///r tr/a/b/r; #### diff --git a/pp.c b/pp.c index 0e92254..2f0c905 100644 --- a/pp.c +++ b/pp.c @@ -741,6 +741,9 @@ PP(pp_study) RETPUSHYES; } + +/* also used for: pp_transr() */ + PP(pp_trans) { dSP; dTARG; @@ -934,6 +937,9 @@ S_do_chomp(pTHX_ SV *retval, SV *sv, bool chomping) } } + +/* also used for: pp_schomp() */ + PP(pp_schop) { dSP; dTARGET; @@ -946,6 +952,9 @@ PP(pp_schop) RETURN; } + +/* also used for: pp_chomp() */ + PP(pp_chop) { dSP; dMARK; dTARGET; dORIGMARK; @@ -1060,6 +1069,9 @@ PP(pp_undef) RETPUSHUNDEF; } + +/* also used for: pp_i_postdec() pp_i_postinc() pp_postdec() */ + PP(pp_postinc) { dSP; dTARGET; @@ -2097,6 +2109,9 @@ PP(pp_ncmp) RETURN; } + +/* also used for: pp_sge() pp_sgt() pp_slt() */ + PP(pp_sle) { dSP; @@ -2207,6 +2222,9 @@ PP(pp_bit_and) } } + +/* also used for: pp_bit_xor() */ + PP(pp_bit_or) { dSP; dATARGET; @@ -2673,6 +2691,9 @@ PP(pp_atan2) } } + +/* also used for: pp_cos() pp_exp() pp_log() pp_sqrt() */ + PP(pp_sin) { dSP; dTARGET; @@ -2880,6 +2901,9 @@ PP(pp_abs) RETURN; } + +/* also used for: pp_hex() */ + PP(pp_oct) { dSP; dTARGET; @@ -3186,6 +3210,9 @@ PP(pp_vec) RETURN; } + +/* also used for: pp_rindex() */ + PP(pp_index) { dSP; dTARGET; @@ -3464,6 +3491,9 @@ PP(pp_crypt) /* Generally UTF-8 and UTF-EBCDIC are indistinguishable at this level. So * most comments below say UTF-8, when in fact they mean UTF-EBCDIC as well */ + +/* also used for: pp_lcfirst() */ + PP(pp_ucfirst) { /* Actually is both lcfirst() and ucfirst(). Only the first character @@ -4452,7 +4482,11 @@ PP(pp_kvaslice) RETURN; } + /* Smart dereferencing for keys, values and each */ + +/* also used for: pp_reach() pp_rvalues() */ + PP(pp_rkeys) { dSP; @@ -4515,6 +4549,7 @@ PP(pp_aeach) RETURN; } +/* also used for: pp_avalues()*/ PP(pp_akeys) { dSP; @@ -5287,6 +5322,7 @@ PP(pp_push) RETURN; } +/* also used for: pp_pop()*/ PP(pp_shift) { dSP; @@ -5921,6 +5957,9 @@ PP(pp_lock) } +/* used for: pp_padany(), pp_mapstart(), pp_custom(); plus any system ops + * that aren't implemented on a particular platform */ + PP(unimplemented_op) { const Optype op_type = PL_op->op_type; diff --git a/pp.h b/pp.h index 58a0a5c..d0691f8 100644 --- a/pp.h +++ b/pp.h @@ -379,7 +379,6 @@ Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>. #define ARGTARG PL_op->op_targ - /* See OPpTARGET_MY: */ #define MAXARG (PL_op->op_private & OPpARG4_MASK) #define SWITCHSTACK(f,t) \ diff --git a/pp_ctl.c b/pp_ctl.c index 5036eda..7f60cce 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -2743,7 +2743,10 @@ S_dofindlabel(pTHX_ OP *o, const char *label, STRLEN len, U32 flags, OP **opstac return 0; } -PP(pp_goto) /* also pp_dump */ + +/* also used for: pp_dump() */ + +PP(pp_goto) { dVAR; dSP; OP *retop = NULL; @@ -3654,6 +3657,9 @@ S_path_is_searchable(const char *name) return TRUE; } + +/* also used for: pp_dofile() */ + PP(pp_require) { dSP; diff --git a/pp_hot.c b/pp_hot.c index 8ff2578..4f9519d 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -68,6 +68,9 @@ PP(pp_gvsv) RETURN; } + +/* also used for: pp_lineseq() pp_regcmaybe() pp_scalar() pp_scope() */ + PP(pp_null) { return NORMAL; @@ -101,6 +104,9 @@ PP(pp_gv) RETURN; } + +/* also used for: pp_andassign() */ + PP(pp_and) { PERL_ASYNC_CHECK(); @@ -464,6 +470,9 @@ PP(pp_eq) RETURN; } + +/* also used for: pp_i_predec() pp_i_preinc() pp_predec() */ + PP(pp_preinc) { dSP; @@ -484,6 +493,9 @@ PP(pp_preinc) return NORMAL; } + +/* also used for: pp_orassign() */ + PP(pp_or) { dSP; @@ -497,6 +509,9 @@ PP(pp_or) } } + +/* also used for: pp_dor() pp_dorassign() */ + PP(pp_defined) { dSP; @@ -720,6 +735,9 @@ PP(pp_add) } } + +/* also used for: pp_aelemfast_lex() */ + PP(pp_aelemfast) { dSP; @@ -770,6 +788,8 @@ PP(pp_pushre) /* Oversized hot code. */ +/* also used for: pp_say() */ + PP(pp_print) { dSP; dMARK; dORIGMARK; @@ -864,6 +884,9 @@ PP(pp_print) RETURN; } + +/* also used for: pp_rv2hv() */ + PP(pp_rv2av) { dSP; dTOPss; diff --git a/pp_sys.c b/pp_sys.c index a97b040..ac2a87c 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -954,6 +954,9 @@ PP(pp_tie) RETURN; } + +/* also used for: pp_dbmclose() */ + PP(pp_untie) { dSP; @@ -1604,6 +1607,9 @@ PP(pp_sysopen) RETURN; } + +/* also used for: pp_read() and pp_recv() (where supported) */ + PP(pp_sysread) { dSP; dMARK; dORIGMARK; dTARGET; @@ -1860,6 +1866,9 @@ PP(pp_sysread) RETPUSHUNDEF; } + +/* also used for: pp_send() where defined */ + PP(pp_syswrite) { dSP; dMARK; dORIGMARK; dTARGET; @@ -2158,6 +2167,9 @@ PP(pp_tell) RETURN; } + +/* also used for: pp_seek() */ + PP(pp_sysseek) { dSP; @@ -2294,6 +2306,9 @@ PP(pp_truncate) } } + +/* also used for: pp_fcntl() */ + PP(pp_ioctl) { dSP; dTARGET; @@ -2489,6 +2504,8 @@ PP(pp_sockpair) #ifdef HAS_SOCKET +/* also used for: pp_connect() */ + PP(pp_bind) { dSP; @@ -2629,6 +2646,9 @@ nuts: RETPUSHUNDEF; } + +/* also used for: pp_gsockopt() */ + PP(pp_ssockopt) { dSP; @@ -2703,6 +2723,9 @@ nuts2: } + +/* also used for: pp_getsockname() */ + PP(pp_getpeername) { dSP; @@ -2767,6 +2790,8 @@ nuts2: /* Stat calls. */ +/* also used for: pp_lstat() */ + PP(pp_stat) { dSP; @@ -2990,6 +3015,9 @@ S_try_amagic_ftest(pTHX_ char chr) { } +/* also used for: pp_fteexec() pp_fteread() pp_ftewrite() pp_ftrexec() + * pp_ftrwrite() */ + PP(pp_ftrread) { I32 result; @@ -3107,6 +3135,9 @@ PP(pp_ftrread) FT_RETURNNO; } + +/* also used for: pp_ftatime() pp_ftctime() pp_ftmtime() pp_ftsize() */ + PP(pp_ftis) { I32 result; @@ -3158,6 +3189,11 @@ PP(pp_ftis) } } + +/* also used for: pp_ftblk() pp_ftchr() pp_ftdir() pp_fteowned() + * pp_ftfile() pp_ftpipe() pp_ftsgid() pp_ftsock() + * pp_ftsuid() pp_ftsvtx() pp_ftzero() */ + PP(pp_ftrowned) { I32 result; @@ -3307,6 +3343,9 @@ PP(pp_fttty) FT_RETURNNO; } + +/* also used for: pp_ftbinary() */ + PP(pp_fttext) { I32 i; @@ -3576,6 +3615,9 @@ PP(pp_chdir) RETURN; } + +/* also used for: pp_chmod() pp_kill() pp_unlink() pp_utime() */ + PP(pp_chown) { dSP; dMARK; dTARGET; @@ -3624,6 +3666,9 @@ PP(pp_rename) RETURN; } + +/* also used for: pp_symlink() */ + #if defined(HAS_LINK) || defined(HAS_SYMLINK) PP(pp_link) { @@ -3666,6 +3711,9 @@ PP(pp_link) RETURN; } #else + +/* also used for: pp_symlink() */ + PP(pp_link) { /* Have neither. */ @@ -4510,6 +4558,9 @@ PP(pp_tms) /* Sun Dec 29 12:00:00 2147483647 */ #define TIME_UPPER_BOUND 67767976233316800.0 + +/* also used for: pp_localtime() */ + PP(pp_gmtime) { dSP; @@ -4637,6 +4688,8 @@ PP(pp_sleep) /* Shared memory. */ /* Merged with some message passing. */ +/* also used for: pp_msgrcv() pp_msgsnd() pp_semop() pp_shmread() */ + PP(pp_shmwrite) { #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) @@ -4669,6 +4722,8 @@ PP(pp_shmwrite) /* Semaphores. */ +/* also used for: pp_msgget() pp_shmget() */ + PP(pp_semget) { #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) @@ -4684,6 +4739,8 @@ PP(pp_semget) #endif } +/* also used for: pp_msgctl() pp_shmctl() */ + PP(pp_semctl) { #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) @@ -4729,6 +4786,8 @@ S_space_join_names_mortal(pTHX_ char *const *array) /* Get system info. */ +/* also used for: pp_ghbyaddr() pp_ghbyname() */ + PP(pp_ghostent) { #if defined(HAS_GETHOSTBYNAME) || defined(HAS_GETHOSTBYADDR) || defined(HAS_GETHOSTENT) @@ -4819,6 +4878,8 @@ PP(pp_ghostent) #endif } +/* also used for: pp_gnbyaddr() pp_gnbyname() */ + PP(pp_gnetent) { #if defined(HAS_GETNETBYNAME) || defined(HAS_GETNETBYADDR) || defined(HAS_GETNETENT) @@ -4892,6 +4953,9 @@ PP(pp_gnetent) #endif } + +/* also used for: pp_gpbyname() pp_gpbynumber() */ + PP(pp_gprotoent) { #if defined(HAS_GETPROTOBYNAME) || defined(HAS_GETPROTOBYNUMBER) || defined(HAS_GETPROTOENT) @@ -4952,6 +5016,9 @@ PP(pp_gprotoent) #endif } + +/* also used for: pp_gsbyname() pp_gsbyport() */ + PP(pp_gservent) { #if defined(HAS_GETSERVBYNAME) || defined(HAS_GETSERVBYPORT) || defined(HAS_GETSERVENT) @@ -5017,6 +5084,9 @@ PP(pp_gservent) #endif } + +/* also used for: pp_snetent() pp_sprotoent() pp_sservent() */ + PP(pp_shostent) { dSP; @@ -5054,6 +5124,10 @@ PP(pp_shostent) RETSETYES; } + +/* also used for: pp_egrent() pp_enetent() pp_eprotoent() pp_epwent() + * pp_eservent() pp_sgrent() pp_spwent() */ + PP(pp_ehostent) { dSP; @@ -5119,6 +5193,9 @@ PP(pp_ehostent) RETPUSHYES; } + +/* also used for: pp_gpwnam() pp_gpwuid() */ + PP(pp_gpwent) { #ifdef HAS_PASSWD @@ -5334,6 +5411,9 @@ PP(pp_gpwent) #endif } + +/* also used for: pp_ggrgid() pp_ggrnam() */ + PP(pp_ggrent) { #ifdef HAS_GROUP diff --git a/regen/op_private b/regen/op_private index 03c632d8..b86a1bd 100644 --- a/regen/op_private +++ b/regen/op_private @@ -18,8 +18,8 @@ C<%labels>, which hold roughly the same information as found in this file F<opcode.h> gains a series of C<OPp*> defines, and a few static data structures: -C<PL_op_private_valid> defines, per-op, which op_private bits are legally, -allowed to be set. This is a first good place to look to see if an op has +C<PL_op_private_valid> defines, per-op, which op_private bits are legally +allowed to be set. This is a good first place to look to see if an op has any spare private bits. C<PL_op_private_bitdef_ix>, C<PL_op_private_bitdefs>, @@ -74,9 +74,9 @@ in the second half, specific per-op flags are added, e.g. 3 => ... ); -(although the diving line between these two halves is somewhat subjective, -and is based on whether "OPp" is followed by the op name or something -generic). +(although the dividing line between these two halves is somewhat +subjective, and is based on whether "OPp" is followed by the op name or +something generic). There are some utility functions for generating a list of ops from F<regen/opcodes> based on various criteria. These are: @@ -85,7 +85,7 @@ F<regen/opcodes> based on various criteria. These are: ops_with_flag('X') ops_with_arg(N, 'XYZ') -which return a list of op names where: +which respectively return a list of op names where: field 3 of regen/opcodes specifies 'ck_foo' as the check function; field 4 of of regen/opcodes has flag or type 'X' set; @@ -97,8 +97,8 @@ For example If a label is specified as '-', then the flag or bit field is not displayed symbolically by Concise/-Dx; instead the bits are treated as -unrecognised and included in the final residual integer value after all -recognised bits have been processed (this doesn't apply to individual +unrecognised and are included in the final residual integer value after +all recognised bits have been processed (this doesn't apply to individual enum labels). Here is a full example of a bit field hash: @@ -307,13 +307,67 @@ addbits($_, 7 => qw(OPpLVAL_INTRO LVINTRO)) # # in constructs like my $x; ...; $x = $a + $b, # the sassign is optimised away and OPpTARGET_MY is set on the add op +# +# Note that OPpTARGET_MY is mainly used at compile-time. At run time, +# the pp function just updates the SV pointed to by op_targ, and doesn't +# care whether that's a PADTMP or a lexical var. + +# Some comments about when its safe to use T/OPpTARGET_MY. +# +# Safe to set if the ppcode uses: +# tryAMAGICbin, tryAMAGICun, SETn, SETi, SETu, PUSHn, PUSHTARG, SETTARG, +# SETs(TARG), XPUSHn, XPUSHu, +# +# Unsafe to set if the ppcode uses dTARG or [X]RETPUSH[YES|NO|UNDEF] +# +# lt and friends do SETs (including ncmp, but not scmp) +# +# Additional mode of failure: the opcode can modify TARG before it "used" +# all the arguments (or may call an external function which does the same). +# If the target coincides with one of the arguments ==> kaboom. +# +# pp.c pos substr each not OK (RETPUSHUNDEF) +# substr vec also not OK due to LV to target (are they???) +# ref not OK (RETPUSHNO) +# trans not OK (dTARG; TARG = sv_newmortal();) +# ucfirst etc not OK: TMP arg processed inplace +# quotemeta not OK (unsafe when TARG == arg) +# each repeat not OK too due to list context +# pack split - unknown whether they are safe +# sprintf: is calling do_sprintf(TARG,...) which can act on TARG +# before other args are processed. +# +# Suspicious wrt "additional mode of failure" (and only it): +# schop, chop, postinc/dec, bit_and etc, negate, complement. +# +# Also suspicious: 4-arg substr, sprintf, uc/lc (POK_only), reverse, pack. +# +# substr/vec: doing TAINT_off()??? +# +# pp_hot.c +# readline - unknown whether it is safe +# match subst not OK (dTARG) +# grepwhile not OK (not always setting) +# join not OK (unsafe when TARG == arg) +# +# Suspicious wrt "additional mode of failure": concat (dealt with +# in ck_sassign()), join (same). +# +# pp_ctl.c +# mapwhile flip caller not OK (not always setting) +# +# pp_sys.c +# backtick glob warn die not OK (not always setting) +# warn not OK (RETPUSHYES) +# open fileno getc sysread syswrite ioctl accept shutdown +# ftsize(etc) readlink telldir fork alarm getlogin not OK (RETPUSHUNDEF) +# umask select not OK (XPUSHs(&PL_sv_undef);) +# fileno getc sysread syswrite tell not OK (meth("FILENO" "GETC")) +# sselect shm* sem* msg* syscall - unknown whether they are safe +# gmtime not OK (list context) +# +# Suspicious wrt "additional mode of failure": warn, die, select. -# XXX the old Concise.pm disagreed with regen/opcodes as to which ops have -# this flag: in Concise, but not T: -# bit_and bit_or bit_xor chop complement join negate postdec postinc -# quotemeta schop sprintf -# in T but not Concise: -# srand addbits($_, 4 => qw(OPpTARGET_MY TARGMY)) for ops_with_flag('T'), @@ -466,9 +520,9 @@ addbits('repeat', 6 => qw(OPpREPEAT_DOLIST DOLIST)); # List replication # --- ------------- ----- ---------- ----- # 0 OPpENTERSUB_INARGS context # 1 HINT_STRICT_REFS check HINT_STRICT_REFS check -# 2 OPpENTERSUB_HASTARG check +# 2 OPpENTERSUB_HASTARG checki OPpENTERSUB_HASTARG # 3 OPpENTERSUB_AMPER check OPpENTERSUB_AMPER parser -# 4 OPpENTERSUB_DB check +# 4 OPpENTERSUB_DB check OPpENTERSUB_DB # 5 OPpDEREF_AV context # 6 OPpDEREF_HV context OPpMAY_RETURN_CONSTANT parser/context # 7 OPpLVAL_INTRO context OPpENTERSUB_NOPAREN parser @@ -484,24 +538,18 @@ addbits('entersub', # 5..6 => OPpDEREF, already defined above # 7 => OPpLVAL_INTRO, already defined above ); -addbits('rv2cv', - # If a constant sub, return the constant - 1 => qw(OPpHINT_STRICT_REFS STRICT), # 'use strict' in scope - - 3 => qw(OPpENTERSUB_AMPER AMPER), # Used & form to call - 6 => qw(OPpMAY_RETURN_CONSTANT CONST), - 7 => qw(OPpENTERSUB_NOPAREN NO() ), # bare sub call (without parens) -); - -# XXX perhaps ought the clear these flags in Perl_doref when converting -# and entersub into an rv2cv???? Failing that, update the comments above -# and add them as part of the main addbits('rv2cv'. +# note that some of these flags are just left-over from when an entersub +# is converted into an rv2cv, and could probably be cleared/re-assigned addbits('rv2cv', - # If a constant sub, return the constant - 2 => qw(OPpENTERSUB_HASTARG TARG), - 4 => qw(OPpENTERSUB_DB DBG ), # Debug subroutine + 1 => qw(OPpHINT_STRICT_REFS STRICT), # 'use strict' in scope + 2 => qw(OPpENTERSUB_HASTARG TARG ), # If const sub, return the const + 3 => qw(OPpENTERSUB_AMPER AMPER ), # Used & form to call + 4 => qw(OPpENTERSUB_DB DBG ), # Debug subroutine + + 6 => qw(OPpMAY_RETURN_CONSTANT CONST ), + 7 => qw(OPpENTERSUB_NOPAREN NO() ), # bare sub call (without parens) ); diff --git a/regen/opcode.pl b/regen/opcode.pl index 38c235f..93fdc06 100755 --- a/regen/opcode.pl +++ b/regen/opcode.pl @@ -1213,58 +1213,3 @@ foreach ($oc, $on, $pp, $oprivpm) { read_only_bottom_close_and_rename($_); } -# Some comments about 'T' opcode classifier: - -# Safe to set if the ppcode uses: -# tryAMAGICbin, tryAMAGICun, SETn, SETi, SETu, PUSHn, PUSHTARG, SETTARG, -# SETs(TARG), XPUSHn, XPUSHu, - -# Unsafe to set if the ppcode uses dTARG or [X]RETPUSH[YES|NO|UNDEF] - -# lt and friends do SETs (including ncmp, but not scmp) - -# Additional mode of failure: the opcode can modify TARG before it "used" -# all the arguments (or may call an external function which does the same). -# If the target coincides with one of the arguments ==> kaboom. - -# pp.c pos substr each not OK (RETPUSHUNDEF) -# substr vec also not OK due to LV to target (are they???) -# ref not OK (RETPUSHNO) -# trans not OK (dTARG; TARG = sv_newmortal();) -# ucfirst etc not OK: TMP arg processed inplace -# quotemeta not OK (unsafe when TARG == arg) -# each repeat not OK too due to list context -# pack split - unknown whether they are safe -# sprintf: is calling do_sprintf(TARG,...) which can act on TARG -# before other args are processed. - -# Suspicious wrt "additional mode of failure" (and only it): -# schop, chop, postinc/dec, bit_and etc, negate, complement. - -# Also suspicious: 4-arg substr, sprintf, uc/lc (POK_only), reverse, pack. - -# substr/vec: doing TAINT_off()??? - -# pp_hot.c -# readline - unknown whether it is safe -# match subst not OK (dTARG) -# grepwhile not OK (not always setting) -# join not OK (unsafe when TARG == arg) - -# Suspicious wrt "additional mode of failure": concat (dealt with -# in ck_sassign()), join (same). - -# pp_ctl.c -# mapwhile flip caller not OK (not always setting) - -# pp_sys.c -# backtick glob warn die not OK (not always setting) -# warn not OK (RETPUSHYES) -# open fileno getc sysread syswrite ioctl accept shutdown -# ftsize(etc) readlink telldir fork alarm getlogin not OK (RETPUSHUNDEF) -# umask select not OK (XPUSHs(&PL_sv_undef);) -# fileno getc sysread syswrite tell not OK (meth("FILENO" "GETC")) -# sselect shm* sem* msg* syscall - unknown whether they are safe -# gmtime not OK (list context) - -# Suspicious wrt "additional mode of failure": warn, die, select. -- Perl5 Master Repository
