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