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