This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlop: #109408
[perl5.git] / regen / opcodes
CommitLineData
f8a58b02
NC
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 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.
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 - ;
17
18# Other options are:
19# needs stack mark - m
20# needs constant folding - f
21# produces a scalar - s
22# produces an integer - i
23# needs a target - t
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
28
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-+
332c2eac 33# num-compare - S< dirhandle - DF
f8a58b02
NC
34
35# reference - R
36# "?" denotes an optional operand.
37
38# Nothing.
39
40null null operation ck_null 0
41stub stub ck_null 0
42scalar scalar ck_fun s% S
43
44# Pushy stuff.
45
46pushmark pushmark ck_null s0
47wantarray wantarray ck_null is0
48
49const constant item ck_svconst s$
50
51gvsv scalar variable ck_null ds$
52gv glob value ck_null ds$
53gelem glob elem ck_null d2 S S
54padsv private variable ck_null ds0
55padav private array ck_null d0
56padhv private hash ck_null d0
57padany private value ck_null d0
58
59pushre push regexp ck_null d/
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 $
68prototype subroutine prototype ck_null s% 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_open 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 d/
88qr pattern quote (qr//) ck_match s/
89subst substitution (s///) ck_match dis/ S
90substcont substitution iterator ck_null dis|
91trans transliteration (tr///) ck_match is" S
bfa14884
NC
92# y///r
93transr transliteration (tr///) ck_match is" S
f8a58b02
NC
94
95# Lvalue operators.
96# sassign is special-cased for op class
97
98sassign scalar assignment ck_sassign s0
99aassign list assignment ck_null t2 L L
100
101chop chop ck_spair mts% L
102schop scalar chop ck_null stu% S?
103chomp chomp ck_spair mTs% L
104schomp scalar chomp ck_null sTu% S?
105defined defined operator ck_defined isu% S?
89c5c07e 106undef undef operator ck_fun s% R?
f8a58b02 107study study ck_fun su% S?
abe56f58 108pos match position ck_fun stu% R?
f8a58b02
NC
109
110preinc preincrement (++) ck_lfun dIs1 S
111i_preinc integer preincrement (++) ck_lfun dis1 S
112predec predecrement (--) ck_lfun dIs1 S
113i_predec integer predecrement (--) ck_lfun dis1 S
114postinc postincrement (++) ck_lfun dIst1 S
115i_postinc integer postincrement (++) ck_lfun disT1 S
116postdec postdecrement (--) ck_lfun dIst1 S
117i_postdec integer postdecrement (--) ck_lfun disT1 S
118
119# Ordinary operators.
120
121pow exponentiation (**) ck_null fsT2 S S
122
123multiply multiplication (*) ck_null IfsT2 S S
124i_multiply integer multiplication (*) ck_null ifsT2 S S
125divide division (/) ck_null IfsT2 S S
126i_divide integer division (/) ck_null ifsT2 S S
127modulo modulus (%) ck_null IifsT2 S S
128i_modulo integer modulus (%) ck_null ifsT2 S S
baed7faa 129repeat repeat (x) ck_repeat fmt2 L S
f8a58b02
NC
130
131add addition (+) ck_null IfsT2 S S
132i_add integer addition (+) ck_null ifsT2 S S
133subtract subtraction (-) ck_null IfsT2 S S
134i_subtract integer subtraction (-) ck_null ifsT2 S S
135concat concatenation (.) or string ck_concat fsT2 S S
136stringify string ck_fun fsT@ S
137
138left_shift left bitshift (<<) ck_bitop fsT2 S S
139right_shift right bitshift (>>) ck_bitop fsT2 S S
140
89474f50
FC
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<
2b420b63
JC
149eq numeric eq (==) ck_null Iifs2 S S<
150i_eq integer eq (==) ck_null ifs2 S S<
151ne numeric ne (!=) ck_null Iifs2 S S<
152i_ne integer ne (!=) ck_null ifs2 S S<
153ncmp numeric comparison (<=>) ck_null Iifst2 S S<
154i_ncmp integer comparison (<=>) ck_null ifst2 S S<
f8a58b02
NC
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
167
168negate negation (-) ck_null Ifst1 S
169i_negate integer negation (-) ck_null ifsT1 S
170not not ck_null ifs1 S
171complement 1's complement (~) ck_bitop fst1 S
172
173smartmatch smart match ck_smartmatch s2
174
175# High falutin' math.
176
177atan2 atan2 ck_fun fsT@ S S
178sin sin ck_fun fsTu% S?
179cos cos ck_fun fsTu% S?
180rand rand ck_fun sT% S?
181srand srand ck_fun sT% S?
182exp exp ck_fun fsTu% S?
183log log ck_fun fsTu% S?
184sqrt sqrt ck_fun fsTu% S?
185
186# Lowbrow math.
187
188int int ck_fun fsTu% S?
189hex hex ck_fun fsTu% S?
190oct oct ck_fun fsTu% S?
191abs abs ck_fun fsTu% S?
192
193# String stuff.
194
e508c8a4 195length length ck_length ifsTu% S?
f8a58b02
NC
196substr substr ck_substr st@ S S S? S?
197vec vec ck_fun ist@ S S S
198
199index index ck_index isT@ S S S?
200rindex rindex ck_index isT@ S S S?
201
69974ce6 202sprintf sprintf ck_lfun fmst@ S L
f8a58b02
NC
203formline formline ck_fun ms@ S L
204ord ord ck_fun ifsTu% S?
205chr chr ck_fun fsTu% S?
206crypt crypt ck_fun fsT@ S S
207ucfirst ucfirst ck_fun fstu% S?
208lcfirst lcfirst ck_fun fstu% S?
209uc uc ck_fun fstu% S?
210lc lc ck_fun fstu% S?
211quotemeta quotemeta ck_fun fstu% S?
212
213# Arrays.
214
215rv2av array dereference ck_rvconst dt1
216aelemfast constant array element ck_null s$ A S
bfa14884 217aelemfast_lex constant lexical array element ck_null d0 A S
f8a58b02
NC
218aelem array element ck_null s2 A S
219aslice array slice ck_null m@ A L
220
221aeach each on array ck_each % A
222akeys keys on array ck_each t% A
223avalues values on array ck_each t% A
224
225# Hashes.
226
227each each ck_each % H
228values values ck_each t% H
229keys keys ck_each t% H
230delete delete ck_delete % S
231exists exists ck_exists is% S
232rv2hv hash dereference ck_rvconst dt1
233helem hash element ck_null s2 H S
234hslice hash slice ck_null m@ H L
235boolkeys boolkeys ck_fun % H
236
237# Explosives and implosives.
238
ea5703f4 239unpack unpack ck_fun u@ S S?
f8a58b02
NC
240pack pack ck_fun mst@ S L
241split split ck_split t@ S S S
242join join or string ck_join mst@ S L
243
244# List operators.
245
246list list ck_null m@ L
247lslice list slice ck_null 2 H L L
248anonlist anonymous list ([]) ck_fun ms@ L
249anonhash anonymous hash ({}) ck_fun ms@ L
250
d4fc4415
FC
251splice splice ck_fun m@ A S? S? L
252push push ck_fun imsT@ A L
f8a58b02
NC
253pop pop ck_shift s% A?
254shift shift ck_shift s% A?
d4fc4415 255unshift unshift ck_fun imsT@ A L
f8a58b02
NC
256sort sort ck_sort dm@ C? L
257reverse reverse ck_fun mt@ L
258
259grepstart grep ck_grep dm@ C L
260grepwhile grep iterator ck_null dt|
261
262mapstart map ck_grep dm@ C L
263mapwhile map iterator ck_null dt|
264
265# Range stuff.
266
267range flipflop ck_null | S S
268flip range (or flip) ck_null 1 S S
269flop range (or flop) ck_null 1
270
271# Control.
272
273and logical and (&&) ck_null |
274or logical or (||) ck_null |
275xor logical xor ck_null fs2 S S
276dor defined or (//) ck_null |
277cond_expr conditional expression ck_null d|
278andassign logical and assignment (&&=) ck_null s|
279orassign logical or assignment (||=) ck_null s|
280dorassign defined or assignment (//=) ck_null s|
281
282method method lookup ck_method d1
283entersub subroutine entry ck_subr dmt1 L
284leavesub subroutine exit ck_null 1
285leavesublv lvalue subroutine return ck_null 1
286caller caller ck_fun t% S?
287warn warn ck_fun imst@ L
288die die ck_die dimst@ L
289reset symbol reset ck_fun is% S?
290
291lineseq line sequence ck_null @
292nextstate next statement ck_null s;
293dbstate debug next statement ck_null s;
294unstack iteration finalizer ck_null s0
295enter block entry ck_null 0
296leave block exit ck_null @
297scope block ck_null @
298enteriter foreach loop entry ck_null d{
299iter foreach loop iterator ck_null 0
300enterloop loop entry ck_null d{
301leaveloop loop exit ck_null 2
302return return ck_return dm@ L
303last last ck_null ds}
304next next ck_null ds}
305redo redo ck_null ds}
306dump dump ck_null ds}
307goto goto ck_null ds}
308exit exit ck_exit ds% S?
309method_named method with known name ck_null d$
310
311entergiven given() ck_null d|
312leavegiven leave given block ck_null 1
313enterwhen when() ck_null d|
314leavewhen leave when block ck_null 1
315break break ck_null 0
316continue continue ck_null 0
317
318# I/O.
319
320open open ck_open ismt@ F S? L
321close close ck_fun is% F?
322pipe_op pipe ck_fun is@ F F
323
324fileno fileno ck_fun ist% F
325umask umask ck_fun ist% S?
326binmode binmode ck_fun s@ F S?
327
328tie tie ck_fun idms@ R S L
329untie untie ck_fun is% R
330tied tied ck_fun s% R
331dbmopen dbmopen ck_fun is@ H S S
332dbmclose dbmclose ck_fun is% H
333
334sselect select system call ck_select t@ S S S S
335select select ck_select st@ F?
336
337getc getc ck_eof st% F?
338read read ck_fun imst@ F R S S?
339enterwrite write ck_fun dis% F?
340leavewrite write exit ck_null 1
341
342prtf printf ck_listiob ims@ F? L
343print print ck_listiob ims@ F? L
344say say ck_listiob ims@ F? L
345
346sysopen sysopen ck_fun s@ F S S S?
347sysseek sysseek ck_fun s@ F S S
348sysread sysread ck_fun imst@ F R S S?
349syswrite syswrite ck_fun imst@ F S S? S?
350
351eof eof ck_eof is% F?
8dc99089 352tell tell ck_tell st% F?
423e8af5 353seek seek ck_tell s@ F S S
f8a58b02
NC
354# truncate really behaves as if it had both "S S" and "F S"
355truncate truncate ck_trunc is@ S S
356
357fcntl fcntl ck_fun st@ F S S
358ioctl ioctl ck_fun st@ F S S
359flock flock ck_fun isT@ F S
360
361# Sockets. OP_IS_SOCKET wants them consecutive (so moved 1st 2)
362
363send send ck_fun imst@ Fs S S S?
364recv recv ck_fun imst@ Fs R S S
365
366socket socket ck_fun is@ Fs S S S
367sockpair socketpair ck_fun is@ Fs Fs S S S
368
369bind bind ck_fun is@ Fs S
370connect connect ck_fun is@ Fs S
371listen listen ck_fun is@ Fs S
372accept accept ck_fun ist@ Fs Fs
373shutdown shutdown ck_fun ist@ Fs S
374
375gsockopt getsockopt ck_fun is@ Fs S S
376ssockopt setsockopt ck_fun is@ Fs S S S
377
378getsockname getsockname ck_fun is% Fs
379getpeername getpeername ck_fun is% Fs
380
381# Stat calls. OP_IS_FILETEST wants them consecutive.
382
465bc0f5
FC
383lstat lstat ck_ftst u- F?
384stat stat ck_ftst u- F?
f8a58b02
NC
385ftrread -R ck_ftst isu- F-+
386ftrwrite -W ck_ftst isu- F-+
387ftrexec -X ck_ftst isu- F-+
388fteread -r ck_ftst isu- F-+
389ftewrite -w ck_ftst isu- F-+
390fteexec -x ck_ftst isu- F-+
391ftis -e ck_ftst isu- F-
392ftsize -s ck_ftst istu- F-
393ftmtime -M ck_ftst stu- F-
394ftatime -A ck_ftst stu- F-
395ftctime -C ck_ftst stu- F-
396ftrowned -O ck_ftst isu- F-
397fteowned -o ck_ftst isu- F-
398ftzero -z ck_ftst isu- F-
399ftsock -S ck_ftst isu- F-
400ftchr -c ck_ftst isu- F-
401ftblk -b ck_ftst isu- F-
402ftfile -f ck_ftst isu- F-
403ftdir -d ck_ftst isu- F-
404ftpipe -p ck_ftst isu- F-
405ftsuid -u ck_ftst isu- F-
406ftsgid -g ck_ftst isu- F-
407ftsvtx -k ck_ftst isu- F-
408ftlink -l ck_ftst isu- F-
409fttty -t ck_ftst is- F-
410fttext -T ck_ftst isu- F-
411ftbinary -B ck_ftst isu- F-
412
413# File calls.
414
415# chdir really behaves as if it had both "S?" and "F?"
416chdir chdir ck_chdir isT% S?
417chown chown ck_fun imsT@ L
418chroot chroot ck_fun isTu% S?
419unlink unlink ck_fun imsTu@ L
420chmod chmod ck_fun imsT@ L
421utime utime ck_fun imsT@ L
422rename rename ck_fun isT@ S S
423link link ck_fun isT@ S S
424symlink symlink ck_fun isT@ S S
425readlink readlink ck_fun stu% S?
426mkdir mkdir ck_fun isTu@ S? S?
427rmdir rmdir ck_fun isTu% S?
428
429# Directory calls.
430
431open_dir opendir ck_fun is@ F S
332c2eac
JC
432readdir readdir ck_fun % DF
433telldir telldir ck_fun st% DF
434seekdir seekdir ck_fun s@ DF S
435rewinddir rewinddir ck_fun s% DF
436closedir closedir ck_fun is% DF
f8a58b02
NC
437
438# Process control.
439
440fork fork ck_null ist0
441wait wait ck_null isT0
442waitpid waitpid ck_fun isT@ S S
443system system ck_exec imsT@ S? L
444exec exec ck_exec dimsT@ S? L
445kill kill ck_fun dimsT@ L
446getppid getppid ck_null isT0
447getpgrp getpgrp ck_fun isT% S?
448setpgrp setpgrp ck_fun isT@ S? S?
449getpriority getpriority ck_fun isT@ S S
450setpriority setpriority ck_fun isT@ S S S
451
452# Time calls.
453
f8a58b02
NC
454time time ck_null isT0
455tms times ck_null 0
456localtime localtime ck_fun t% S?
457gmtime gmtime ck_fun t% S?
458alarm alarm ck_fun istu% S?
459sleep sleep ck_fun isT% S?
460
461# Shared memory.
462
463shmget shmget ck_fun imst@ S S S
464shmctl shmctl ck_fun imst@ S S S
465shmread shmread ck_fun imst@ S S S S
466shmwrite shmwrite ck_fun imst@ S S S S
467
468# Message passing.
469
470msgget msgget ck_fun imst@ S S
471msgctl msgctl ck_fun imst@ S S S
472msgsnd msgsnd ck_fun imst@ S S S
473msgrcv msgrcv ck_fun imst@ S S S S S
474
475# Semaphores.
476
477semop semop ck_fun imst@ S S
478semget semget ck_fun imst@ S S S
479semctl semctl ck_fun imst@ S S S S
480
481# Eval.
482
483require require ck_require du% S?
484dofile do "file" ck_fun d1 S
485hintseval eval hints ck_svconst s$
7d789282 486entereval eval "string" ck_eval du% S?
f8a58b02 487leaveeval eval "string" exit ck_null 1 S
f8a58b02
NC
488entertry eval {block} ck_eval d|
489leavetry eval {block} exit ck_null @
490
491# Get system info.
492
493ghbyname gethostbyname ck_fun % S
494ghbyaddr gethostbyaddr ck_fun @ S S
495ghostent gethostent ck_null 0
496gnbyname getnetbyname ck_fun % S
497gnbyaddr getnetbyaddr ck_fun @ S S
498gnetent getnetent ck_null 0
499gpbyname getprotobyname ck_fun % S
500gpbynumber getprotobynumber ck_fun @ S
501gprotoent getprotoent ck_null 0
502gsbyname getservbyname ck_fun @ S S
503gsbyport getservbyport ck_fun @ S S
504gservent getservent ck_null 0
505shostent sethostent ck_fun is% S
506snetent setnetent ck_fun is% S
507sprotoent setprotoent ck_fun is% S
508sservent setservent ck_fun is% S
509ehostent endhostent ck_null is0
510enetent endnetent ck_null is0
511eprotoent endprotoent ck_null is0
512eservent endservent ck_null is0
513gpwnam getpwnam ck_fun % S
514gpwuid getpwuid ck_fun % S
515gpwent getpwent ck_null 0
516spwent setpwent ck_null is0
517epwent endpwent ck_null is0
518ggrnam getgrnam ck_fun % S
519ggrgid getgrgid ck_fun % S
520ggrent getgrent ck_null 0
521sgrent setgrent ck_null is0
522egrent endgrent ck_null is0
523getlogin getlogin ck_null st0
524
525# Miscellaneous.
526
527syscall syscall ck_fun imst@ S L
528
529# For multi-threading
530lock lock ck_rfun s% R
531
532# For state support
533
534once once ck_null |
535
536custom unknown custom operator ck_null 0
537
538# For smart dereference for each/keys/values
539reach each on reference ck_each % S
540rkeys keys on reference ck_each t% S
541rvalues values on reference ck_each t% S
deb8a388
FC
542
543# For CORE:: subs
544coreargs CORE:: subroutine ck_null $
84ed0108
FC
545
546runcv __SUB__ ck_null s0
838f2281
BF
547
548# fc and \F
549fc fc ck_fun fstu% S?