X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=bytecode.pl;h=fc2cae4786c429dd16c2869705f9197d877fd230;hb=5b5cf8d2a2291946fc318cadec7c0c58e74bd1aa;hp=adf1d1fa46ac9e2dc250563ade1e48494620ce27;hpb=87a1ef3dbc71790d3dec7643306775e0d1e4768a;p=p5sagit%2Fp5-mst-13.2.git diff --git a/bytecode.pl b/bytecode.pl index adf1d1f..fc2cae4 100644 --- a/bytecode.pl +++ b/bytecode.pl @@ -22,7 +22,8 @@ while (($from, $tos) = each %alias_to) { } my $c_header = <<'EOT'; -/* +/* -*- buffer-read-only: t -*- + * * Copyright (c) 1996-1999 Malcolm Beattie * * You may distribute under the terms of either the GNU General Public @@ -105,12 +106,13 @@ bset_obj_store(pTHX_ struct byteloader_state *bstate, void *obj, I32 ix) int byterun(pTHX_ register struct byteloader_state *bstate) { + dVAR; register int insn; U32 ix; SV *specialsv_list[6]; 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; @@ -194,6 +196,8 @@ print BYTERUN_C <<'EOT'; } return 0; } + +/* ex: set ro: */ EOT # @@ -208,13 +212,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; }; @@ -250,6 +259,8 @@ for ($i = 0; $i < @optype - 1; $i++) { } printf BYTERUN_H " OPt_%s\t\t/* %d */\n};\n\n", $optype[$i], $i; +print BYTERUN_H "/* ex: set ro: */\n"; + # # Finish off insn_data and create array initialisers in Asmdata.pm # @@ -314,7 +325,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'). @@ -325,6 +336,8 @@ or '&PL_sv_undef'). Malcolm Beattie, C =cut + +# ex: set ro: EOT @@ -353,7 +366,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 @@ -362,8 +375,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 @@ -411,10 +424,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 @@ -422,7 +433,7 @@ mg_private SvMAGIC(bstate->bs_sv)->mg_private U16 mg_flags SvMAGIC(bstate->bs_sv)->mg_flags U8 mg_name SvMAGIC(bstate->bs_sv) pvcontents x mg_namex SvMAGIC(bstate->bs_sv) svindex x -xmg_stash bstate->bs_sv svindex X +xmg_stash bstate->bs_sv svindex x gv_fetchpv bstate->bs_sv strconst x gv_fetchpvx bstate->bs_sv strconst x gv_stashpv bstate->bs_sv strconst x