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 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
33 This file is built by opcode.pl from its data. Any changes made here
37 #define Perl_pp_i_preinc Perl_pp_preinc
38 #define Perl_pp_i_predec Perl_pp_predec
39 #define Perl_pp_i_postinc Perl_pp_postinc
40 #define Perl_pp_i_postdec Perl_pp_postdec
45 print "\t", &tab(3,"OP_\U$_,"), "/* ", $i++, " */\n";
47 print "\t", &tab(3,"OP_max"), "\n";
49 print "\n#define MAXO ", scalar @ops, "\n\n";
51 # Emit op names and descriptions.
58 EXT char *PL_op_name[];
60 EXT char *PL_op_name[] = {
75 EXT char *PL_op_desc[];
77 EXT char *PL_op_desc[] = {
81 print qq(\t"$desc{$_}",\n);
92 # Emit function declarations.
94 #for (sort keys %ckname) {
95 # print "OP *\t", &tab(3,$_),"(pTHX_ OP* o);\n";
101 # print "OP *\t", &tab(3, "pp_$_"), "(pTHX);\n";
104 # Emit ppcode switch array.
111 EXT OP * (CPERLscope(*PL_ppaddr)[])(pTHX);
113 EXT OP * (CPERLscope(*PL_ppaddr)[])(pTHX) = {
117 print "\tPerl_pp_$_,\n";
126 # Emit check routines.
130 EXT OP * (CPERLscope(*PL_check)[]) (pTHX_ OP *op);
132 EXT OP * (CPERLscope(*PL_check)[]) (pTHX_ OP *op) = {
136 print "\t", &tab(3, "Perl_$check{$_},"), "/* $_ */\n";
145 # Emit allowed argument types.
151 EXT U32 PL_opargs[] = {
161 R, 7, # scalar reference
173 '"', 8, # pvop_or_svop
176 '%', 11, # baseop_or_unop
177 '-', 12, # filestatop
184 $argsum |= 1 if $flags =~ /m/; # needs stack mark
185 $argsum |= 2 if $flags =~ /f/; # fold constants
186 $argsum |= 4 if $flags =~ /s/; # always produces scalar
187 $argsum |= 8 if $flags =~ /t/; # needs target scalar
188 $argsum |= (8|256) if $flags =~ /T/; # ... which may be lexical
189 $argsum |= 16 if $flags =~ /i/; # always produces integer
190 $argsum |= 32 if $flags =~ /I/; # has corresponding int op
191 $argsum |= 64 if $flags =~ /d/; # danger, unknown side effects
192 $argsum |= 128 if $flags =~ /u/; # defaults to $_
194 $flags =~ /([\W\d_])/ or die qq[Opcode "$_" has no class indicator];
195 $argsum |= $opclass{$1} << 9;
196 $mul = 0x2000; # 2 ^ OASHIFT
197 for $arg (split(' ',$args{$_})) {
198 $argnum = ($arg =~ s/\?//) ? 8 : 0;
199 $argnum += $argnum{$arg};
200 warn "# Conflicting bit 32 for '$_'.\n"
201 if $argnum & 8 and $mul == 0x10000000;
202 $argsum += $argnum * $mul;
205 $argsum = sprintf("0x%08x", $argsum);
206 print "\t", &tab(3, "$argsum,"), "/* $_ */\n";
216 close OC or die "Error closing opcode.h: $!";
220 open PP, '>pp_proto.h' or die "Error creating pp_proto.h: $!";
221 open PPSYM, '>pp.sym' or die "Error creating pp.sym: $!";
224 /* !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
225 This file is built by opcode.pl from its data. Any changes made here
233 # !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
234 # This file is built by opcode.pl from its data. Any changes made here
241 for (sort keys %ckname) {
242 print PP "PERL_CKDEF(Perl_$_)\n";
243 print PPSYM "Perl_$_\n";
244 #OP *\t", &tab(3,$_),"(OP* o);\n";
250 next if /^i_(pre|post)(inc|dec)$/;
251 print PP "PERL_PPDEF(Perl_pp_$_)\n";
252 print PPSYM "Perl_pp_$_\n";
255 close PP or die "Error closing pp_proto.h: $!";
256 close PPSYM or die "Error closing pp.sym: $!";
258 ###########################################################################
261 $t .= "\t" x ($l - (length($t) + 1) / 8);
264 ###########################################################################
266 # Some comments about 'T' opcode classifier:
268 # Safe to set if the ppcode uses:
269 # tryAMAGICbin, tryAMAGICun, SETn, SETi, SETu, PUSHn, PUSHTARG, SETTARG,
270 # SETs(TARG), XPUSHn, XPUSHu,
272 # Unsafe to set if the ppcode uses dTARG or [X]RETPUSH[YES|NO|UNDEF]
274 # lt and friends do SETs (including ncmp, but not scmp)
276 # pp.c pos substr each not OK (RETPUSHUNDEF)
277 # substr vec also not OK due to LV to target (are they???)
278 # ref not OK (RETPUSHNO)
279 # trans not OK (dTARG; TARG = sv_newmortal();)
280 # ucfirst etc not OK: TMP arg processed inplace
281 # each repeat not OK too due to array context
282 # pack split - unknown whether they are safe
285 # readline - unknown whether it is safe
286 # match subst not OK (dTARG)
287 # grepwhile not OK (not always setting)
290 # mapwhile flip caller not OK (not always setting)
293 # backtick glob warn die not OK (not always setting)
294 # warn not OK (RETPUSHYES)
295 # open fileno getc sysread syswrite ioctl accept shutdown
296 # ftsize(etc) readlink telldir fork alarm getlogin not OK (RETPUSHUNDEF)
297 # umask select not OK (XPUSHs(&PL_sv_undef);)
298 # fileno getc sysread syswrite tell not OK (meth("FILENO" "GETC"))
299 # sselect shm* sem* msg* syscall - unknown whether they are safe
300 # gmtime not OK (list context)
306 null null operation ck_null 0
308 scalar scalar ck_fun s% S
312 pushmark pushmark ck_null s0
313 wantarray wantarray ck_null is0
315 const constant item ck_svconst s$
317 gvsv scalar variable ck_null ds*
318 gv glob value ck_null ds*
319 gelem glob elem ck_null d2 S S
320 padsv private variable ck_null ds0
321 padav private array ck_null d0
322 padhv private hash ck_null d0
323 padany private something ck_null d0
325 pushre push regexp ck_null d/
327 # References and stuff.
329 rv2gv ref-to-glob cast ck_rvconst ds1
330 rv2sv scalar deref ck_rvconst ds1
331 av2arylen array length ck_null is1
332 rv2cv subroutine deref ck_rvconst d1
333 anoncode anonymous subroutine ck_anoncode $
334 prototype subroutine prototype ck_null s% S
335 refgen reference constructor ck_spair m1 L
336 srefgen single ref constructor ck_null fs1 S
337 ref reference-type operator ck_fun stu% S?
338 bless bless ck_fun s@ S S?
342 backtick backticks ck_null t%
343 # glob defaults its first arg to $_
344 glob glob ck_glob t@ S? S?
345 readline <HANDLE> ck_null t%
346 rcatline append I/O operator ck_null t%
348 # Bindable operators.
350 regcmaybe regexp comp once ck_fun s1 S
351 regcreset regexp reset interpolation flag ck_fun s1 S
352 regcomp regexp compilation ck_null s| S
353 match pattern match ck_match d/
354 qr pattern quote ck_match s/
355 subst substitution ck_null dis/ S
356 substcont substitution cont ck_null dis|
357 trans character translation ck_null is" S
360 # sassign is special-cased for op class
362 sassign scalar assignment ck_sassign s0
363 aassign list assignment ck_null t2 L L
365 chop chop ck_spair mTs% L
366 schop scalar chop ck_null sTu% S?
367 chomp safe chop ck_spair mTs% L
368 schomp scalar safe chop ck_null sTu% S?
369 defined defined operator ck_defined isu% S?
370 undef undef operator ck_lfun s% S?
371 study study ck_fun su% S?
372 pos match position ck_lfun stu% S?
374 preinc preincrement ck_lfun dIs1 S
375 i_preinc integer preincrement ck_lfun dis1 S
376 predec predecrement ck_lfun dIs1 S
377 i_predec integer predecrement ck_lfun dis1 S
378 postinc postincrement ck_lfun dIsT1 S
379 i_postinc integer postincrement ck_lfun disT1 S
380 postdec postdecrement ck_lfun dIsT1 S
381 i_postdec integer postdecrement ck_lfun disT1 S
383 # Ordinary operators.
385 pow exponentiation ck_null fsT2 S S
387 multiply multiplication ck_null IfsT2 S S
388 i_multiply integer multiplication ck_null ifsT2 S S
389 divide division ck_null IfsT2 S S
390 i_divide integer division ck_null ifsT2 S S
391 modulo modulus ck_null IifsT2 S S
392 i_modulo integer modulus ck_null ifsT2 S S
393 repeat repeat ck_repeat mt2 L S
395 add addition ck_null IfsT2 S S
396 i_add integer addition ck_null ifsT2 S S
397 subtract subtraction ck_null IfsT2 S S
398 i_subtract integer subtraction ck_null ifsT2 S S
399 concat concatenation ck_concat fsT2 S S
400 stringify string ck_fun fsT@ S
402 left_shift left bitshift ck_bitop fsT2 S S
403 right_shift right bitshift ck_bitop fsT2 S S
405 lt numeric lt ck_null Iifs2 S S
406 i_lt integer lt ck_null ifs2 S S
407 gt numeric gt ck_null Iifs2 S S
408 i_gt integer gt ck_null ifs2 S S
409 le numeric le ck_null Iifs2 S S
410 i_le integer le ck_null ifs2 S S
411 ge numeric ge ck_null Iifs2 S S
412 i_ge integer ge ck_null ifs2 S S
413 eq numeric eq ck_null Iifs2 S S
414 i_eq integer eq ck_null ifs2 S S
415 ne numeric ne ck_null Iifs2 S S
416 i_ne integer ne ck_null ifs2 S S
417 ncmp spaceship operator ck_null Iifst2 S S
418 i_ncmp integer spaceship ck_null ifst2 S S
420 slt string lt ck_scmp ifs2 S S
421 sgt string gt ck_scmp ifs2 S S
422 sle string le ck_scmp ifs2 S S
423 sge string ge ck_scmp ifs2 S S
424 seq string eq ck_null ifs2 S S
425 sne string ne ck_null ifs2 S S
426 scmp string comparison ck_scmp ifst2 S S
428 bit_and bitwise and ck_bitop fsT2 S S
429 bit_xor bitwise xor ck_bitop fsT2 S S
430 bit_or bitwise or ck_bitop fsT2 S S
432 negate negate ck_null IfsT1 S
433 i_negate integer negate ck_null ifsT1 S
434 not not ck_null ifs1 S
435 complement 1's complement ck_bitop fsT1 S
437 # High falutin' math.
439 atan2 atan2 ck_fun fsT@ S S
440 sin sin ck_fun fsTu% S?
441 cos cos ck_fun fsTu% S?
442 rand rand ck_fun sT% S?
443 srand srand ck_fun s% S?
444 exp exp ck_fun fsTu% S?
445 log log ck_fun fsTu% S?
446 sqrt sqrt ck_fun fsTu% S?
450 int int ck_fun fsTu% S?
451 hex hex ck_fun fsTu% S?
452 oct oct ck_fun fsTu% S?
453 abs abs ck_fun fsTu% S?
457 length length ck_lengthconst isTu% S?
458 substr substr ck_fun st@ S S S? S?
459 vec vec ck_fun ist@ S S S
461 index index ck_index isT@ S S S?
462 rindex rindex ck_index isT@ S S S?
464 sprintf sprintf ck_fun_locale mfsT@ S L
465 formline formline ck_fun ms@ S L
466 ord ord ck_fun ifsTu% S?
467 chr chr ck_fun fsTu% S?
468 crypt crypt ck_fun fsT@ S S
469 ucfirst upper case first ck_fun_locale fstu% S?
470 lcfirst lower case first ck_fun_locale fstu% S?
471 uc upper case ck_fun_locale fstu% S?
472 lc lower case ck_fun_locale fstu% S?
473 quotemeta quote metachars ck_fun fsTu% S?
477 rv2av array deref ck_rvconst dt1
478 aelemfast known array element ck_null s* A S
479 aelem array element ck_null s2 A S
480 aslice array slice ck_null m@ A L
485 values values ck_fun t% H
486 keys keys ck_fun t% H
487 delete delete ck_delete % S
488 exists exists operator ck_exists is% S
489 rv2hv hash deref ck_rvconst dt1
490 helem hash elem ck_null s2@ H S
491 hslice hash slice ck_null m@ H L
493 # Explosives and implosives.
495 unpack unpack ck_fun @ S S
496 pack pack ck_fun mst@ S L
497 split split ck_split t@ S S S
498 join join ck_fun msT@ S L
502 list list ck_null m@ L
503 lslice list slice ck_null 2 H L L
504 anonlist anonymous list ck_fun ms@ L
505 anonhash anonymous hash ck_fun ms@ L
507 splice splice ck_fun m@ A S? S? L
508 push push ck_fun imsT@ A L
509 pop pop ck_shift s% A
510 shift shift ck_shift s% A
511 unshift unshift ck_fun imsT@ A L
512 sort sort ck_sort m@ C? L
513 reverse reverse ck_fun mt@ L
515 grepstart grep ck_grep dm@ C L
516 grepwhile grep iterator ck_null dt|
518 mapstart map ck_grep dm@ C L
519 mapwhile map iterator ck_null dt|
523 range flipflop ck_null | S S
524 flip range (or flip) ck_null 1 S S
525 flop range (or flop) ck_null 1
529 and logical and ck_null |
530 or logical or ck_null |
531 xor logical xor ck_null fs| S S
532 cond_expr conditional expression ck_null d|
533 andassign logical and assignment ck_null s|
534 orassign logical or assignment ck_null s|
536 method method lookup ck_null d1
537 entersub subroutine entry ck_subr dmt1 L
538 leavesub subroutine exit ck_null 1
539 caller caller ck_fun t% S?
540 warn warn ck_fun imst@ L
541 die die ck_fun dimst@ L
542 reset reset ck_fun is% S?
544 lineseq line sequence ck_null @
545 nextstate next statement ck_null s;
546 dbstate debug next statement ck_null s;
547 unstack iteration finalizer ck_null s0
548 enter block entry ck_null 0
549 leave block exit ck_null @
550 scope block ck_null @
551 enteriter foreach loop entry ck_null d{
552 iter foreach loop iterator ck_null 0
553 enterloop loop entry ck_null d{
554 leaveloop loop exit ck_null 2
555 return return ck_null dm@ L
556 last last ck_null ds}
557 next next ck_null ds}
558 redo redo ck_null ds}
559 dump dump ck_null ds}
560 goto goto ck_null ds}
561 exit exit ck_fun ds% S?
563 #nswitch numeric switch ck_null d
564 #cswitch character switch ck_null d
568 open open ck_fun ist@ F S?
569 close close ck_fun is% F?
570 pipe_op pipe ck_fun is@ F F
572 fileno fileno ck_fun ist% F
573 umask umask ck_fun ist% S?
574 binmode binmode ck_fun s% F
576 tie tie ck_fun idms@ R S L
577 untie untie ck_fun is% R
578 tied tied ck_fun s% R
579 dbmopen dbmopen ck_fun is@ H S S
580 dbmclose dbmclose ck_fun is% H
582 sselect select system call ck_select t@ S S S S
583 select select ck_select st@ F?
585 getc getc ck_eof st% F?
586 read read ck_fun imst@ F R S S?
587 enterwrite write ck_fun dis% F?
588 leavewrite write exit ck_null 1
590 prtf printf ck_listiob ims@ F? L
591 print print ck_listiob ims@ F? L
593 sysopen sysopen ck_fun s@ F S S S?
594 sysseek sysseek ck_fun s@ F S S
595 sysread sysread ck_fun imst@ F R S S?
596 syswrite syswrite ck_fun imst@ F S S? S?
598 send send ck_fun imst@ F S S S?
599 recv recv ck_fun imst@ F R S S
601 eof eof ck_eof is% F?
602 tell tell ck_fun st% F?
603 seek seek ck_fun s@ F S S
604 # truncate really behaves as if it had both "S S" and "F S"
605 truncate truncate ck_trunc is@ S S
607 fcntl fcntl ck_fun st@ F S S
608 ioctl ioctl ck_fun st@ F S S
609 flock flock ck_fun isT@ F S
613 socket socket ck_fun is@ F S S S
614 sockpair socketpair ck_fun is@ F F S S S
616 bind bind ck_fun is@ F S
617 connect connect ck_fun is@ F S
618 listen listen ck_fun is@ F S
619 accept accept ck_fun ist@ F F
620 shutdown shutdown ck_fun ist@ F S
622 gsockopt getsockopt ck_fun is@ F S S
623 ssockopt setsockopt ck_fun is@ F S S S
625 getsockname getsockname ck_fun is% F
626 getpeername getpeername ck_fun is% F
630 lstat lstat ck_ftst u- F
631 stat stat ck_ftst u- F
632 ftrread -R ck_ftst isu- F
633 ftrwrite -W ck_ftst isu- F
634 ftrexec -X ck_ftst isu- F
635 fteread -r ck_ftst isu- F
636 ftewrite -w ck_ftst isu- F
637 fteexec -x ck_ftst isu- F
638 ftis -e ck_ftst isu- F
639 fteowned -O ck_ftst isu- F
640 ftrowned -o ck_ftst isu- F
641 ftzero -z ck_ftst isu- F
642 ftsize -s ck_ftst istu- F
643 ftmtime -M ck_ftst stu- F
644 ftatime -A ck_ftst stu- F
645 ftctime -C ck_ftst stu- F
646 ftsock -S ck_ftst isu- F
647 ftchr -c ck_ftst isu- F
648 ftblk -b ck_ftst isu- F
649 ftfile -f ck_ftst isu- F
650 ftdir -d ck_ftst isu- F
651 ftpipe -p ck_ftst isu- F
652 ftlink -l ck_ftst isu- F
653 ftsuid -u ck_ftst isu- F
654 ftsgid -g ck_ftst isu- F
655 ftsvtx -k ck_ftst isu- F
656 fttty -t ck_ftst is- F
657 fttext -T ck_ftst isu- F
658 ftbinary -B ck_ftst isu- F
662 chdir chdir ck_fun isT% S?
663 chown chown ck_fun imsT@ L
664 chroot chroot ck_fun isTu% S?
665 unlink unlink ck_fun imsTu@ L
666 chmod chmod ck_fun imsT@ L
667 utime utime ck_fun imsT@ L
668 rename rename ck_fun isT@ S S
669 link link ck_fun isT@ S S
670 symlink symlink ck_fun isT@ S S
671 readlink readlink ck_fun stu% S?
672 mkdir mkdir ck_fun isT@ S S
673 rmdir rmdir ck_fun isTu% S?
677 open_dir opendir ck_fun is@ F S
678 readdir readdir ck_fun % F
679 telldir telldir ck_fun st% F
680 seekdir seekdir ck_fun s@ F S
681 rewinddir rewinddir ck_fun s% F
682 closedir closedir ck_fun is% F
686 fork fork ck_null ist0
687 wait wait ck_null isT0
688 waitpid waitpid ck_fun isT@ S S
689 system system ck_exec imsT@ S? L
690 exec exec ck_exec dimsT@ S? L
691 kill kill ck_fun dimsT@ L
692 getppid getppid ck_null isT0
693 getpgrp getpgrp ck_fun isT% S?
694 setpgrp setpgrp ck_fun isT@ S? S?
695 getpriority getpriority ck_fun isT@ S S
696 setpriority setpriority ck_fun isT@ S S S
700 time time ck_null isT0
702 localtime localtime ck_fun t% S?
703 gmtime gmtime ck_fun t% S?
704 alarm alarm ck_fun istu% S?
705 sleep sleep ck_fun isT% S?
709 shmget shmget ck_fun imst@ S S S
710 shmctl shmctl ck_fun imst@ S S S
711 shmread shmread ck_fun imst@ S S S S
712 shmwrite shmwrite ck_fun imst@ S S S S
716 msgget msgget ck_fun imst@ S S
717 msgctl msgctl ck_fun imst@ S S S
718 msgsnd msgsnd ck_fun imst@ S S S
719 msgrcv msgrcv ck_fun imst@ S S S S S
723 semget semget ck_fun imst@ S S S
724 semctl semctl ck_fun imst@ S S S S
725 semop semop ck_fun imst@ S S
729 require require ck_require du% S?
730 dofile do 'file' ck_fun d1 S
731 entereval eval string ck_eval d% S
732 leaveeval eval exit ck_null 1 S
733 #evalonce eval constant string ck_null d1 S
734 entertry eval block ck_null |
735 leavetry eval block exit ck_null @
739 ghbyname gethostbyname ck_fun % S
740 ghbyaddr gethostbyaddr ck_fun @ S S
741 ghostent gethostent ck_null 0
742 gnbyname getnetbyname ck_fun % S
743 gnbyaddr getnetbyaddr ck_fun @ S S
744 gnetent getnetent ck_null 0
745 gpbyname getprotobyname ck_fun % S
746 gpbynumber getprotobynumber ck_fun @ S
747 gprotoent getprotoent ck_null 0
748 gsbyname getservbyname ck_fun @ S S
749 gsbyport getservbyport ck_fun @ S S
750 gservent getservent ck_null 0
751 shostent sethostent ck_fun is% S
752 snetent setnetent ck_fun is% S
753 sprotoent setprotoent ck_fun is% S
754 sservent setservent ck_fun is% S
755 ehostent endhostent ck_null is0
756 enetent endnetent ck_null is0
757 eprotoent endprotoent ck_null is0
758 eservent endservent ck_null is0
759 gpwnam getpwnam ck_fun % S
760 gpwuid getpwuid ck_fun % S
761 gpwent getpwent ck_null 0
762 spwent setpwent ck_null is0
763 epwent endpwent ck_null is0
764 ggrnam getgrnam ck_fun % S
765 ggrgid getgrgid ck_fun % S
766 ggrent getgrent ck_null 0
767 sgrent setgrent ck_null is0
768 egrent endgrent ck_null is0
769 getlogin getlogin ck_null st0
773 syscall syscall ck_fun imst@ S L
775 # For multi-threading
776 lock lock ck_rfun s% S
777 threadsv per-thread variable ck_null ds0