4 open(OC, ">opcode.h") || die "Can't create opcode.h: $!\n";
13 ($key, $desc, $check, $flags, $args) = split(/\t+/, $_, 5);
15 warn qq[Description "$desc" duplicates $seen{$desc}\n] if $seen{$desc};
16 die qq[Opcode "$key" duplicates $seen{$key}\n] if $seen{$key};
17 $seen{$desc} = qq[description of opcode "$key"];
18 $seen{$key} = qq[opcode "$key"];
22 $check{$key} = $check;
24 $flags{$key} = $flags;
32 #define Perl_pp_i_preinc Perl_pp_preinc
33 #define Perl_pp_i_predec Perl_pp_predec
34 #define Perl_pp_i_postinc Perl_pp_postinc
35 #define Perl_pp_i_postdec Perl_pp_postdec
40 print "\t", &tab(3,"OP_\U$_,"), "/* ", $i++, " */\n";
42 print "\t", &tab(3,"OP_max"), "\n";
44 print "\n#define MAXO ", scalar @ops, "\n\n";
46 # Emit op names and descriptions.
53 EXT char *PL_op_name[];
55 EXT char *PL_op_name[] = {
70 EXT char *PL_op_desc[];
72 EXT char *PL_op_desc[] = {
76 print qq(\t"$desc{$_}",\n);
90 #define PERL_CKDEF(s) OP *s (pTHX_ OP *o);
91 #define PERL_PPDEF(s) OP *s (pTHX);
97 # Emit function declarations.
99 #for (sort keys %ckname) {
100 # print "OP *\t", &tab(3,$_),"(pTHX_ OP* o);\n";
106 # print "OP *\t", &tab(3, "pp_$_"), "(pTHX);\n";
109 # Emit ppcode switch array.
114 #endif /* PERL_OBJECT */
119 EXT OP * (CPERLscope(*PL_ppaddr)[])(pTHX);
121 EXT OP * (CPERLscope(*PL_ppaddr)[])(pTHX) = {
125 print "\tPerl_pp_$_,\n";
134 # Emit check routines.
138 EXT OP * (CPERLscope(*PL_check)[]) (pTHX_ OP *op);
140 EXT OP * (CPERLscope(*PL_check)[]) (pTHX_ OP *op) = {
144 print "\t", &tab(3, "Perl_$check{$_},"), "/* $_ */\n";
153 # Emit allowed argument types.
159 EXT U32 PL_opargs[] = {
169 R, 7, # scalar reference
182 '"', 9, # pvop_or_svop
185 '%', 12, # baseop_or_unop
186 '-', 13, # filestatop
193 $argsum |= 1 if $flags =~ /m/; # needs stack mark
194 $argsum |= 2 if $flags =~ /f/; # fold constants
195 $argsum |= 4 if $flags =~ /s/; # always produces scalar
196 $argsum |= 8 if $flags =~ /t/; # needs target scalar
197 $argsum |= 16 if $flags =~ /i/; # always produces integer
198 $argsum |= 32 if $flags =~ /I/; # has corresponding int op
199 $argsum |= 64 if $flags =~ /d/; # danger, unknown side effects
200 $argsum |= 128 if $flags =~ /u/; # defaults to $_
202 $flags =~ /([\W\d_])/ or die qq[Opcode "$_" has no class indicator];
203 $argsum |= $opclass{$1} << 8;
204 $mul = 4096; # 2 ^ OASHIFT
205 for $arg (split(' ',$args{$_})) {
206 $argnum = ($arg =~ s/\?//) ? 8 : 0;
207 $argnum += $argnum{$arg};
208 $argsum += $argnum * $mul;
211 $argsum = sprintf("0x%08x", $argsum);
212 print "\t", &tab(3, "$argsum,"), "/* $_ */\n";
222 close OC or die "Error closing opcode.h: $!";
226 open PP, '>pp_proto.h' or die "Error creating pp_proto.h: $!";
227 open PPSYM, '>pp.sym' or die "Error creating pp.sym: $!";
229 for (sort keys %ckname) {
230 print PP "PERL_CKDEF(Perl_$_)\n";
231 print PPSYM "Perl_$_\n";
232 #OP *\t", &tab(3,$_),"(OP* o);\n";
238 next if /^i_(pre|post)(inc|dec)$/;
239 print PP "PERL_PPDEF(Perl_pp_$_)\n";
240 print PPSYM "Perl_pp_$_\n";
243 close PP or die "Error closing pp_proto.h: $!";
244 close PPSYM or die "Error closing pp.sym: $!";
246 ###########################################################################
249 $t .= "\t" x ($l - (length($t) + 1) / 8);
252 ###########################################################################
257 null null operation ck_null 0
259 scalar scalar ck_fun s% S
263 pushmark pushmark ck_null s0
264 wantarray wantarray ck_null is0
266 const constant item ck_svconst s$
268 gvsv scalar variable ck_null ds*
269 gv glob value ck_null ds*
270 gelem glob elem ck_null d2 S S
271 padsv private variable ck_null ds0
272 padav private array ck_null d0
273 padhv private hash ck_null d0
274 padany private something ck_null d0
276 pushre push regexp ck_null d/
278 # References and stuff.
280 rv2gv ref-to-glob cast ck_rvconst ds1
281 rv2sv scalar deref ck_rvconst ds1
282 av2arylen array length ck_null is1
283 rv2cv subroutine deref ck_rvconst d1
284 anoncode anonymous subroutine ck_anoncode $
285 prototype subroutine prototype ck_null s% S
286 refgen reference constructor ck_spair m1 L
287 srefgen scalar ref constructor ck_null fs1 S
288 ref reference-type operator ck_fun stu% S?
289 bless bless ck_fun s@ S S?
293 backtick backticks ck_null t%
294 # glob defaults its first arg to $_
295 glob glob ck_glob t@ S? S?
296 readline <HANDLE> ck_null t%
297 rcatline append I/O operator ck_null t%
299 # Bindable operators.
301 regcmaybe regexp comp once ck_fun s1 S
302 regcreset regexp reset interpolation flag ck_fun s1 S
303 regcomp regexp compilation ck_null s| S
304 match pattern match ck_match d/
305 qr pattern quote ck_match s/
306 subst substitution ck_null dis/ S
307 substcont substitution cont ck_null dis|
308 trans character translation ck_null is" S
311 # sassign is special-cased for op class
313 sassign scalar assignment ck_null s0
314 aassign list assignment ck_null t2 L L
316 chop chop ck_spair mts% L
317 schop scalar chop ck_null stu% S?
318 chomp safe chop ck_spair mts% L
319 schomp scalar safe chop ck_null stu% S?
320 defined defined operator ck_defined isu% S?
321 undef undef operator ck_lfun s% S?
322 study study ck_fun su% S?
323 pos match position ck_lfun stu% S?
325 preinc preincrement ck_lfun dIs1 S
326 i_preinc integer preincrement ck_lfun dis1 S
327 predec predecrement ck_lfun dIs1 S
328 i_predec integer predecrement ck_lfun dis1 S
329 postinc postincrement ck_lfun dIst1 S
330 i_postinc integer postincrement ck_lfun dist1 S
331 postdec postdecrement ck_lfun dIst1 S
332 i_postdec integer postdecrement ck_lfun dist1 S
334 # Ordinary operators.
336 pow exponentiation ck_null fst2 S S
338 multiply multiplication ck_null Ifst2 S S
339 i_multiply integer multiplication ck_null ifst2 S S
340 divide division ck_null Ifst2 S S
341 i_divide integer division ck_null ifst2 S S
342 modulo modulus ck_null Iifst2 S S
343 i_modulo integer modulus ck_null ifst2 S S
344 repeat repeat ck_repeat mt2 L S
346 add addition ck_null Ifst2 S S
347 i_add integer addition ck_null ifst2 S S
348 subtract subtraction ck_null Ifst2 S S
349 i_subtract integer subtraction ck_null ifst2 S S
350 concat concatenation ck_concat fst2 S S
351 stringify string ck_fun fst@ S
353 left_shift left bitshift ck_bitop fst2 S S
354 right_shift right bitshift ck_bitop fst2 S S
356 lt numeric lt ck_null Iifs2 S S
357 i_lt integer lt ck_null ifs2 S S
358 gt numeric gt ck_null Iifs2 S S
359 i_gt integer gt ck_null ifs2 S S
360 le numeric le ck_null Iifs2 S S
361 i_le integer le ck_null ifs2 S S
362 ge numeric ge ck_null Iifs2 S S
363 i_ge integer ge ck_null ifs2 S S
364 eq numeric eq ck_null Iifs2 S S
365 i_eq integer eq ck_null ifs2 S S
366 ne numeric ne ck_null Iifs2 S S
367 i_ne integer ne ck_null ifs2 S S
368 ncmp spaceship operator ck_null Iifst2 S S
369 i_ncmp integer spaceship ck_null ifst2 S S
371 slt string lt ck_scmp ifs2 S S
372 sgt string gt ck_scmp ifs2 S S
373 sle string le ck_scmp ifs2 S S
374 sge string ge ck_scmp ifs2 S S
375 seq string eq ck_null ifs2 S S
376 sne string ne ck_null ifs2 S S
377 scmp string comparison ck_scmp ifst2 S S
379 bit_and bitwise and ck_bitop fst2 S S
380 bit_xor bitwise xor ck_bitop fst2 S S
381 bit_or bitwise or ck_bitop fst2 S S
383 negate negate ck_null Ifst1 S
384 i_negate integer negate ck_null ifst1 S
385 not not ck_null ifs1 S
386 complement 1's complement ck_bitop fst1 S
388 # High falutin' math.
390 atan2 atan2 ck_fun fst@ S S
391 sin sin ck_fun fstu% S?
392 cos cos ck_fun fstu% S?
393 rand rand ck_fun st% S?
394 srand srand ck_fun s% S?
395 exp exp ck_fun fstu% S?
396 log log ck_fun fstu% S?
397 sqrt sqrt ck_fun fstu% S?
401 int int ck_fun fstu% S?
402 hex hex ck_fun fstu% S?
403 oct oct ck_fun fstu% S?
404 abs abs ck_fun fstu% S?
408 length length ck_lengthconst istu% S?
409 substr substr ck_fun st@ S S S? S?
410 vec vec ck_fun ist@ S S S
412 index index ck_index ist@ S S S?
413 rindex rindex ck_index ist@ S S S?
415 sprintf sprintf ck_fun_locale mfst@ S L
416 formline formline ck_fun ms@ S L
417 ord ord ck_fun ifstu% S?
418 chr chr ck_fun fstu% S?
419 crypt crypt ck_fun fst@ S S
420 ucfirst upper case first ck_fun_locale fstu% S?
421 lcfirst lower case first ck_fun_locale fstu% S?
422 uc upper case ck_fun_locale fstu% S?
423 lc lower case ck_fun_locale fstu% S?
424 quotemeta quote metachars ck_fun fstu% S?
428 rv2av array deref ck_rvconst dt1
429 aelemfast known array element ck_null s* A S
430 aelem array element ck_null s2 A S
431 aslice array slice ck_null m@ A L
435 each each ck_fun t% H
436 values values ck_fun t% H
437 keys keys ck_fun t% H
438 delete delete ck_delete % S
439 exists exists operator ck_exists is% S
440 rv2hv hash deref ck_rvconst dt1
441 helem hash elem ck_null s2@ H S
442 hslice hash slice ck_null m@ H L
444 # Explosives and implosives.
446 unpack unpack ck_fun @ S S
447 pack pack ck_fun mst@ S L
448 split split ck_split t@ S S S
449 join join ck_fun mst@ S L
453 list list ck_null m@ L
454 lslice list slice ck_null 2 H L L
455 anonlist anonymous list ck_fun ms@ L
456 anonhash anonymous hash ck_fun ms@ L
458 splice splice ck_fun m@ A S? S? L
459 push push ck_fun imst@ A L
460 pop pop ck_shift s% A
461 shift shift ck_shift s% A
462 unshift unshift ck_fun imst@ A L
463 sort sort ck_sort m@ C? L
464 reverse reverse ck_fun mt@ L
466 grepstart grep ck_grep dm@ C L
467 grepwhile grep iterator ck_null dt|
469 mapstart map ck_grep dm@ C L
470 mapwhile map iterator ck_null dt|
474 range flipflop ck_null ? S S
475 flip range (or flip) ck_null 1 S S
476 flop range (or flop) ck_null 1
480 and logical and ck_null |
481 or logical or ck_null |
482 xor logical xor ck_null fs| S S
483 cond_expr conditional expression ck_null d?
484 andassign logical and assignment ck_null s|
485 orassign logical or assignment ck_null s|
487 method method lookup ck_null d1
488 entersub subroutine entry ck_subr dmt1 L
489 leavesub subroutine exit ck_null 1
490 caller caller ck_fun t% S?
491 warn warn ck_fun imst@ L
492 die die ck_fun dimst@ L
493 reset reset ck_fun is% S?
495 lineseq line sequence ck_null @
496 nextstate next statement ck_null s;
497 dbstate debug next statement ck_null s;
498 unstack iteration finalizer ck_null s0
499 enter block entry ck_null 0
500 leave block exit ck_null @
501 scope block ck_null @
502 enteriter foreach loop entry ck_null d{
503 iter foreach loop iterator ck_null 0
504 enterloop loop entry ck_null d{
505 leaveloop loop exit ck_null 2
506 return return ck_null dm@ L
507 last last ck_null ds}
508 next next ck_null ds}
509 redo redo ck_null ds}
510 dump dump ck_null ds}
511 goto goto ck_null ds}
512 exit exit ck_fun ds% S?
514 #nswitch numeric switch ck_null d
515 #cswitch character switch ck_null d
519 open open ck_fun ist@ F S?
520 close close ck_fun is% F?
521 pipe_op pipe ck_fun is@ F F
523 fileno fileno ck_fun ist% F
524 umask umask ck_fun ist% S?
525 binmode binmode ck_fun s% F
527 tie tie ck_fun idms@ R S L
528 untie untie ck_fun is% R
529 tied tied ck_fun s% R
530 dbmopen dbmopen ck_fun is@ H S S
531 dbmclose dbmclose ck_fun is% H
533 sselect select system call ck_select t@ S S S S
534 select select ck_select st@ F?
536 getc getc ck_eof st% F?
537 read read ck_fun imst@ F R S S?
538 enterwrite write ck_fun dis% F?
539 leavewrite write exit ck_null 1
541 prtf printf ck_listiob ims@ F? L
542 print print ck_listiob ims@ F? L
544 sysopen sysopen ck_fun s@ F S S S?
545 sysseek sysseek ck_fun s@ F S S
546 sysread sysread ck_fun imst@ F R S S?
547 syswrite syswrite ck_fun imst@ F S S? S?
549 send send ck_fun imst@ F S S S?
550 recv recv ck_fun imst@ F R S S
552 eof eof ck_eof is% F?
553 tell tell ck_fun st% F?
554 seek seek ck_fun s@ F S S
555 # truncate really behaves as if it had both "S S" and "F S"
556 truncate truncate ck_trunc is@ S S
558 fcntl fcntl ck_fun st@ F S S
559 ioctl ioctl ck_fun st@ F S S
560 flock flock ck_fun ist@ F S
564 socket socket ck_fun is@ F S S S
565 sockpair socketpair ck_fun is@ F F S S S
567 bind bind ck_fun is@ F S
568 connect connect ck_fun is@ F S
569 listen listen ck_fun is@ F S
570 accept accept ck_fun ist@ F F
571 shutdown shutdown ck_fun ist@ F S
573 gsockopt getsockopt ck_fun is@ F S S
574 ssockopt setsockopt ck_fun is@ F S S S
576 getsockname getsockname ck_fun is% F
577 getpeername getpeername ck_fun is% F
581 lstat lstat ck_ftst u- F
582 stat stat ck_ftst u- F
583 ftrread -R ck_ftst isu- F
584 ftrwrite -W ck_ftst isu- F
585 ftrexec -X ck_ftst isu- F
586 fteread -r ck_ftst isu- F
587 ftewrite -w ck_ftst isu- F
588 fteexec -x ck_ftst isu- F
589 ftis -e ck_ftst isu- F
590 fteowned -O ck_ftst isu- F
591 ftrowned -o ck_ftst isu- F
592 ftzero -z ck_ftst isu- F
593 ftsize -s ck_ftst istu- F
594 ftmtime -M ck_ftst stu- F
595 ftatime -A ck_ftst stu- F
596 ftctime -C ck_ftst stu- F
597 ftsock -S ck_ftst isu- F
598 ftchr -c ck_ftst isu- F
599 ftblk -b ck_ftst isu- F
600 ftfile -f ck_ftst isu- F
601 ftdir -d ck_ftst isu- F
602 ftpipe -p ck_ftst isu- F
603 ftlink -l ck_ftst isu- F
604 ftsuid -u ck_ftst isu- F
605 ftsgid -g ck_ftst isu- F
606 ftsvtx -k ck_ftst isu- F
607 fttty -t ck_ftst is- F
608 fttext -T ck_ftst isu- F
609 ftbinary -B ck_ftst isu- F
613 chdir chdir ck_fun ist% S?
614 chown chown ck_fun imst@ L
615 chroot chroot ck_fun istu% S?
616 unlink unlink ck_fun imstu@ L
617 chmod chmod ck_fun imst@ L
618 utime utime ck_fun imst@ L
619 rename rename ck_fun ist@ S S
620 link link ck_fun ist@ S S
621 symlink symlink ck_fun ist@ S S
622 readlink readlink ck_fun stu% S?
623 mkdir mkdir ck_fun ist@ S S
624 rmdir rmdir ck_fun istu% S?
628 open_dir opendir ck_fun is@ F S
629 readdir readdir ck_fun % F
630 telldir telldir ck_fun st% F
631 seekdir seekdir ck_fun s@ F S
632 rewinddir rewinddir ck_fun s% F
633 closedir closedir ck_fun is% F
637 fork fork ck_null ist0
638 wait wait ck_null ist0
639 waitpid waitpid ck_fun ist@ S S
640 system system ck_exec imst@ S? L
641 exec exec ck_exec dimst@ S? L
642 kill kill ck_fun dimst@ L
643 getppid getppid ck_null ist0
644 getpgrp getpgrp ck_fun ist% S?
645 setpgrp setpgrp ck_fun ist@ S? S?
646 getpriority getpriority ck_fun ist@ S S
647 setpriority setpriority ck_fun ist@ S S S
651 time time ck_null ist0
653 localtime localtime ck_fun t% S?
654 gmtime gmtime ck_fun t% S?
655 alarm alarm ck_fun istu% S?
656 sleep sleep ck_fun ist% S?
660 shmget shmget ck_fun imst@ S S S
661 shmctl shmctl ck_fun imst@ S S S
662 shmread shmread ck_fun imst@ S S S S
663 shmwrite shmwrite ck_fun imst@ S S S S
667 msgget msgget ck_fun imst@ S S
668 msgctl msgctl ck_fun imst@ S S S
669 msgsnd msgsnd ck_fun imst@ S S S
670 msgrcv msgrcv ck_fun imst@ S S S S S
674 semget semget ck_fun imst@ S S S
675 semctl semctl ck_fun imst@ S S S S
676 semop semop ck_fun imst@ S S
680 require require ck_require du% S?
681 dofile do 'file' ck_fun d1 S
682 entereval eval string ck_eval d% S
683 leaveeval eval exit ck_null 1 S
684 #evalonce eval constant string ck_null d1 S
685 entertry eval block ck_null |
686 leavetry eval block exit ck_null @
690 ghbyname gethostbyname ck_fun % S
691 ghbyaddr gethostbyaddr ck_fun @ S S
692 ghostent gethostent ck_null 0
693 gnbyname getnetbyname ck_fun % S
694 gnbyaddr getnetbyaddr ck_fun @ S S
695 gnetent getnetent ck_null 0
696 gpbyname getprotobyname ck_fun % S
697 gpbynumber getprotobynumber ck_fun @ S
698 gprotoent getprotoent ck_null 0
699 gsbyname getservbyname ck_fun @ S S
700 gsbyport getservbyport ck_fun @ S S
701 gservent getservent ck_null 0
702 shostent sethostent ck_fun is% S
703 snetent setnetent ck_fun is% S
704 sprotoent setprotoent ck_fun is% S
705 sservent setservent ck_fun is% S
706 ehostent endhostent ck_null is0
707 enetent endnetent ck_null is0
708 eprotoent endprotoent ck_null is0
709 eservent endservent ck_null is0
710 gpwnam getpwnam ck_fun % S
711 gpwuid getpwuid ck_fun % S
712 gpwent getpwent ck_null 0
713 spwent setpwent ck_null is0
714 epwent endpwent ck_null is0
715 ggrnam getgrnam ck_fun % S
716 ggrgid getgrgid ck_fun % S
717 ggrent getgrent ck_null 0
718 sgrent setgrent ck_null is0
719 egrent endgrent ck_null is0
720 getlogin getlogin ck_null st0
724 syscall syscall ck_fun imst@ S L
726 # For multi-threading
727 lock lock ck_rfun s% S
728 threadsv per-thread variable ck_null ds0