1 # New ops always go at the end
2 # The restriction on having custom as the last op has been removed
4 # A recapitulation of the format of this file:
5 # The file consists of five columns: the name of the op, an English
6 # description, the name of the "check" routine used to optimize this
7 # operation, some flags, and a description of the operands.
9 # The flags consist of options followed by a mandatory op class signifier
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 - ;
19 # needs stack mark - m
20 # needs constant folding - f
21 # produces a scalar - s
22 # produces an integer - i
24 # target can be in a pad - T
25 # has a corresponding integer version - I
26 # has side effects - d
27 # uses $_ if no argument given - u
29 # Values for the operands are:
30 # scalar - S list - L array - A
31 # hash - H sub (CV) - C file - F
32 # socket - Fs filetest - F- filetest_access - F-+
35 # "?" denotes an optional operand.
39 null null operation ck_null 0
41 scalar scalar ck_fun s% S
45 pushmark pushmark ck_null s0
46 wantarray wantarray ck_null is0
48 const constant item ck_svconst s$
50 gvsv scalar variable ck_null ds$
51 gv glob value ck_null ds$
52 gelem glob elem ck_null d2 S S
53 padsv private variable ck_null ds0
54 padav private array ck_null d0
55 padhv private hash ck_null d0
56 padany private value ck_null d0
58 pushre push regexp ck_null d/
60 # References and stuff.
62 rv2gv ref-to-glob cast ck_rvconst ds1
63 rv2sv scalar dereference ck_rvconst ds1
64 av2arylen array length ck_null is1
65 rv2cv subroutine dereference ck_rvconst d1
66 anoncode anonymous subroutine ck_anoncode $
67 prototype subroutine prototype ck_null s% S
68 refgen reference constructor ck_spair m1 L
69 srefgen single ref constructor ck_null fs1 S
70 ref reference-type operator ck_fun stu% S?
71 bless bless ck_fun s@ S S?
75 backtick quoted execution (``, qx) ck_open tu% S?
76 # glob defaults its first arg to $_
77 glob glob ck_glob t@ S?
78 readline <HANDLE> ck_readline t% F?
79 rcatline append I/O operator ck_null t$
83 regcmaybe regexp internal guard ck_fun s1 S
84 regcreset regexp internal reset ck_fun s1 S
85 regcomp regexp compilation ck_null s| S
86 match pattern match (m//) ck_match d/
87 qr pattern quote (qr//) ck_match s/
88 subst substitution (s///) ck_match dis/ S
89 substcont substitution iterator ck_null dis|
90 trans transliteration (tr///) ck_match is" S
91 # transr (the /r version) is further down.
94 # sassign is special-cased for op class
96 sassign scalar assignment ck_sassign s0
97 aassign list assignment ck_null t2 L L
99 chop chop ck_spair mts% L
100 schop scalar chop ck_null stu% S?
101 chomp chomp ck_spair mTs% L
102 schomp scalar chomp ck_null sTu% S?
103 defined defined operator ck_defined isu% S?
104 undef undef operator ck_lfun s% S?
105 study study ck_fun su% S?
106 pos match position ck_lfun stu% S?
108 preinc preincrement (++) ck_lfun dIs1 S
109 i_preinc integer preincrement (++) ck_lfun dis1 S
110 predec predecrement (--) ck_lfun dIs1 S
111 i_predec integer predecrement (--) ck_lfun dis1 S
112 postinc postincrement (++) ck_lfun dIst1 S
113 i_postinc integer postincrement (++) ck_lfun disT1 S
114 postdec postdecrement (--) ck_lfun dIst1 S
115 i_postdec integer postdecrement (--) ck_lfun disT1 S
117 # Ordinary operators.
119 pow exponentiation (**) ck_null fsT2 S S
121 multiply multiplication (*) ck_null IfsT2 S S
122 i_multiply integer multiplication (*) ck_null ifsT2 S S
123 divide division (/) ck_null IfsT2 S S
124 i_divide integer division (/) ck_null ifsT2 S S
125 modulo modulus (%) ck_null IifsT2 S S
126 i_modulo integer modulus (%) ck_null ifsT2 S S
127 repeat repeat (x) ck_repeat mt2 L S
129 add addition (+) ck_null IfsT2 S S
130 i_add integer addition (+) ck_null ifsT2 S S
131 subtract subtraction (-) ck_null IfsT2 S S
132 i_subtract integer subtraction (-) ck_null ifsT2 S S
133 concat concatenation (.) or string ck_concat fsT2 S S
134 stringify string ck_fun fsT@ S
136 left_shift left bitshift (<<) ck_bitop fsT2 S S
137 right_shift right bitshift (>>) ck_bitop fsT2 S S
139 lt numeric lt (<) ck_null Iifs2 S S
140 i_lt integer lt (<) ck_null ifs2 S S
141 gt numeric gt (>) ck_null Iifs2 S S
142 i_gt integer gt (>) ck_null ifs2 S S
143 le numeric le (<=) ck_null Iifs2 S S
144 i_le integer le (<=) ck_null ifs2 S S
145 ge numeric ge (>=) ck_null Iifs2 S S
146 i_ge integer ge (>=) ck_null ifs2 S S
147 eq numeric eq (==) ck_null Iifs2 S S
148 i_eq integer eq (==) ck_null ifs2 S S
149 ne numeric ne (!=) ck_null Iifs2 S S
150 i_ne integer ne (!=) ck_null ifs2 S S
151 ncmp numeric comparison (<=>) ck_null Iifst2 S S
152 i_ncmp integer comparison (<=>) ck_null ifst2 S S
154 slt string lt ck_null ifs2 S S
155 sgt string gt ck_null ifs2 S S
156 sle string le ck_null ifs2 S S
157 sge string ge ck_null ifs2 S S
158 seq string eq ck_null ifs2 S S
159 sne string ne ck_null ifs2 S S
160 scmp string comparison (cmp) ck_null ifst2 S S
162 bit_and bitwise and (&) ck_bitop fst2 S S
163 bit_xor bitwise xor (^) ck_bitop fst2 S S
164 bit_or bitwise or (|) ck_bitop fst2 S S
166 negate negation (-) ck_null Ifst1 S
167 i_negate integer negation (-) ck_null ifsT1 S
168 not not ck_null ifs1 S
169 complement 1's complement (~) ck_bitop fst1 S
171 smartmatch smart match ck_smartmatch s2
173 # High falutin' math.
175 atan2 atan2 ck_fun fsT@ S S
176 sin sin ck_fun fsTu% S?
177 cos cos ck_fun fsTu% S?
178 rand rand ck_fun sT% S?
179 srand srand ck_fun sT% S?
180 exp exp ck_fun fsTu% S?
181 log log ck_fun fsTu% S?
182 sqrt sqrt ck_fun fsTu% S?
186 int int ck_fun fsTu% S?
187 hex hex ck_fun fsTu% S?
188 oct oct ck_fun fsTu% S?
189 abs abs ck_fun fsTu% S?
193 length length ck_fun ifsTu% S?
194 substr substr ck_substr st@ S S S? S?
195 vec vec ck_fun ist@ S S S
197 index index ck_index isT@ S S S?
198 rindex rindex ck_index isT@ S S S?
200 sprintf sprintf ck_fun fmst@ S L
201 formline formline ck_fun ms@ S L
202 ord ord ck_fun ifsTu% S?
203 chr chr ck_fun fsTu% S?
204 crypt crypt ck_fun fsT@ S S
205 ucfirst ucfirst ck_fun fstu% S?
206 lcfirst lcfirst ck_fun fstu% S?
207 uc uc ck_fun fstu% S?
208 lc lc ck_fun fstu% S?
209 quotemeta quotemeta ck_fun fstu% S?
213 rv2av array dereference ck_rvconst dt1
214 aelemfast constant array element ck_null s$ A S
215 aelem array element ck_null s2 A S
216 aslice array slice ck_null m@ A L
218 aeach each on array ck_each % A
219 akeys keys on array ck_each t% A
220 avalues values on array ck_each t% A
224 each each ck_each % H
225 values values ck_each t% H
226 keys keys ck_each t% H
227 delete delete ck_delete % S
228 exists exists ck_exists is% S
229 rv2hv hash dereference ck_rvconst dt1
230 helem hash element ck_null s2 H S
231 hslice hash slice ck_null m@ H L
232 boolkeys boolkeys ck_fun % H
234 # Explosives and implosives.
236 unpack unpack ck_unpack @ S S?
237 pack pack ck_fun mst@ S L
238 split split ck_split t@ S S S
239 join join or string ck_join mst@ S L
243 list list ck_null m@ L
244 lslice list slice ck_null 2 H L L
245 anonlist anonymous list ([]) ck_fun ms@ L
246 anonhash anonymous hash ({}) ck_fun ms@ L
248 splice splice ck_push m@ A S? S? L
249 push push ck_push imsT@ A L
250 pop pop ck_shift s% A?
251 shift shift ck_shift s% A?
252 unshift unshift ck_push imsT@ A L
253 sort sort ck_sort dm@ C? L
254 reverse reverse ck_fun mt@ L
256 grepstart grep ck_grep dm@ C L
257 grepwhile grep iterator ck_null dt|
259 mapstart map ck_grep dm@ C L
260 mapwhile map iterator ck_null dt|
264 range flipflop ck_null | S S
265 flip range (or flip) ck_null 1 S S
266 flop range (or flop) ck_null 1
270 and logical and (&&) ck_null |
271 or logical or (||) ck_null |
272 xor logical xor ck_null fs2 S S
273 dor defined or (//) ck_null |
274 cond_expr conditional expression ck_null d|
275 andassign logical and assignment (&&=) ck_null s|
276 orassign logical or assignment (||=) ck_null s|
277 dorassign defined or assignment (//=) ck_null s|
279 method method lookup ck_method d1
280 entersub subroutine entry ck_subr dmt1 L
281 leavesub subroutine exit ck_null 1
282 leavesublv lvalue subroutine return ck_null 1
283 caller caller ck_fun t% S?
284 warn warn ck_fun imst@ L
285 die die ck_die dimst@ L
286 reset symbol reset ck_fun is% S?
288 lineseq line sequence ck_null @
289 nextstate next statement ck_null s;
290 dbstate debug next statement ck_null s;
291 unstack iteration finalizer ck_null s0
292 enter block entry ck_null 0
293 leave block exit ck_null @
294 scope block ck_null @
295 enteriter foreach loop entry ck_null d{
296 iter foreach loop iterator ck_null 0
297 enterloop loop entry ck_null d{
298 leaveloop loop exit ck_null 2
299 return return ck_return dm@ L
300 last last ck_null ds}
301 next next ck_null ds}
302 redo redo ck_null ds}
303 dump dump ck_null ds}
304 goto goto ck_null ds}
305 exit exit ck_exit ds% S?
306 method_named method with known name ck_null d$
308 entergiven given() ck_null d|
309 leavegiven leave given block ck_null 1
310 enterwhen when() ck_null d|
311 leavewhen leave when block ck_null 1
312 break break ck_null 0
313 continue continue ck_null 0
317 open open ck_open ismt@ F S? L
318 close close ck_fun is% F?
319 pipe_op pipe ck_fun is@ F F
321 fileno fileno ck_fun ist% F
322 umask umask ck_fun ist% S?
323 binmode binmode ck_fun s@ F S?
325 tie tie ck_fun idms@ R S L
326 untie untie ck_fun is% R
327 tied tied ck_fun s% R
328 dbmopen dbmopen ck_fun is@ H S S
329 dbmclose dbmclose ck_fun is% H
331 sselect select system call ck_select t@ S S S S
332 select select ck_select st@ F?
334 getc getc ck_eof st% F?
335 read read ck_fun imst@ F R S S?
336 enterwrite write ck_fun dis% F?
337 leavewrite write exit ck_null 1
339 prtf printf ck_listiob ims@ F? L
340 print print ck_listiob ims@ F? L
341 say say ck_listiob ims@ F? L
343 sysopen sysopen ck_fun s@ F S S S?
344 sysseek sysseek ck_fun s@ F S S
345 sysread sysread ck_fun imst@ F R S S?
346 syswrite syswrite ck_fun imst@ F S S? S?
348 eof eof ck_eof is% F?
349 tell tell ck_fun st% F?
350 seek seek ck_fun s@ F S S
351 # truncate really behaves as if it had both "S S" and "F S"
352 truncate truncate ck_trunc is@ S S
354 fcntl fcntl ck_fun st@ F S S
355 ioctl ioctl ck_fun st@ F S S
356 flock flock ck_fun isT@ F S
358 # Sockets. OP_IS_SOCKET wants them consecutive (so moved 1st 2)
360 send send ck_fun imst@ Fs S S S?
361 recv recv ck_fun imst@ Fs R S S
363 socket socket ck_fun is@ Fs S S S
364 sockpair socketpair ck_fun is@ Fs Fs S S S
366 bind bind ck_fun is@ Fs S
367 connect connect ck_fun is@ Fs S
368 listen listen ck_fun is@ Fs S
369 accept accept ck_fun ist@ Fs Fs
370 shutdown shutdown ck_fun ist@ Fs S
372 gsockopt getsockopt ck_fun is@ Fs S S
373 ssockopt setsockopt ck_fun is@ Fs S S S
375 getsockname getsockname ck_fun is% Fs
376 getpeername getpeername ck_fun is% Fs
378 # Stat calls. OP_IS_FILETEST wants them consecutive.
380 lstat lstat ck_ftst u- F
381 stat stat ck_ftst u- F
382 ftrread -R ck_ftst isu- F-+
383 ftrwrite -W ck_ftst isu- F-+
384 ftrexec -X ck_ftst isu- F-+
385 fteread -r ck_ftst isu- F-+
386 ftewrite -w ck_ftst isu- F-+
387 fteexec -x ck_ftst isu- F-+
388 ftis -e ck_ftst isu- F-
389 ftsize -s ck_ftst istu- F-
390 ftmtime -M ck_ftst stu- F-
391 ftatime -A ck_ftst stu- F-
392 ftctime -C ck_ftst stu- F-
393 ftrowned -O ck_ftst isu- F-
394 fteowned -o ck_ftst isu- F-
395 ftzero -z ck_ftst isu- F-
396 ftsock -S ck_ftst isu- F-
397 ftchr -c ck_ftst isu- F-
398 ftblk -b ck_ftst isu- F-
399 ftfile -f ck_ftst isu- F-
400 ftdir -d ck_ftst isu- F-
401 ftpipe -p ck_ftst isu- F-
402 ftsuid -u ck_ftst isu- F-
403 ftsgid -g ck_ftst isu- F-
404 ftsvtx -k ck_ftst isu- F-
405 ftlink -l ck_ftst isu- F-
406 fttty -t ck_ftst is- F-
407 fttext -T ck_ftst isu- F-
408 ftbinary -B ck_ftst isu- F-
412 # chdir really behaves as if it had both "S?" and "F?"
413 chdir chdir ck_chdir isT% S?
414 chown chown ck_fun imsT@ L
415 chroot chroot ck_fun isTu% S?
416 unlink unlink ck_fun imsTu@ L
417 chmod chmod ck_fun imsT@ L
418 utime utime ck_fun imsT@ L
419 rename rename ck_fun isT@ S S
420 link link ck_fun isT@ S S
421 symlink symlink ck_fun isT@ S S
422 readlink readlink ck_fun stu% S?
423 mkdir mkdir ck_fun isTu@ S? S?
424 rmdir rmdir ck_fun isTu% S?
428 open_dir opendir ck_fun is@ F S
429 readdir readdir ck_fun % F
430 telldir telldir ck_fun st% F
431 seekdir seekdir ck_fun s@ F S
432 rewinddir rewinddir ck_fun s% F
433 closedir closedir ck_fun is% F
437 fork fork ck_null ist0
438 wait wait ck_null isT0
439 waitpid waitpid ck_fun isT@ S S
440 system system ck_exec imsT@ S? L
441 exec exec ck_exec dimsT@ S? L
442 kill kill ck_fun dimsT@ L
443 getppid getppid ck_null isT0
444 getpgrp getpgrp ck_fun isT% S?
445 setpgrp setpgrp ck_fun isT@ S? S?
446 getpriority getpriority ck_fun isT@ S S
447 setpriority setpriority ck_fun isT@ S S S
451 time time ck_null isT0
453 localtime localtime ck_fun t% S?
454 gmtime gmtime ck_fun t% S?
455 alarm alarm ck_fun istu% S?
456 sleep sleep ck_fun isT% S?
460 shmget shmget ck_fun imst@ S S S
461 shmctl shmctl ck_fun imst@ S S S
462 shmread shmread ck_fun imst@ S S S S
463 shmwrite shmwrite ck_fun imst@ S S S S
467 msgget msgget ck_fun imst@ S S
468 msgctl msgctl ck_fun imst@ S S S
469 msgsnd msgsnd ck_fun imst@ S S S
470 msgrcv msgrcv ck_fun imst@ S S S S S
474 semop semop ck_fun imst@ S S
475 semget semget ck_fun imst@ S S S
476 semctl semctl ck_fun imst@ S S S S
480 require require ck_require du% S?
481 dofile do "file" ck_fun d1 S
482 hintseval eval hints ck_svconst s$
483 entereval eval "string" ck_eval d% S
484 leaveeval eval "string" exit ck_null 1 S
485 #evalonce eval constant string ck_null d1 S
486 entertry eval {block} ck_eval d|
487 leavetry eval {block} exit ck_null @
491 ghbyname gethostbyname ck_fun % S
492 ghbyaddr gethostbyaddr ck_fun @ S S
493 ghostent gethostent ck_null 0
494 gnbyname getnetbyname ck_fun % S
495 gnbyaddr getnetbyaddr ck_fun @ S S
496 gnetent getnetent ck_null 0
497 gpbyname getprotobyname ck_fun % S
498 gpbynumber getprotobynumber ck_fun @ S
499 gprotoent getprotoent ck_null 0
500 gsbyname getservbyname ck_fun @ S S
501 gsbyport getservbyport ck_fun @ S S
502 gservent getservent ck_null 0
503 shostent sethostent ck_fun is% S
504 snetent setnetent ck_fun is% S
505 sprotoent setprotoent ck_fun is% S
506 sservent setservent ck_fun is% S
507 ehostent endhostent ck_null is0
508 enetent endnetent ck_null is0
509 eprotoent endprotoent ck_null is0
510 eservent endservent ck_null is0
511 gpwnam getpwnam ck_fun % S
512 gpwuid getpwuid ck_fun % S
513 gpwent getpwent ck_null 0
514 spwent setpwent ck_null is0
515 epwent endpwent ck_null is0
516 ggrnam getgrnam ck_fun % S
517 ggrgid getgrgid ck_fun % S
518 ggrent getgrent ck_null 0
519 sgrent setgrent ck_null is0
520 egrent endgrent ck_null is0
521 getlogin getlogin ck_null st0
525 syscall syscall ck_fun imst@ S L
527 # For multi-threading
528 lock lock ck_rfun s% R
534 custom unknown custom operator ck_null 0
536 # For smart dereference for each/keys/values
537 reach each on reference ck_each % S
538 rkeys keys on reference ck_each t% S
539 rvalues values on reference ck_each t% S
542 transr transliteration (tr///) ck_match is" S