1# New ops always go at the end 2# The restriction on having custom as the last op has been removed 3 4# A recapitulation of the format of this file: 5# The file consists of five tab-separated columns: the name of the op, an 6# English description, the name of the "check" routine used to optimize this 7# operation, some flags, and a description of the operands. 8 9# The flags consist of options followed by a mandatory op class signifier 10 11# The classes are: 12# baseop - 0 unop - 1 binop - 2 13# logop - | listop - @ pmop - / 14# padop/svop - $ padop - # (unused) loop - { 15# baseop/unop - % loopexop - } filestatop - - 16# pvop/svop - " cop - ; methop - . 17# unop_aux - + 18 19# Other options are: 20# needs stack mark - m (OA_MARK) 21# needs constant folding - f (OA_FOLDCONST) 22# produces a scalar - s (OA_RETSCALAR) 23# produces an integer - i (unused) 24# needs a target - t (OA_TARGET) 25# target can be in a pad - T (OA_TARGET|OA_TARGLEX) 26# has a corresponding integer version - I (OA_OTHERINT) 27# make temp copy in list assignment - d (OA_DANGEROUS) 28# uses $_ if no argument given - u (OA_DEFGV) 29 30# Values for the operands are: 31# scalar - S list - L array - A 32# hash - H sub (CV) - C file - F 33# socket - Fs filetest - F- filetest_access - F-+ 34# num-compare - S< dirhandle - DF infix bitwise - S| 35 36# reference - R 37# "?" denotes an optional operand. 38 39# Nothing. 40 41null null operation ck_null 0 42stub stub ck_null 0 43scalar scalar ck_fun s% S 44 45# Pushy stuff. 46 47pushmark pushmark ck_null s0 48wantarray wantarray ck_null is0 49 50const constant item ck_svconst s$ 51 52gvsv scalar variable ck_null ds$ 53gv glob value ck_null ds$ 54gelem glob elem ck_null ds2 S S 55padsv private variable ck_null ds0 56padsv_store padsv scalar assignment ck_sassign s1 S S 57padav private array ck_null d0 58padhv private hash ck_null d0 59padany private value ck_null d0 60 61# References and stuff. 62 63rv2gv ref-to-glob cast ck_rvconst ds1 64rv2sv scalar dereference ck_rvconst ds1 65av2arylen array length ck_null is1 66rv2cv subroutine dereference ck_rvconst d1 67anoncode anonymous subroutine ck_anoncode s$ 68prototype subroutine prototype ck_prototype su% S? 69refgen reference constructor ck_spair m1 L 70srefgen single ref constructor ck_null fs1 S 71ref reference-type operator ck_fun stu% S? 72bless bless ck_fun s@ S S? 73 74# Pushy I/O. 75 76backtick quoted execution (``, qx) ck_backtick tu% S? 77# glob defaults its first arg to $_ 78glob glob ck_glob t@ S? 79readline <HANDLE> ck_readline t% F? 80rcatline append I/O operator ck_null t$ 81 82# Bindable operators. 83 84regcmaybe regexp internal guard ck_fun s1 S 85regcreset regexp internal reset ck_fun s1 S 86regcomp regexp compilation ck_null s| S 87match pattern match (m//) ck_match / 88qr pattern quote (qr//) ck_match s/ 89subst substitution (s///) ck_match is/ S 90substcont substitution iterator ck_null is| 91trans transliteration (tr///) ck_match is" S 92# y///r 93transr transliteration (tr///) ck_match is" S 94 95# Lvalue operators. 96 97sassign scalar assignment ck_sassign s2 S S 98aassign list assignment ck_null t2 L L 99 100chop chop ck_spair mts% L 101schop scalar chop ck_null stu% S? 102chomp chomp ck_spair mTs% L 103schomp scalar chomp ck_null sTu% S? 104defined defined operator ck_defined isu% S? 105undef undef operator ck_fun s% R? 106study study ck_fun su% S? 107pos match position ck_fun stu% R? 108 109preinc preincrement (++) ck_lfun dIs1 S 110i_preinc integer preincrement (++) ck_lfun dis1 S 111predec predecrement (--) ck_lfun dIs1 S 112i_predec integer predecrement (--) ck_lfun dis1 S 113postinc postincrement (++) ck_lfun Ist1 S 114i_postinc integer postincrement (++) ck_lfun ist1 S 115postdec postdecrement (--) ck_lfun Ist1 S 116i_postdec integer postdecrement (--) ck_lfun ist1 S 117 118# Ordinary operators. 119 120pow exponentiation (**) ck_null fsT2 S S 121 122multiply multiplication (*) ck_null IfsT2 S S 123i_multiply integer multiplication (*) ck_null ifsT2 S S 124divide division (/) ck_null IfsT2 S S 125i_divide integer division (/) ck_null ifsT2 S S 126modulo modulus (%) ck_null IifsT2 S S 127i_modulo integer modulus (%) ck_null ifsT2 S S 128repeat repeat (x) ck_repeat fmt2 L S 129 130add addition (+) ck_null IfsT2 S S 131i_add integer addition (+) ck_null ifsT2 S S 132subtract subtraction (-) ck_null IfsT2 S S 133i_subtract integer subtraction (-) ck_null ifsT2 S S 134concat concatenation (.) or string ck_concat fsT2 S S 135multiconcat concatenation (.) or string ck_null sT+ 136stringify string ck_stringify fsT@ S 137 138left_shift left bitshift (<<) ck_bitop fsT2 S S 139right_shift right bitshift (>>) ck_bitop fsT2 S S 140 141lt numeric lt (<) ck_cmp Iifs2 S S< 142i_lt integer lt (<) ck_cmp ifs2 S S< 143gt numeric gt (>) ck_cmp Iifs2 S S< 144i_gt integer gt (>) ck_cmp ifs2 S S< 145le numeric le (<=) ck_cmp Iifs2 S S< 146i_le integer le (<=) ck_cmp ifs2 S S< 147ge numeric ge (>=) ck_cmp Iifs2 S S< 148i_ge integer ge (>=) ck_cmp ifs2 S S< 149eq numeric eq (==) ck_cmp Iifs2 S S< 150i_eq integer eq (==) ck_cmp ifs2 S S< 151ne numeric ne (!=) ck_cmp Iifs2 S S< 152i_ne integer ne (!=) ck_cmp ifs2 S S< 153ncmp numeric comparison (<=>) ck_null Iifst2 S S< 154i_ncmp integer comparison (<=>) ck_null ifst2 S S< 155 156slt string lt ck_null ifs2 S S 157sgt string gt ck_null ifs2 S S 158sle string le ck_null ifs2 S S 159sge string ge ck_null ifs2 S S 160seq string eq ck_null ifs2 S S 161sne string ne ck_null ifs2 S S 162scmp string comparison (cmp) ck_null ifst2 S S 163 164bit_and bitwise and (&) ck_bitop fst2 S S| 165bit_xor bitwise xor (^) ck_bitop fst2 S S| 166bit_or bitwise or (|) ck_bitop fst2 S S| 167nbit_and numeric bitwise and (&) ck_bitop fsT2 S S| 168nbit_xor numeric bitwise xor (^) ck_bitop fsT2 S S| 169nbit_or numeric bitwise or (|) ck_bitop fsT2 S S| 170sbit_and string bitwise and (&.) ck_bitop fst2 S S| 171sbit_xor string bitwise xor (^.) ck_bitop fst2 S S| 172sbit_or string bitwise or (|.) ck_bitop fst2 S S| 173 174negate negation (-) ck_null Ifst1 S 175i_negate integer negation (-) ck_null ifst1 S 176not not ck_null ifs1 S 177complement 1's complement (~) ck_bitop fst1 S 178ncomplement numeric 1's complement (~) ck_bitop fsT1 S 179scomplement string 1's complement (~) ck_null fsT1 S 180 181smartmatch smart match ck_smartmatch s2 182 183# High falutin' math. 184 185atan2 atan2 ck_fun fsT@ S S 186sin sin ck_fun fsTu% S? 187cos cos ck_fun fsTu% S? 188rand rand ck_fun sT% S? 189srand srand ck_fun sT% S? 190exp exp ck_fun fsTu% S? 191log log ck_fun fsTu% S? 192sqrt sqrt ck_fun fsTu% S? 193 194# Lowbrow math. 195 196int int ck_fun fsTu% S? 197hex hex ck_fun fsTu% S? 198oct oct ck_fun fsTu% S? 199abs abs ck_fun fsTu% S? 200 201# String stuff. 202 203length length ck_length ifsTu% S? 204substr substr ck_substr st@ S S S? S? 205vec vec ck_fun ist@ S S S 206 207index index ck_index isT@ S S S? 208rindex rindex ck_index isT@ S S S? 209 210sprintf sprintf ck_lfun fmst@ S L 211formline formline ck_fun ms@ S L 212ord ord ck_fun ifsTu% S? 213chr chr ck_fun fsTu% S? 214crypt crypt ck_fun fsT@ S S 215ucfirst ucfirst ck_fun fstu% S? 216lcfirst lcfirst ck_fun fstu% S? 217uc uc ck_fun fstu% S? 218lc lc ck_fun fstu% S? 219quotemeta quotemeta ck_fun fstu% S? 220 221# Arrays. 222 223rv2av array dereference ck_rvconst dt1 224aelemfast constant array element ck_null ds$ A S 225aelemfast_lex constant lexical array element ck_null d0 A S 226aelemfastlex_store const lexical array element store ck_null d1 A S 227aelem array element ck_null s2 A S 228aslice array slice ck_null m@ A L 229kvaslice index/value array slice ck_null m@ A L 230 231aeach each on array ck_each d% A 232avalues values on array ck_each dt% A 233akeys keys on array ck_each t% A 234 235# Hashes. 236 237each each ck_each d% H 238values values ck_each dt% H 239keys keys ck_each t% H 240delete delete ck_delete % S 241exists exists ck_exists is% S 242rv2hv hash dereference ck_rvconst dt1 243helem hash element ck_null s2 H S 244hslice hash slice ck_null m@ H L 245kvhslice key/value hash slice ck_null m@ H L 246 247# mixed array and hash access 248 249multideref array or hash lookup ck_null ds+ 250 251# Explosives and implosives. 252 253unpack unpack ck_fun u@ S S? 254pack pack ck_fun fmst@ S L 255split split ck_split t/ S S S 256join join or string ck_join fmst@ S L 257 258# List operators. 259 260list list ck_null m@ L 261lslice list slice ck_null 2 H L L 262anonlist anonymous array ([]) ck_fun ms@ L 263anonhash anonymous hash ({}) ck_fun ms@ L 264emptyavhv empty anon hash/array ck_fun sT@ L 265 266splice splice ck_fun m@ A S? S? L 267push push ck_fun imsT@ A L 268pop pop ck_shift s% A? 269shift shift ck_shift s% A? 270unshift unshift ck_fun imsT@ A L 271sort sort ck_sort m@ C? L 272reverse reverse ck_fun mt@ L 273 274grepstart grep ck_grep m@ C L 275grepwhile grep iterator ck_null t| 276 277mapstart map ck_grep m@ C L 278mapwhile map iterator ck_null t| 279 280# Range stuff. 281 282range flipflop ck_null | S S 283flip range (or flip) ck_null 1 S S 284flop range (or flop) ck_null 1 285 286# Control. 287 288and logical and (&&) ck_null | 289or logical or (||) ck_null | 290xor logical xor ck_null fs2 S S 291dor defined or (//) ck_null | 292cond_expr conditional expression ck_null | 293andassign logical and assignment (&&=) ck_null s| 294orassign logical or assignment (||=) ck_null s| 295dorassign defined or assignment (//=) ck_null s| 296 297entersub subroutine entry ck_subr dm1 L 298leavesub subroutine exit ck_null 1 299leavesublv lvalue subroutine return ck_null 1 300argcheck check subroutine arguments ck_null + 301argelem subroutine argument ck_null + 302argdefelem subroutine argument default value ck_null | 303caller caller ck_fun t% S? 304warn warn ck_fun imst@ L 305die die ck_fun imst@ L 306reset symbol reset ck_fun is% S? 307 308lineseq line sequence ck_null @ 309nextstate next statement ck_null s; 310dbstate debug next statement ck_null s; 311unstack iteration finalizer ck_null s0 312enter block entry ck_null 0 313leave block exit ck_null @ 314scope block ck_null @ 315enteriter foreach loop entry ck_null d{ 316iter foreach loop iterator ck_null 0 317enterloop loop entry ck_null d{ 318leaveloop loop exit ck_null 2 319return return ck_return m@ L 320last last ck_null s} 321next next ck_null s} 322redo redo ck_null s} 323dump dump ck_null ds} 324goto goto ck_null s} 325exit exit ck_fun s% S? 326method method lookup ck_method d. 327method_named method with known name ck_null d. 328method_super super with known name ck_null d. 329method_redir redirect method with known name ck_null d. 330method_redir_super redirect super method with known name ck_null d. 331 332entergiven given() ck_null d| 333leavegiven leave given block ck_null 1 334enterwhen when() ck_null d| 335leavewhen leave when block ck_null 1 336break break ck_null 0 337continue continue ck_null 0 338 339# I/O. 340 341open open ck_open ismt@ F S? L 342close close ck_fun is% F? 343pipe_op pipe ck_fun is@ F F 344 345fileno fileno ck_fun ist% F 346umask umask ck_fun ist% S? 347binmode binmode ck_fun s@ F S? 348 349tie tie ck_fun idms@ R S L 350untie untie ck_fun is% R 351tied tied ck_fun ds% R 352dbmopen dbmopen ck_fun is@ H S S 353dbmclose dbmclose ck_fun is% H 354 355sselect select system call ck_select t@ S S S S 356select select ck_select st@ F? 357 358getc getc ck_eof st% F? 359read read ck_fun imst@ F R S S? 360enterwrite write ck_fun is% F? 361leavewrite write exit ck_null 1 362 363prtf printf ck_listiob ims@ F? L 364print print ck_listiob ims@ F? L 365say say ck_listiob ims@ F? L 366 367sysopen sysopen ck_fun s@ F S S S? 368sysseek sysseek ck_fun s@ F S S 369sysread sysread ck_fun imst@ F R S S? 370syswrite syswrite ck_fun imst@ F S S? S? 371 372eof eof ck_eof is% F? 373tell tell ck_tell st% F? 374seek seek ck_tell s@ F S S 375# truncate really behaves as if it had both "S S" and "F S" 376truncate truncate ck_trunc is@ S S 377 378fcntl fcntl ck_fun st@ F S S 379ioctl ioctl ck_fun st@ F S S 380flock flock ck_fun isT@ F S 381 382# Sockets. OP_IS_SOCKET wants them consecutive (so moved 1st 2) 383 384send send ck_fun imst@ Fs S S S? 385recv recv ck_fun imst@ Fs R S S 386 387socket socket ck_fun is@ Fs S S S 388sockpair socketpair ck_fun is@ Fs Fs S S S 389 390bind bind ck_fun is@ Fs S 391connect connect ck_fun is@ Fs S 392listen listen ck_fun is@ Fs S 393accept accept ck_fun ist@ Fs Fs 394shutdown shutdown ck_fun ist@ Fs S 395 396gsockopt getsockopt ck_fun is@ Fs S S 397ssockopt setsockopt ck_fun is@ Fs S S S 398 399getsockname getsockname ck_fun is% Fs 400getpeername getpeername ck_fun is% Fs 401 402# Stat calls. OP_IS_FILETEST wants them consecutive. 403# Also needs to match OP_IS_STAT() in op.h 404 405lstat lstat ck_ftst u- F? 406stat stat ck_ftst u- F? 407ftrread -R ck_ftst isu- F-+ 408ftrwrite -W ck_ftst isu- F-+ 409ftrexec -X ck_ftst isu- F-+ 410fteread -r ck_ftst isu- F-+ 411ftewrite -w ck_ftst isu- F-+ 412fteexec -x ck_ftst isu- F-+ 413ftis -e ck_ftst isu- F- 414ftsize -s ck_ftst istu- F- 415ftmtime -M ck_ftst stu- F- 416ftatime -A ck_ftst stu- F- 417ftctime -C ck_ftst stu- F- 418ftrowned -O ck_ftst isu- F- 419fteowned -o ck_ftst isu- F- 420ftzero -z ck_ftst isu- F- 421ftsock -S ck_ftst isu- F- 422ftchr -c ck_ftst isu- F- 423ftblk -b ck_ftst isu- F- 424ftfile -f ck_ftst isu- F- 425ftdir -d ck_ftst isu- F- 426ftpipe -p ck_ftst isu- F- 427ftsuid -u ck_ftst isu- F- 428ftsgid -g ck_ftst isu- F- 429ftsvtx -k ck_ftst isu- F- 430ftlink -l ck_ftst isu- F- 431fttty -t ck_ftst is- F- 432fttext -T ck_ftst isu- F- 433ftbinary -B ck_ftst isu- F- 434 435# File calls. 436 437# chdir really behaves as if it had both "S?" and "F?" 438chdir chdir ck_trunc isT% S? 439chown chown ck_fun imsT@ L 440chroot chroot ck_fun isTu% S? 441unlink unlink ck_fun imsTu@ L 442chmod chmod ck_fun imsT@ L 443utime utime ck_fun imsT@ L 444rename rename ck_fun isT@ S S 445link link ck_fun isT@ S S 446symlink symlink ck_fun isT@ S S 447readlink readlink ck_fun stu% S? 448mkdir mkdir ck_fun isTu@ S? S? 449rmdir rmdir ck_fun isTu% S? 450 451# Directory calls. 452 453open_dir opendir ck_fun is@ F S 454readdir readdir ck_fun % DF 455telldir telldir ck_fun st% DF 456seekdir seekdir ck_fun s@ DF S 457rewinddir rewinddir ck_fun s% DF 458closedir closedir ck_fun is% DF 459 460# Process control. 461 462fork fork ck_null ist0 463wait wait ck_null isT0 464waitpid waitpid ck_fun isT@ S S 465system system ck_exec imsT@ S? L 466exec exec ck_exec imsT@ S? L 467kill kill ck_fun imsT@ L 468getppid getppid ck_null isT0 469getpgrp getpgrp ck_fun isT% S? 470setpgrp setpgrp ck_fun isT@ S? S? 471getpriority getpriority ck_fun isT@ S S 472setpriority setpriority ck_fun isT@ S S S 473 474# Time calls. 475 476time time ck_null isT0 477tms times ck_null 0 478localtime localtime ck_fun t% S? 479gmtime gmtime ck_fun t% S? 480alarm alarm ck_fun istu% S? 481sleep sleep ck_fun isT% S? 482 483# Shared memory. 484 485shmget shmget ck_fun imst@ S S S 486shmctl shmctl ck_fun imst@ S S S 487shmread shmread ck_fun imst@ S S S S 488shmwrite shmwrite ck_fun imst@ S S S S 489 490# Message passing. 491 492msgget msgget ck_fun imst@ S S 493msgctl msgctl ck_fun imst@ S S S 494msgsnd msgsnd ck_fun imst@ S S S 495msgrcv msgrcv ck_fun imst@ S S S S S 496 497# Semaphores. 498 499semop semop ck_fun imst@ S S 500semget semget ck_fun imst@ S S S 501semctl semctl ck_fun imst@ S S S S 502 503# Eval. 504 505require require ck_require dsu% S? 506dofile do "file" ck_fun d1 S 507hintseval eval hints ck_svconst s$ 508entereval eval "string" ck_eval du% S? 509leaveeval eval "string" exit ck_null 1 S 510entertry eval {block} ck_eval d| 511leavetry eval {block} exit ck_null @ 512 513# Get system info. 514 515ghbyname gethostbyname ck_fun % S 516ghbyaddr gethostbyaddr ck_fun @ S S 517ghostent gethostent ck_null 0 518gnbyname getnetbyname ck_fun % S 519gnbyaddr getnetbyaddr ck_fun @ S S 520gnetent getnetent ck_null 0 521gpbyname getprotobyname ck_fun % S 522gpbynumber getprotobynumber ck_fun @ S 523gprotoent getprotoent ck_null 0 524gsbyname getservbyname ck_fun @ S S 525gsbyport getservbyport ck_fun @ S S 526gservent getservent ck_null 0 527shostent sethostent ck_fun is% S 528snetent setnetent ck_fun is% S 529sprotoent setprotoent ck_fun is% S 530sservent setservent ck_fun is% S 531ehostent endhostent ck_null is0 532enetent endnetent ck_null is0 533eprotoent endprotoent ck_null is0 534eservent endservent ck_null is0 535gpwnam getpwnam ck_fun % S 536gpwuid getpwuid ck_fun % S 537gpwent getpwent ck_null 0 538spwent setpwent ck_null is0 539epwent endpwent ck_null is0 540ggrnam getgrnam ck_fun % S 541ggrgid getgrgid ck_fun % S 542ggrent getgrent ck_null 0 543sgrent setgrent ck_null is0 544egrent endgrent ck_null is0 545getlogin getlogin ck_null st0 546 547# Miscellaneous. 548 549syscall syscall ck_fun imst@ S L 550 551# For multi-threading 552lock lock ck_rfun s% R 553 554# For state support 555 556once once ck_null | 557 558custom unknown custom operator ck_null 0 559 560# For CORE:: subs 561coreargs CORE:: subroutine ck_null $ 562avhvswitch Array/hash switch ck_null t1 563 564runcv __SUB__ ck_null s0 565 566# fc and \F 567fc fc ck_fun fstu% S? 568 569padcv private subroutine ck_null d0 570introcv private subroutine ck_null d0 571clonecv private subroutine ck_null d0 572padrange list of private variables ck_null d0 573refassign lvalue ref assignment ck_refassign ds2 574lvref lvalue ref assignment ck_null d% 575lvrefslice lvalue ref assignment ck_null d@ 576lvavref lvalue array reference ck_null d% 577anonconst anonymous constant ck_null ds1 578 579isa derived class test ck_isa s2 580 581cmpchain_and comparison chaining ck_null | 582cmpchain_dup comparand shuffling ck_null 1 583 584entertrycatch try {block} ck_trycatch | 585leavetrycatch try {block} exit ck_null @ 586poptry pop try ck_null @ 587catch catch {} block ck_null | 588pushdefer push defer {} block ck_null | 589 590is_bool boolean type test ck_null fs1 591is_weak weakref type test ck_null fs1 592weaken reference weaken ck_null 1 593unweaken reference unweaken ck_null 1 594blessed blessed ck_null fs1 595refaddr refaddr ck_null fsT1 596reftype reftype ck_null fsT1 597ceil ceil ck_null fsT1 598floor floor ck_null fsT1 599is_tainted is_tainted ck_null fs1 600 601# exists-or; not currently exposed as a Perl-callable op 602helemexistsor hash element exists or ck_helemexistsor | S S 603 604methstart method start ck_null + 605initfield initialise field ck_null + 606