This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to threads 1.37, by Jerry D. Hedden
[perl5.git] / bytecode.pl
index d8ce8ed..cad64bc 100644 (file)
@@ -14,7 +14,8 @@ my @optype= qw(OP UNOP BINOP LOGOP LISTOP PMOP SVOP PADOP PVOP LOOP COP);
 
 # Nullsv *must* come first in the following so that the condition
 # ($$sv == 0) can continue to be used to test (sv == Nullsv).
-my @specialsv = qw(Nullsv &PL_sv_undef &PL_sv_yes &PL_sv_no pWARN_ALL pWARN_NONE);
+my @specialsv = qw(Nullsv &PL_sv_undef &PL_sv_yes &PL_sv_no
+                  (SV*)pWARN_ALL (SV*)pWARN_NONE (SV*)pWARN_STD);
 
 my (%alias_from, $from, $tos);
 while (($from, $tos) = each %alias_to) {
@@ -89,7 +90,10 @@ for ($i = 0; $i < @optype - 1; $i++) {
     printf BYTERUN_C "    sizeof(%s),\n", $optype[$i], $i;
 }
 printf BYTERUN_C "    sizeof(%s)\n", $optype[$i], $i;
-print BYTERUN_C <<'EOT';
+
+my $size = @specialsv;
+
+print BYTERUN_C <<"EOT";
 };
 
 void *
@@ -109,10 +113,10 @@ byterun(pTHX_ register struct byteloader_state *bstate)
     dVAR;
     register int insn;
     U32 ix;
-    SV *specialsv_list[6];
+    SV *specialsv_list[$size];
 
     BYTECODE_HEADER_CHECK;     /* croak if incorrect platform */
-    New(666, bstate->bs_obj_list, 32, void*); /* set op objlist */
+    Newx(bstate->bs_obj_list, 32, void*); /* set op objlist */
     bstate->bs_obj_list_fill = 31;
     bstate->bs_obj_list[0] = NULL; /* first is always Null */
     bstate->bs_ix = 1;
@@ -212,13 +216,18 @@ struct byteloader_fdata {
     int        idx;
 };
 
+struct byteloader_pv_state {
+    char                       *pvx;
+    XPV                                xpv;
+};
+
 struct byteloader_state {
     struct byteloader_fdata    *bs_fdata;
     SV                         *bs_sv;
     void                       **bs_obj_list;
     int                                bs_obj_list_fill;
     int                                bs_ix;
-    XPV                                bs_pv;
+    struct byteloader_pv_state bs_pv;
     int                                bs_iv_overflows;
 };
 
@@ -320,7 +329,7 @@ A simple mapping of the op type number to its type (like 'COP' or 'BINOP').
   my $sv_name = $specialsv_name[$sv_index];
 
 Certain SV types are considered 'special'.  They're represented by
-B::SPECIAL and are refered to by a number from the specialsv_list.
+B::SPECIAL and are referred to by a number from the specialsv_list.
 This array maps that number back to the name of the SV (like 'Nullsv'
 or '&PL_sv_undef').
 
@@ -361,7 +370,7 @@ ldsv                bstate->bs_sv                           svindex
 ldop           PL_op                                   opindex
 stsv           bstate->bs_sv                           U32             s
 stop           PL_op                                   U32             s
-stpv           bstate->bs_pv.xpv_pv                    U32             x
+stpv           bstate->bs_pv.pvx                       U32             x
 ldspecsv       bstate->bs_sv                           U8              x
 ldspecsvx      bstate->bs_sv                           U8              x
 newsv          bstate->bs_sv                           U8              x
@@ -370,8 +379,8 @@ newop               PL_op                                   U8              x
 newopx         PL_op                                   U16             x
 newopn         PL_op                                   U8              x
 newpv          none                                    PV
-pv_cur         bstate->bs_pv.xpv_cur                   STRLEN
-pv_free                bstate->bs_pv                           none            x
+pv_cur         bstate->bs_pv.xpv.xpv_cur               STRLEN
+pv_free                bstate->bs_pv.pvx                       none            x
 sv_upgrade     bstate->bs_sv                           U8              x
 sv_refcnt      SvREFCNT(bstate->bs_sv)                 U32
 sv_refcnt_add  SvREFCNT(bstate->bs_sv)                 I32             x
@@ -419,10 +428,8 @@ av_pushx   bstate->bs_sv                           svindex         x
 av_push                bstate->bs_sv                           svindex         x
 xav_fill       AvFILLp(bstate->bs_sv)                  SSize_t
 xav_max                AvMAX(bstate->bs_sv)                    SSize_t
-xav_flags      AvFLAGS(bstate->bs_sv)                  U8
 xhv_riter      HvRITER(bstate->bs_sv)                  I32
-xhv_name       HvNAME(bstate->bs_sv)                   pvindex
-xhv_pmroot     *(OP**)&HvPMROOT(bstate->bs_sv)         opindex
+xhv_name       bstate->bs_sv                           pvindex         x
 hv_store       bstate->bs_sv                           svindex         x
 sv_magic       bstate->bs_sv                           char            x
 mg_obj         SvMAGIC(bstate->bs_sv)->mg_obj          svindex
@@ -441,7 +448,7 @@ gp_refcnt_add       GvREFCNT(bstate->bs_sv)                 I32             x
 gp_av          *(SV**)&GvAV(bstate->bs_sv)             svindex
 gp_hv          *(SV**)&GvHV(bstate->bs_sv)             svindex
 gp_cv          *(SV**)&GvCV(bstate->bs_sv)             svindex
-gp_file                GvFILE(bstate->bs_sv)                   pvindex
+gp_file                bstate->bs_sv                           pvindex         x
 gp_io          *(SV**)&GvIOp(bstate->bs_sv)            svindex
 gp_form                *(SV**)&GvFORM(bstate->bs_sv)           svindex
 gp_cvgen       GvCVGEN(bstate->bs_sv)                  U32
@@ -490,10 +497,9 @@ cop_stash  cCOP                                    svindex         x
 cop_filegv     cCOP                                    svindex         x
 #endif
 cop_seq                cCOP->cop_seq                           U32
-cop_arybase    cCOP->cop_arybase                       I32
+cop_arybase    cCOP                                    I32             x
 cop_line       cCOP->cop_line                          line_t
-cop_io         cCOP->cop_io                            svindex
-cop_warnings   cCOP->cop_warnings                      svindex
+cop_warnings   cCOP                                    svindex         x
 main_start     PL_main_start                           opindex
 main_root      PL_main_root                            opindex
 main_cv                *(SV**)&PL_main_cv                      svindex