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
92 transr transliteration (tr///) ck_match is" S
95 # sassign is special-cased for op class
97 sassign scalar assignment ck_sassign s0
98 aassign list assignment ck_null t2 L L
100 chop chop ck_spair mts% L
101 schop scalar chop ck_null stu% S?
102 chomp chomp ck_spair mTs% L
103 schomp scalar chomp ck_null sTu% S?
104 defined defined operator ck_defined isu% S?
105 undef undef operator ck_lfun s% S?
106 study study ck_fun su% S?
107 pos match position ck_lfun stu% S?
109 preinc preincrement (++) ck_lfun dIs1 S
110 i_preinc integer preincrement (++) ck_lfun dis1 S
111 predec predecrement (--) ck_lfun dIs1 S
112 i_predec integer predecrement (--) ck_lfun dis1 S
113 postinc postincrement (++) ck_lfun dIst1 S
114 i_postinc integer postincrement (++) ck_lfun disT1 S
115 postdec postdecrement (--) ck_lfun dIst1 S
116 i_postdec integer postdecrement (--) ck_lfun disT1 S
118 # Ordinary operators.
120 pow exponentiation (**) ck_null fsT2 S S
122 multiply multiplication (*) ck_null IfsT2 S S
123 i_multiply integer multiplication (*) ck_null ifsT2 S S
124 divide division (/) ck_null IfsT2 S S
125 i_divide integer division (/) ck_null ifsT2 S S
126 modulo modulus (%) ck_null IifsT2 S S
127 i_modulo integer modulus (%) ck_null ifsT2 S S
128 repeat repeat (x) ck_repeat mt2 L S
130 add addition (+) ck_null IfsT2 S S
131 i_add integer addition (+) ck_null ifsT2 S S
132 subtract subtraction (-) ck_null IfsT2 S S
133 i_subtract integer subtraction (-) ck_null ifsT2 S S
134 concat concatenation (.) or string ck_concat fsT2 S S
135 stringify string ck_fun fsT@ S
137 left_shift left bitshift (<<) ck_bitop fsT2 S S
138 right_shift right bitshift (>>) ck_bitop fsT2 S S
140 lt numeric lt (<) ck_null Iifs2 S S
141 i_lt integer lt (<) ck_null ifs2 S S
142 gt numeric gt (>) ck_null Iifs2 S S
143 i_gt integer gt (>) ck_null ifs2 S S
144 le numeric le (<=) ck_null Iifs2 S S
145 i_le integer le (<=) ck_null ifs2 S S
146 ge numeric ge (>=) ck_null Iifs2 S S
147 i_ge integer ge (>=) ck_null ifs2 S S
148 eq numeric eq (==) ck_null Iifs2 S S
149 i_eq integer eq (==) ck_null ifs2 S S
150 ne numeric ne (!=) ck_null Iifs2 S S
151 i_ne integer ne (!=) ck_null ifs2 S S
152 ncmp numeric comparison (<=>) ck_null Iifst2 S S
153 i_ncmp integer comparison (<=>) ck_null ifst2 S S
155 slt string lt ck_null ifs2 S S
156 sgt string gt ck_null ifs2 S S
157 sle string le ck_null ifs2 S S
158 sge string ge ck_null ifs2 S S
159 seq string eq ck_null ifs2 S S
160 sne string ne ck_null ifs2 S S
161 scmp string comparison (cmp) ck_null ifst2 S S
163 bit_and bitwise and (&) ck_bitop fst2 S S
164 bit_xor bitwise xor (^) ck_bitop fst2 S S
165 bit_or bitwise or (|) ck_bitop fst2 S S
167 negate negation (-) ck_null Ifst1 S
168 i_negate integer negation (-) ck_null ifsT1 S
169 not not ck_null ifs1 S
170 complement 1's complement (~) ck_bitop fst1 S
172 smartmatch smart match ck_smartmatch s2
174 # High falutin' math.
176 atan2 atan2 ck_fun fsT@ S S
177 sin sin ck_fun fsTu% S?
178 cos cos ck_fun fsTu% S?
179 rand rand ck_fun sT% S?
180 srand srand ck_fun sT% S?
181 exp exp ck_fun fsTu% S?
182 log log ck_fun fsTu% S?
183 sqrt sqrt ck_fun fsTu% S?
187 int int ck_fun fsTu% S?
188 hex hex ck_fun fsTu% S?
189 oct oct ck_fun fsTu% S?
190 abs abs ck_fun fsTu% S?
194 length length ck_fun ifsTu% S?
195 substr substr ck_substr st@ S S S? S?
196 vec vec ck_fun ist@ S S S
198 index index ck_index isT@ S S S?
199 rindex rindex ck_index isT@ S S S?
201 sprintf sprintf ck_fun fmst@ S L
202 formline formline ck_fun ms@ S L
203 ord ord ck_fun ifsTu% S?
204 chr chr ck_fun fsTu% S?
205 crypt crypt ck_fun fsT@ S S
206 ucfirst ucfirst ck_fun fstu% S?
207 lcfirst lcfirst ck_fun fstu% S?
208 uc uc ck_fun fstu% S?
209 lc lc ck_fun fstu% S?
210 quotemeta quotemeta ck_fun fstu% S?
214 rv2av array dereference ck_rvconst dt1
215 aelemfast constant array element ck_null s$ A S
216 aelemfast_lex constant lexical array element ck_null d0 A S
217 aelem array element ck_null s2 A S
218 aslice array slice ck_null m@ A L
220 aeach each on array ck_each % A
221 akeys keys on array ck_each t% A
222 avalues values on array ck_each t% A
226 each each ck_each % H
227 values values ck_each t% H
228 keys keys ck_each t% H
229 delete delete ck_delete % S
230 exists exists ck_exists is% S
231 rv2hv hash dereference ck_rvconst dt1
232 helem hash element ck_null s2 H S
233 hslice hash slice ck_null m@ H L
234 boolkeys boolkeys ck_fun % H
236 # Explosives and implosives.
238 unpack unpack ck_fun u@ S S?
239 pack pack ck_fun mst@ S L
240 split split ck_split t@ S S S
241 join join or string ck_join mst@ S L
245 list list ck_null m@ L
246 lslice list slice ck_null 2 H L L
247 anonlist anonymous list ([]) ck_fun ms@ L
248 anonhash anonymous hash ({}) ck_fun ms@ L
250 splice splice ck_fun m@ A S? S? L
251 push push ck_fun imsT@ A L
252 pop pop ck_shift s% A?
253 shift shift ck_shift s% A?
254 unshift unshift ck_fun imsT@ A L
255 sort sort ck_sort dm@ C? L
256 reverse reverse ck_fun mt@ L
258 grepstart grep ck_grep dm@ C L
259 grepwhile grep iterator ck_null dt|
261 mapstart map ck_grep dm@ C L
262 mapwhile map iterator ck_null dt|
266 range flipflop ck_null | S S
267 flip range (or flip) ck_null 1 S S
268 flop range (or flop) ck_null 1
272 and logical and (&&) ck_null |
273 or logical or (||) ck_null |
274 xor logical xor ck_null fs2 S S
275 dor defined or (//) ck_null |
276 cond_expr conditional expression ck_null d|
277 andassign logical and assignment (&&=) ck_null s|
278 orassign logical or assignment (||=) ck_null s|
279 dorassign defined or assignment (//=) ck_null s|
281 method method lookup ck_method d1
282 entersub subroutine entry ck_subr dmt1 L
283 leavesub subroutine exit ck_null 1
284 leavesublv lvalue subroutine return ck_null 1
285 caller caller ck_fun t% S?
286 warn warn ck_fun imst@ L
287 die die ck_die dimst@ L
288 reset symbol reset ck_fun is% S?
290 lineseq line sequence ck_null @
291 nextstate next statement ck_null s;
292 dbstate debug next statement ck_null s;
293 unstack iteration finalizer ck_null s0
294 enter block entry ck_null 0
295 leave block exit ck_null @
296 scope block ck_null @
297 enteriter foreach loop entry ck_null d{
298 iter foreach loop iterator ck_null 0
299 enterloop loop entry ck_null d{
300 leaveloop loop exit ck_null 2
301 return return ck_return dm@ L
302 last last ck_null ds}
303 next next ck_null ds}
304 redo redo ck_null ds}
305 dump dump ck_null ds}
306 goto goto ck_null ds}
307 exit exit ck_exit ds% S?
308 method_named method with known name ck_null d$
310 entergiven given() ck_null d|
311 leavegiven leave given block ck_null 1
312 enterwhen when() ck_null d|
313 leavewhen leave when block ck_null 1
314 break break ck_null 0
315 continue continue ck_null 0
319 open open ck_open ismt@ F S? L
320 close close ck_fun is% F?
321 pipe_op pipe ck_fun is@ F F
323 fileno fileno ck_fun ist% F
324 umask umask ck_fun ist% S?
325 binmode binmode ck_fun s@ F S?
327 tie tie ck_fun idms@ R S L
328 untie untie ck_fun is% R
329 tied tied ck_fun s% R
330 dbmopen dbmopen ck_fun is@ H S S
331 dbmclose dbmclose ck_fun is% H
333 sselect select system call ck_select t@ S S S S
334 select select ck_select st@ F?
336 getc getc ck_eof st% F?
337 read read ck_fun imst@ F R S S?
338 enterwrite write ck_fun dis% F?
339 leavewrite write exit ck_null 1
341 prtf printf ck_listiob ims@ F? L
342 print print ck_listiob ims@ F? L
343 say say ck_listiob ims@ F? L
345 sysopen sysopen ck_fun s@ F S S S?
346 sysseek sysseek ck_fun s@ F S S
347 sysread sysread ck_fun imst@ F R S S?
348 syswrite syswrite ck_fun imst@ F S S? S?
350 eof eof ck_eof is% F?
351 tell tell ck_fun st% F?
352 seek seek ck_fun s@ F S S
353 # truncate really behaves as if it had both "S S" and "F S"
354 truncate truncate ck_trunc is@ S S
356 fcntl fcntl ck_fun st@ F S S
357 ioctl ioctl ck_fun st@ F S S
358 flock flock ck_fun isT@ F S
360 # Sockets. OP_IS_SOCKET wants them consecutive (so moved 1st 2)
362 send send ck_fun imst@ Fs S S S?
363 recv recv ck_fun imst@ Fs R S S
365 socket socket ck_fun is@ Fs S S S
366 sockpair socketpair ck_fun is@ Fs Fs S S S
368 bind bind ck_fun is@ Fs S
369 connect connect ck_fun is@ Fs S
370 listen listen ck_fun is@ Fs S
371 accept accept ck_fun ist@ Fs Fs
372 shutdown shutdown ck_fun ist@ Fs S
374 gsockopt getsockopt ck_fun is@ Fs S S
375 ssockopt setsockopt ck_fun is@ Fs S S S
377 getsockname getsockname ck_fun is% Fs
378 getpeername getpeername ck_fun is% Fs
380 # Stat calls. OP_IS_FILETEST wants them consecutive.
382 lstat lstat ck_ftst u- F?
383 stat stat ck_ftst u- F?
384 ftrread -R ck_ftst isu- F-+
385 ftrwrite -W ck_ftst isu- F-+
386 ftrexec -X ck_ftst isu- F-+
387 fteread -r ck_ftst isu- F-+
388 ftewrite -w ck_ftst isu- F-+
389 fteexec -x ck_ftst isu- F-+
390 ftis -e ck_ftst isu- F-
391 ftsize -s ck_ftst istu- F-
392 ftmtime -M ck_ftst stu- F-
393 ftatime -A ck_ftst stu- F-
394 ftctime -C ck_ftst stu- F-
395 ftrowned -O ck_ftst isu- F-
396 fteowned -o ck_ftst isu- F-
397 ftzero -z ck_ftst isu- F-
398 ftsock -S ck_ftst isu- F-
399 ftchr -c ck_ftst isu- F-
400 ftblk -b ck_ftst isu- F-
401 ftfile -f ck_ftst isu- F-
402 ftdir -d ck_ftst isu- F-
403 ftpipe -p ck_ftst isu- F-
404 ftsuid -u ck_ftst isu- F-
405 ftsgid -g ck_ftst isu- F-
406 ftsvtx -k ck_ftst isu- F-
407 ftlink -l ck_ftst isu- F-
408 fttty -t ck_ftst is- F-
409 fttext -T ck_ftst isu- F-
410 ftbinary -B ck_ftst isu- F-
414 # chdir really behaves as if it had both "S?" and "F?"
415 chdir chdir ck_chdir isT% S?
416 chown chown ck_fun imsT@ L
417 chroot chroot ck_fun isTu% S?
418 unlink unlink ck_fun imsTu@ L
419 chmod chmod ck_fun imsT@ L
420 utime utime ck_fun imsT@ L
421 rename rename ck_fun isT@ S S
422 link link ck_fun isT@ S S
423 symlink symlink ck_fun isT@ S S
424 readlink readlink ck_fun stu% S?
425 mkdir mkdir ck_fun isTu@ S? S?
426 rmdir rmdir ck_fun isTu% S?
430 open_dir opendir ck_fun is@ F S
431 readdir readdir ck_fun % F
432 telldir telldir ck_fun st% F
433 seekdir seekdir ck_fun s@ F S
434 rewinddir rewinddir ck_fun s% F
435 closedir closedir ck_fun is% F
439 fork fork ck_null ist0
440 wait wait ck_null isT0
441 waitpid waitpid ck_fun isT@ S S
442 system system ck_exec imsT@ S? L
443 exec exec ck_exec dimsT@ S? L
444 kill kill ck_fun dimsT@ L
445 getppid getppid ck_null isT0
446 getpgrp getpgrp ck_fun isT% S?
447 setpgrp setpgrp ck_fun isT@ S? S?
448 getpriority getpriority ck_fun isT@ S S
449 setpriority setpriority ck_fun isT@ S S S
453 time time ck_null isT0
455 localtime localtime ck_fun t% S?
456 gmtime gmtime ck_fun t% S?
457 alarm alarm ck_fun istu% S?
458 sleep sleep ck_fun isT% S?
462 shmget shmget ck_fun imst@ S S S
463 shmctl shmctl ck_fun imst@ S S S
464 shmread shmread ck_fun imst@ S S S S
465 shmwrite shmwrite ck_fun imst@ S S S S
469 msgget msgget ck_fun imst@ S S
470 msgctl msgctl ck_fun imst@ S S S
471 msgsnd msgsnd ck_fun imst@ S S S
472 msgrcv msgrcv ck_fun imst@ S S S S S
476 semop semop ck_fun imst@ S S
477 semget semget ck_fun imst@ S S S
478 semctl semctl ck_fun imst@ S S S S
482 require require ck_require du% S?
483 dofile do "file" ck_fun d1 S
484 hintseval eval hints ck_svconst s$
485 entereval eval "string" ck_eval d% S
486 leaveeval eval "string" exit ck_null 1 S
487 #evalonce eval constant string ck_null d1 S
488 entertry eval {block} ck_eval d|
489 leavetry eval {block} exit ck_null @
493 ghbyname gethostbyname ck_fun % S
494 ghbyaddr gethostbyaddr ck_fun @ S S
495 ghostent gethostent ck_null 0
496 gnbyname getnetbyname ck_fun % S
497 gnbyaddr getnetbyaddr ck_fun @ S S
498 gnetent getnetent ck_null 0
499 gpbyname getprotobyname ck_fun % S
500 gpbynumber getprotobynumber ck_fun @ S
501 gprotoent getprotoent ck_null 0
502 gsbyname getservbyname ck_fun @ S S
503 gsbyport getservbyport ck_fun @ S S
504 gservent getservent ck_null 0
505 shostent sethostent ck_fun is% S
506 snetent setnetent ck_fun is% S
507 sprotoent setprotoent ck_fun is% S
508 sservent setservent ck_fun is% S
509 ehostent endhostent ck_null is0
510 enetent endnetent ck_null is0
511 eprotoent endprotoent ck_null is0
512 eservent endservent ck_null is0
513 gpwnam getpwnam ck_fun % S
514 gpwuid getpwuid ck_fun % S
515 gpwent getpwent ck_null 0
516 spwent setpwent ck_null is0
517 epwent endpwent ck_null is0
518 ggrnam getgrnam ck_fun % S
519 ggrgid getgrgid ck_fun % S
520 ggrent getgrent ck_null 0
521 sgrent setgrent ck_null is0
522 egrent endgrent ck_null is0
523 getlogin getlogin ck_null st0
527 syscall syscall ck_fun imst@ S L
529 # For multi-threading
530 lock lock ck_rfun s% R
536 custom unknown custom operator ck_null 0
538 # For smart dereference for each/keys/values
539 reach each on reference ck_each % S
540 rkeys keys on reference ck_each t% S
541 rvalues values on reference ck_each t% S
544 coreargs CORE:: subroutine ck_null $