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