This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Initial check-in of perl compiler.
[perl5.git] / byterun.c
CommitLineData
79ee8297
MB
1/*
2 * Copyright (c) 1996 Malcolm Beattie
3 *
4 * You may distribute under the terms of either the GNU General Public
5 * License or the Artistic License, as specified in the README file.
6 *
7 */
8/*
9 * This file is autogenerated from bytecode.pl. Changes made here will be lost.
10 */
11
12#include "EXTERN.h"
13#include "perl.h"
14#include "bytecode.h"
15#include "byterun.h"
16
17#ifdef INDIRECT_BGET_MACROS
18void byterun(bs)
19struct bytestream bs;
20#else
21void byterun(fp)
22FILE *fp;
23#endif /* INDIRECT_BGET_MACROS */
24{
25 int insn;
26 while ((insn = FGETC()) != EOF) {
27 switch (insn) {
28 case INSN_COMMENT: /* 35 */
29 {
30 comment arg;
31 BGET_comment(arg);
32 arg = arg;
33 break;
34 }
35 case INSN_NOP: /* 10 */
36 {
37 break;
38 }
39 case INSN_RET: /* 0 */
40 {
41 BSET_ret(none);
42 break;
43 }
44 case INSN_LDSV: /* 1 */
45 {
46 svindex arg;
47 BGET_objindex(arg);
48 sv = arg;
49 break;
50 }
51 case INSN_LDOP: /* 2 */
52 {
53 opindex arg;
54 BGET_objindex(arg);
55 op = arg;
56 break;
57 }
58 case INSN_STSV: /* 3 */
59 {
60 U32 arg;
61 BGET_U32(arg);
62 BSET_OBJ_STORE(sv, arg);
63 break;
64 }
65 case INSN_STOP: /* 4 */
66 {
67 U32 arg;
68 BGET_U32(arg);
69 BSET_OBJ_STORE(op, arg);
70 break;
71 }
72 case INSN_LDSPECSV: /* 5 */
73 {
74 U8 arg;
75 BGET_U8(arg);
76 BSET_ldspecsv(sv, arg);
77 break;
78 }
79 case INSN_NEWSV: /* 6 */
80 {
81 U8 arg;
82 BGET_U8(arg);
83 BSET_newsv(sv, arg);
84 break;
85 }
86 case INSN_NEWOP: /* 7 */
87 {
88 U8 arg;
89 BGET_U8(arg);
90 BSET_newop(op, arg);
91 break;
92 }
93 case INSN_NEWOPN: /* 8 */
94 {
95 U8 arg;
96 BGET_U8(arg);
97 BSET_newopn(op, arg);
98 break;
99 }
100 case INSN_NEWPV: /* 9 */
101 {
102 PV arg;
103 BGET_PV(arg);
104 break;
105 }
106 case INSN_PV_CUR: /* 11 */
107 {
108 STRLEN arg;
109 BGET_U32(arg);
110 pv.xpv_cur = arg;
111 break;
112 }
113 case INSN_PV_FREE: /* 12 */
114 {
115 BSET_pv_free(pv);
116 break;
117 }
118 case INSN_SV_UPGRADE: /* 13 */
119 {
120 char arg;
121 BGET_U8(arg);
122 BSET_sv_upgrade(sv, arg);
123 break;
124 }
125 case INSN_SV_REFCNT: /* 14 */
126 {
127 U32 arg;
128 BGET_U32(arg);
129 SvREFCNT(sv) = arg;
130 break;
131 }
132 case INSN_SV_REFCNT_ADD: /* 15 */
133 {
134 I32 arg;
135 BGET_I32(arg);
136 BSET_sv_refcnt_add(SvREFCNT(sv), arg);
137 break;
138 }
139 case INSN_SV_FLAGS: /* 16 */
140 {
141 U32 arg;
142 BGET_U32(arg);
143 SvFLAGS(sv) = arg;
144 break;
145 }
146 case INSN_XRV: /* 17 */
147 {
148 svindex arg;
149 BGET_objindex(arg);
150 SvRV(sv) = arg;
151 break;
152 }
153 case INSN_XPV: /* 18 */
154 {
155 BSET_xpv(sv);
156 break;
157 }
158 case INSN_XIV32: /* 19 */
159 {
160 I32 arg;
161 BGET_I32(arg);
162 SvIVX(sv) = arg;
163 break;
164 }
165 case INSN_XIV64: /* 20 */
166 {
167 IV64 arg;
168 BGET_IV64(arg);
169 SvIVX(sv) = arg;
170 break;
171 }
172 case INSN_XNV: /* 21 */
173 {
174 double arg;
175 BGET_double(arg);
176 SvNVX(sv) = arg;
177 break;
178 }
179 case INSN_XLV_TARGOFF: /* 22 */
180 {
181 STRLEN arg;
182 BGET_U32(arg);
183 LvTARGOFF(sv) = arg;
184 break;
185 }
186 case INSN_XLV_TARGLEN: /* 23 */
187 {
188 STRLEN arg;
189 BGET_U32(arg);
190 LvTARGLEN(sv) = arg;
191 break;
192 }
193 case INSN_XLV_TARG: /* 24 */
194 {
195 svindex arg;
196 BGET_objindex(arg);
197 LvTARG(sv) = arg;
198 break;
199 }
200 case INSN_XLV_TYPE: /* 25 */
201 {
202 char arg;
203 BGET_U8(arg);
204 LvTYPE(sv) = arg;
205 break;
206 }
207 case INSN_XBM_USEFUL: /* 26 */
208 {
209 I32 arg;
210 BGET_I32(arg);
211 BmUSEFUL(sv) = arg;
212 break;
213 }
214 case INSN_XBM_PREVIOUS: /* 27 */
215 {
216 U16 arg;
217 BGET_U16(arg);
218 BmPREVIOUS(sv) = arg;
219 break;
220 }
221 case INSN_XBM_RARE: /* 28 */
222 {
223 U8 arg;
224 BGET_U8(arg);
225 BmRARE(sv) = arg;
226 break;
227 }
228 case INSN_XFM_LINES: /* 29 */
229 {
230 I32 arg;
231 BGET_I32(arg);
232 FmLINES(sv) = arg;
233 break;
234 }
235 case INSN_XIO_LINES: /* 30 */
236 {
237 long arg;
238 BGET_I32(arg);
239 IoLINES(sv) = arg;
240 break;
241 }
242 case INSN_XIO_PAGE: /* 31 */
243 {
244 long arg;
245 BGET_I32(arg);
246 IoPAGE(sv) = arg;
247 break;
248 }
249 case INSN_XIO_PAGE_LEN: /* 32 */
250 {
251 long arg;
252 BGET_I32(arg);
253 IoPAGE_LEN(sv) = arg;
254 break;
255 }
256 case INSN_XIO_LINES_LEFT: /* 33 */
257 {
258 long arg;
259 BGET_I32(arg);
260 IoLINES_LEFT(sv) = arg;
261 break;
262 }
263 case INSN_XIO_TOP_NAME: /* 34 */
264 {
265 pvcontents arg;
266 BGET_pvcontents(arg);
267 IoTOP_NAME(sv) = arg;
268 break;
269 }
270 case INSN_XIO_TOP_GV: /* 36 */
271 {
272 svindex arg;
273 BGET_objindex(arg);
274 IoTOP_GV(sv) = arg;
275 break;
276 }
277 case INSN_XIO_FMT_NAME: /* 37 */
278 {
279 pvcontents arg;
280 BGET_pvcontents(arg);
281 IoFMT_NAME(sv) = arg;
282 break;
283 }
284 case INSN_XIO_FMT_GV: /* 38 */
285 {
286 svindex arg;
287 BGET_objindex(arg);
288 IoFMT_GV(sv) = arg;
289 break;
290 }
291 case INSN_XIO_BOTTOM_NAME: /* 39 */
292 {
293 pvcontents arg;
294 BGET_pvcontents(arg);
295 IoBOTTOM_NAME(sv) = arg;
296 break;
297 }
298 case INSN_XIO_BOTTOM_GV: /* 40 */
299 {
300 svindex arg;
301 BGET_objindex(arg);
302 IoBOTTOM_GV(sv) = arg;
303 break;
304 }
305 case INSN_XIO_SUBPROCESS: /* 41 */
306 {
307 short arg;
308 BGET_U16(arg);
309 IoSUBPROCESS(sv) = arg;
310 break;
311 }
312 case INSN_XIO_TYPE: /* 42 */
313 {
314 char arg;
315 BGET_U8(arg);
316 IoTYPE(sv) = arg;
317 break;
318 }
319 case INSN_XIO_FLAGS: /* 43 */
320 {
321 char arg;
322 BGET_U8(arg);
323 IoFLAGS(sv) = arg;
324 break;
325 }
326 case INSN_XCV_STASH: /* 44 */
327 {
328 svindex arg;
329 BGET_objindex(arg);
330 *(SV**)&CvSTASH(sv) = arg;
331 break;
332 }
333 case INSN_XCV_START: /* 45 */
334 {
335 opindex arg;
336 BGET_objindex(arg);
337 CvSTART(sv) = arg;
338 break;
339 }
340 case INSN_XCV_ROOT: /* 46 */
341 {
342 opindex arg;
343 BGET_objindex(arg);
344 CvROOT(sv) = arg;
345 break;
346 }
347 case INSN_XCV_GV: /* 47 */
348 {
349 svindex arg;
350 BGET_objindex(arg);
351 CvGV(sv) = arg;
352 break;
353 }
354 case INSN_XCV_FILEGV: /* 48 */
355 {
356 svindex arg;
357 BGET_objindex(arg);
358 CvFILEGV(sv) = arg;
359 break;
360 }
361 case INSN_XCV_DEPTH: /* 49 */
362 {
363 long arg;
364 BGET_I32(arg);
365 CvDEPTH(sv) = arg;
366 break;
367 }
368 case INSN_XCV_PADLIST: /* 50 */
369 {
370 svindex arg;
371 BGET_objindex(arg);
372 *(SV**)&CvPADLIST(sv) = arg;
373 break;
374 }
375 case INSN_XCV_OUTSIDE: /* 51 */
376 {
377 svindex arg;
378 BGET_objindex(arg);
379 *(SV**)&CvOUTSIDE(sv) = arg;
380 break;
381 }
382 case INSN_XCV_FLAGS: /* 52 */
383 {
384 U8 arg;
385 BGET_U8(arg);
386 CvFLAGS(sv) = arg;
387 break;
388 }
389 case INSN_AV_EXTEND: /* 53 */
390 {
391 SSize_t arg;
392 BGET_I32(arg);
393 BSET_av_extend(sv, arg);
394 break;
395 }
396 case INSN_AV_PUSH: /* 54 */
397 {
398 svindex arg;
399 BGET_objindex(arg);
400 BSET_av_push(sv, arg);
401 break;
402 }
403 case INSN_XAV_FILL: /* 55 */
404 {
405 SSize_t arg;
406 BGET_I32(arg);
407 AvFILL(sv) = arg;
408 break;
409 }
410 case INSN_XAV_MAX: /* 56 */
411 {
412 SSize_t arg;
413 BGET_I32(arg);
414 AvMAX(sv) = arg;
415 break;
416 }
417 case INSN_XAV_FLAGS: /* 57 */
418 {
419 U8 arg;
420 BGET_U8(arg);
421 AvFLAGS(sv) = arg;
422 break;
423 }
424 case INSN_XHV_RITER: /* 58 */
425 {
426 I32 arg;
427 BGET_I32(arg);
428 HvRITER(sv) = arg;
429 break;
430 }
431 case INSN_XHV_NAME: /* 59 */
432 {
433 pvcontents arg;
434 BGET_pvcontents(arg);
435 HvNAME(sv) = arg;
436 break;
437 }
438 case INSN_HV_STORE: /* 60 */
439 {
440 svindex arg;
441 BGET_objindex(arg);
442 BSET_hv_store(sv, arg);
443 break;
444 }
445 case INSN_SV_MAGIC: /* 61 */
446 {
447 char arg;
448 BGET_U8(arg);
449 BSET_sv_magic(sv, arg);
450 break;
451 }
452 case INSN_MG_OBJ: /* 62 */
453 {
454 svindex arg;
455 BGET_objindex(arg);
456 SvMAGIC(sv)->mg_obj = arg;
457 break;
458 }
459 case INSN_MG_PRIVATE: /* 63 */
460 {
461 U16 arg;
462 BGET_U16(arg);
463 SvMAGIC(sv)->mg_private = arg;
464 break;
465 }
466 case INSN_MG_FLAGS: /* 64 */
467 {
468 U8 arg;
469 BGET_U8(arg);
470 SvMAGIC(sv)->mg_flags = arg;
471 break;
472 }
473 case INSN_MG_PV: /* 65 */
474 {
475 pvcontents arg;
476 BGET_pvcontents(arg);
477 BSET_mg_pv(SvMAGIC(sv), arg);
478 break;
479 }
480 case INSN_XMG_STASH: /* 66 */
481 {
482 svindex arg;
483 BGET_objindex(arg);
484 *(SV**)&SvSTASH(sv) = arg;
485 break;
486 }
487 case INSN_GV_FETCHPV: /* 67 */
488 {
489 strconst arg;
490 BGET_strconst(arg);
491 BSET_gv_fetchpv(sv, arg);
492 break;
493 }
494 case INSN_GV_STASHPV: /* 68 */
495 {
496 strconst arg;
497 BGET_strconst(arg);
498 BSET_gv_stashpv(sv, arg);
499 break;
500 }
501 case INSN_GP_SV: /* 69 */
502 {
503 svindex arg;
504 BGET_objindex(arg);
505 GvSV(sv) = arg;
506 break;
507 }
508 case INSN_GP_REFCNT: /* 70 */
509 {
510 U32 arg;
511 BGET_U32(arg);
512 GvREFCNT(sv) = arg;
513 break;
514 }
515 case INSN_GP_REFCNT_ADD: /* 71 */
516 {
517 I32 arg;
518 BGET_I32(arg);
519 BSET_gp_refcnt_add(GvREFCNT(sv), arg);
520 break;
521 }
522 case INSN_GP_AV: /* 72 */
523 {
524 svindex arg;
525 BGET_objindex(arg);
526 *(SV**)&GvAV(sv) = arg;
527 break;
528 }
529 case INSN_GP_HV: /* 73 */
530 {
531 svindex arg;
532 BGET_objindex(arg);
533 *(SV**)&GvHV(sv) = arg;
534 break;
535 }
536 case INSN_GP_CV: /* 74 */
537 {
538 svindex arg;
539 BGET_objindex(arg);
540 *(SV**)&GvCV(sv) = arg;
541 break;
542 }
543 case INSN_GP_FILEGV: /* 75 */
544 {
545 svindex arg;
546 BGET_objindex(arg);
547 *(SV**)&GvFILEGV(sv) = arg;
548 break;
549 }
550 case INSN_GP_IO: /* 76 */
551 {
552 svindex arg;
553 BGET_objindex(arg);
554 *(SV**)&GvIOp(sv) = arg;
555 break;
556 }
557 case INSN_GP_FORM: /* 77 */
558 {
559 svindex arg;
560 BGET_objindex(arg);
561 *(SV**)&GvFORM(sv) = arg;
562 break;
563 }
564 case INSN_GP_CVGEN: /* 78 */
565 {
566 U32 arg;
567 BGET_U32(arg);
568 GvCVGEN(sv) = arg;
569 break;
570 }
571 case INSN_GP_LINE: /* 79 */
572 {
573 line_t arg;
574 BGET_U16(arg);
575 GvLINE(sv) = arg;
576 break;
577 }
578 case INSN_GP_SHARE: /* 80 */
579 {
580 svindex arg;
581 BGET_objindex(arg);
582 BSET_gp_share(sv, arg);
583 break;
584 }
585 case INSN_XGV_FLAGS: /* 81 */
586 {
587 U8 arg;
588 BGET_U8(arg);
589 GvFLAGS(sv) = arg;
590 break;
591 }
592 case INSN_OP_NEXT: /* 82 */
593 {
594 opindex arg;
595 BGET_objindex(arg);
596 op->op_next = arg;
597 break;
598 }
599 case INSN_OP_SIBLING: /* 83 */
600 {
601 opindex arg;
602 BGET_objindex(arg);
603 op->op_sibling = arg;
604 break;
605 }
606 case INSN_OP_PPADDR: /* 84 */
607 {
608 strconst arg;
609 BGET_strconst(arg);
610 BSET_op_ppaddr(op->op_ppaddr, arg);
611 break;
612 }
613 case INSN_OP_TARG: /* 85 */
614 {
615 PADOFFSET arg;
616 BGET_U32(arg);
617 op->op_targ = arg;
618 break;
619 }
620 case INSN_OP_TYPE: /* 86 */
621 {
622 OPCODE arg;
623 BGET_U16(arg);
624 BSET_op_type(op, arg);
625 break;
626 }
627 case INSN_OP_SEQ: /* 87 */
628 {
629 U16 arg;
630 BGET_U16(arg);
631 op->op_seq = arg;
632 break;
633 }
634 case INSN_OP_FLAGS: /* 88 */
635 {
636 U8 arg;
637 BGET_U8(arg);
638 op->op_flags = arg;
639 break;
640 }
641 case INSN_OP_PRIVATE: /* 89 */
642 {
643 U8 arg;
644 BGET_U8(arg);
645 op->op_private = arg;
646 break;
647 }
648 case INSN_OP_FIRST: /* 90 */
649 {
650 opindex arg;
651 BGET_objindex(arg);
652 cUNOP->op_first = arg;
653 break;
654 }
655 case INSN_OP_LAST: /* 91 */
656 {
657 opindex arg;
658 BGET_objindex(arg);
659 cBINOP->op_last = arg;
660 break;
661 }
662 case INSN_OP_OTHER: /* 92 */
663 {
664 opindex arg;
665 BGET_objindex(arg);
666 cLOGOP->op_other = arg;
667 break;
668 }
669 case INSN_OP_TRUE: /* 93 */
670 {
671 opindex arg;
672 BGET_objindex(arg);
673 cCONDOP->op_true = arg;
674 break;
675 }
676 case INSN_OP_FALSE: /* 94 */
677 {
678 opindex arg;
679 BGET_objindex(arg);
680 cCONDOP->op_false = arg;
681 break;
682 }
683 case INSN_OP_CHILDREN: /* 95 */
684 {
685 U32 arg;
686 BGET_U32(arg);
687 cLISTOP->op_children = arg;
688 break;
689 }
690 case INSN_OP_PMREPLROOT: /* 96 */
691 {
692 opindex arg;
693 BGET_objindex(arg);
694 cPMOP->op_pmreplroot = arg;
695 break;
696 }
697 case INSN_OP_PMREPLROOTGV: /* 97 */
698 {
699 svindex arg;
700 BGET_objindex(arg);
701 *(SV**)&cPMOP->op_pmreplroot = arg;
702 break;
703 }
704 case INSN_OP_PMREPLSTART: /* 98 */
705 {
706 opindex arg;
707 BGET_objindex(arg);
708 cPMOP->op_pmreplstart = arg;
709 break;
710 }
711 case INSN_OP_PMNEXT: /* 99 */
712 {
713 opindex arg;
714 BGET_objindex(arg);
715 *(OP**)&cPMOP->op_pmnext = arg;
716 break;
717 }
718 case INSN_PREGCOMP: /* 100 */
719 {
720 pvcontents arg;
721 BGET_pvcontents(arg);
722 BSET_pregcomp(op, arg);
723 break;
724 }
725 case INSN_OP_PMSHORT: /* 101 */
726 {
727 svindex arg;
728 BGET_objindex(arg);
729 cPMOP->op_pmshort = arg;
730 break;
731 }
732 case INSN_OP_PMFLAGS: /* 102 */
733 {
734 U16 arg;
735 BGET_U16(arg);
736 cPMOP->op_pmflags = arg;
737 break;
738 }
739 case INSN_OP_PMPERMFLAGS: /* 103 */
740 {
741 U16 arg;
742 BGET_U16(arg);
743 cPMOP->op_pmpermflags = arg;
744 break;
745 }
746 case INSN_OP_PMSLEN: /* 104 */
747 {
748 char arg;
749 BGET_U8(arg);
750 cPMOP->op_pmslen = arg;
751 break;
752 }
753 case INSN_OP_SV: /* 105 */
754 {
755 svindex arg;
756 BGET_objindex(arg);
757 cSVOP->op_sv = arg;
758 break;
759 }
760 case INSN_OP_GV: /* 106 */
761 {
762 svindex arg;
763 BGET_objindex(arg);
764 cGVOP->op_gv = arg;
765 break;
766 }
767 case INSN_OP_PV: /* 107 */
768 {
769 pvcontents arg;
770 BGET_pvcontents(arg);
771 cPVOP->op_pv = arg;
772 break;
773 }
774 case INSN_OP_PV_TR: /* 108 */
775 {
776 op_tr_array arg;
777 BGET_op_tr_array(arg);
778 cPVOP->op_pv = arg;
779 break;
780 }
781 case INSN_OP_REDOOP: /* 109 */
782 {
783 opindex arg;
784 BGET_objindex(arg);
785 cLOOP->op_redoop = arg;
786 break;
787 }
788 case INSN_OP_NEXTOP: /* 110 */
789 {
790 opindex arg;
791 BGET_objindex(arg);
792 cLOOP->op_nextop = arg;
793 break;
794 }
795 case INSN_OP_LASTOP: /* 111 */
796 {
797 opindex arg;
798 BGET_objindex(arg);
799 cLOOP->op_lastop = arg;
800 break;
801 }
802 case INSN_COP_LABEL: /* 112 */
803 {
804 pvcontents arg;
805 BGET_pvcontents(arg);
806 cCOP->cop_label = arg;
807 break;
808 }
809 case INSN_COP_STASH: /* 113 */
810 {
811 svindex arg;
812 BGET_objindex(arg);
813 *(SV**)&cCOP->cop_stash = arg;
814 break;
815 }
816 case INSN_COP_FILEGV: /* 114 */
817 {
818 svindex arg;
819 BGET_objindex(arg);
820 cCOP->cop_filegv = arg;
821 break;
822 }
823 case INSN_COP_SEQ: /* 115 */
824 {
825 U32 arg;
826 BGET_U32(arg);
827 cCOP->cop_seq = arg;
828 break;
829 }
830 case INSN_COP_ARYBASE: /* 116 */
831 {
832 I32 arg;
833 BGET_I32(arg);
834 cCOP->cop_arybase = arg;
835 break;
836 }
837 case INSN_COP_LINE: /* 117 */
838 {
839 line_t arg;
840 BGET_U16(arg);
841 cCOP->cop_line = arg;
842 break;
843 }
844 case INSN_MAIN_START: /* 118 */
845 {
846 opindex arg;
847 BGET_objindex(arg);
848 main_start = arg;
849 break;
850 }
851 case INSN_MAIN_ROOT: /* 119 */
852 {
853 opindex arg;
854 BGET_objindex(arg);
855 main_root = arg;
856 break;
857 }
858 case INSN_CURPAD: /* 120 */
859 {
860 svindex arg;
861 BGET_objindex(arg);
862 BSET_curpad(curpad, arg);
863 break;
864 }
865 default:
866 croak("Illegal bytecode instruction %d\n", insn);
867 /* NOTREACHED */
868 }
869 }
870}