diff options
author | Charles Bailey <bailey@newman.upenn.edu> | 2000-10-20 04:44:37 +0000 |
---|---|---|
committer | bailey <bailey@newman.upenn.edu> | 2000-10-20 04:44:37 +0000 |
commit | 22d4bb9ccb8701e68f9243547d7e3a3c55f70908 (patch) | |
tree | d2e7714cc660a21e8bf2624c99646b0cb001e40c /ext/ByteLoader | |
parent | 4b19af017623bfa3bb72bb164598a517f586e0d3 (diff) | |
download | perl-22d4bb9ccb8701e68f9243547d7e3a3c55f70908.tar.gz |
SYN SYN
p4raw-id: //depot/vmsperl@7375
Diffstat (limited to 'ext/ByteLoader')
-rw-r--r-- | ext/ByteLoader/ByteLoader.pm | 6 | ||||
-rw-r--r-- | ext/ByteLoader/ByteLoader.xs | 103 | ||||
-rw-r--r-- | ext/ByteLoader/bytecode.h | 170 | ||||
-rw-r--r-- | ext/ByteLoader/byterun.c | 453 | ||||
-rw-r--r-- | ext/ByteLoader/byterun.h | 258 |
5 files changed, 586 insertions, 404 deletions
diff --git a/ext/ByteLoader/ByteLoader.pm b/ext/ByteLoader/ByteLoader.pm index 286d74697e..9c8c84d677 100644 --- a/ext/ByteLoader/ByteLoader.pm +++ b/ext/ByteLoader/ByteLoader.pm @@ -2,7 +2,7 @@ package ByteLoader; use XSLoader (); -$VERSION = 0.03; +$VERSION = 0.04; XSLoader::load 'ByteLoader', $VERSION; @@ -17,10 +17,10 @@ ByteLoader - load byte compiled perl code =head1 SYNOPSIS - use ByteLoader 0.03; + use ByteLoader 0.04; <byte code> - use ByteLoader 0.03; + use ByteLoader 0.04; <byte code> =head1 DESCRIPTION diff --git a/ext/ByteLoader/ByteLoader.xs b/ext/ByteLoader/ByteLoader.xs index 7c3746bba7..d3b435199e 100644 --- a/ext/ByteLoader/ByteLoader.xs +++ b/ext/ByteLoader/ByteLoader.xs @@ -4,31 +4,74 @@ #include "XSUB.h" #include "byterun.h" -static int -xgetc(PerlIO *io) -{ - dTHX; - return PerlIO_getc(io); -} +/* Something arbitary for a buffer size */ +#define BYTELOADER_BUFFER 8096 -static int -xfread(char *buf, size_t size, size_t n, PerlIO *io) +int +bl_getc(struct byteloader_fdata *data) { dTHX; - int i = PerlIO_read(io, buf, n * size); - if (i > 0) - i /= size; - return i; + if (SvCUR(data->datasv) <= data->next_out) { + int result; + /* Run out of buffered data, so attempt to read some more */ + *(SvPV_nolen (data->datasv)) = '\0'; + SvCUR_set (data->datasv, 0); + data->next_out = 0; + result = FILTER_READ (data->idx + 1, data->datasv, BYTELOADER_BUFFER); + + /* Filter returned error, or we got EOF and no data, then return EOF. + Not sure if filter is allowed to return EOF and add data simultaneously + Think not, but will bullet proof against it. */ + if (result < 0 || SvCUR(data->datasv) == 0) + return EOF; + /* Else there must be at least one byte present, which is good enough */ + } + + return *((char *) SvPV_nolen (data->datasv) + data->next_out++); } -static void -freadpv(U32 len, void *data, XPV *pv) +int +bl_read(struct byteloader_fdata *data, char *buf, size_t size, size_t n) { dTHX; - New(666, pv->xpv_pv, len, char); - PerlIO_read((PerlIO*)data, (void*)pv->xpv_pv, len); - pv->xpv_len = len; - pv->xpv_cur = len - 1; + char *start; + STRLEN len; + size_t wanted = size * n; + + start = SvPV (data->datasv, len); + if (len < (data->next_out + wanted)) { + int result; + + /* Shuffle data to start of buffer */ + len -= data->next_out; + if (len) { + memmove (start, start + data->next_out, len + 1); + SvCUR_set (data->datasv, len); + } else { + *start = '\0'; /* Avoid call to memmove. */ + SvCUR_set (data->datasv, 0); + } + data->next_out = 0; + + /* Attempt to read more data. */ + do { + result = FILTER_READ (data->idx + 1, data->datasv, BYTELOADER_BUFFER); + + start = SvPV (data->datasv, len); + } while (result > 0 && len < wanted); + /* Loop while not (EOF || error) and short reads */ + + /* If not enough data read, truncate copy */ + if (wanted > len) + wanted = len; + } + + if (wanted > 0) { + memcpy (buf, start + data->next_out, wanted); + data->next_out += wanted; + wanted /= size; + } + return (int) wanted; } static I32 @@ -37,14 +80,20 @@ byteloader_filter(pTHXo_ int idx, SV *buf_sv, int maxlen) dTHR; OP *saveroot = PL_main_root; OP *savestart = PL_main_start; - struct bytestream bs; + struct byteloader_state bstate; + struct byteloader_fdata data; + + data.next_out = 0; + data.datasv = FILTER_DATA(idx); + data.idx = idx; - bs.data = PL_rsfp; - bs.pfgetc = (int(*) (void*))xgetc; - bs.pfread = (int(*) (char*,size_t,size_t,void*))xfread; - bs.pfreadpv = freadpv; + bstate.bs_fdata = &data; + bstate.bs_obj_list = Null(void**); + bstate.bs_obj_list_fill = -1; + bstate.bs_sv = Nullsv; + bstate.bs_iv_overflows = 0; - byterun(aTHXo_ bs); + byterun(aTHXo_ &bstate); if (PL_in_eval) { OP *o; @@ -70,8 +119,12 @@ PROTOTYPES: ENABLE void import(...) + PREINIT: + SV *sv = newSVpvn ("", 0); PPCODE: - filter_add(byteloader_filter, NULL); + if (!sv) + croak ("Could not allocate ByteLoader buffers"); + filter_add(byteloader_filter, sv); void unimport(...) diff --git a/ext/ByteLoader/bytecode.h b/ext/ByteLoader/bytecode.h index 1621fed4eb..c6acd28436 100644 --- a/ext/ByteLoader/bytecode.h +++ b/ext/ByteLoader/bytecode.h @@ -5,29 +5,33 @@ typedef char *op_tr_array; typedef int comment_t; typedef SV *svindex; typedef OP *opindex; +typedef char *pvindex; typedef IV IV64; #define BGET_FREAD(argp, len, nelem) \ - bs.pfread((char*)(argp),(len),(nelem),bs.data) -#define BGET_FGETC() bs.pfgetc(bs.data) + bl_read(bstate->bs_fdata,(char*)(argp),(len),(nelem)) +#define BGET_FGETC() bl_getc(bstate->bs_fdata) #define BGET_U32(arg) \ - BGET_FREAD(&arg, sizeof(U32), 1); arg = PerlSock_ntohl((U32)arg) + BGET_FREAD(&arg, sizeof(U32), 1) #define BGET_I32(arg) \ - BGET_FREAD(&arg, sizeof(I32), 1); arg = (I32)PerlSock_ntohl((U32)arg) + BGET_FREAD(&arg, sizeof(I32), 1) #define BGET_U16(arg) \ - BGET_FREAD(&arg, sizeof(U16), 1); arg = PerlSock_ntohs((U16)arg) + BGET_FREAD(&arg, sizeof(U16), 1) #define BGET_U8(arg) arg = BGET_FGETC() -#define BGET_PV(arg) STMT_START { \ - BGET_U32(arg); \ - if (arg) \ - bs.pfreadpv(arg, bs.data, &bytecode_pv); \ - else { \ - bytecode_pv.xpv_pv = 0; \ - bytecode_pv.xpv_len = 0; \ - bytecode_pv.xpv_cur = 0; \ - } \ +#define BGET_PV(arg) STMT_START { \ + BGET_U32(arg); \ + if (arg) { \ + New(666, bstate->bs_pv.xpv_pv, arg, char); \ + bl_read(bstate->bs_fdata, (void*)bstate->bs_pv.xpv_pv, arg, 1); \ + bstate->bs_pv.xpv_len = arg; \ + bstate->bs_pv.xpv_cur = arg - 1; \ + } else { \ + bstate->bs_pv.xpv_pv = 0; \ + bstate->bs_pv.xpv_len = 0; \ + bstate->bs_pv.xpv_cur = 0; \ + } \ } STMT_END #ifdef BYTELOADER_LOG_COMMENTS @@ -63,22 +67,20 @@ typedef IV IV64; arg = (I32)lo; \ } \ else { \ - bytecode_iv_overflows++; \ + bstate->bs_iv_overflows++; \ arg = 0; \ } \ } STMT_END -#define BGET_op_tr_array(arg) do { \ - unsigned short *ary; \ - int i; \ - New(666, ary, 256, unsigned short); \ - BGET_FREAD(ary, 256, 2); \ - for (i = 0; i < 256; i++) \ - ary[i] = PerlSock_ntohs(ary[i]); \ - arg = (char *) ary; \ +#define BGET_op_tr_array(arg) do { \ + unsigned short *ary; \ + int i; \ + New(666, ary, 256, unsigned short); \ + BGET_FREAD(ary, sizeof(unsigned short), 256); \ + arg = (char *) ary; \ } while (0) -#define BGET_pvcontents(arg) arg = bytecode_pv.xpv_pv +#define BGET_pvcontents(arg) arg = bstate->bs_pv.xpv_pv #define BGET_strconst(arg) STMT_START { \ for (arg = PL_tokenbuf; (*arg = BGET_FGETC()); arg++) /* nothing */; \ arg = PL_tokenbuf; \ @@ -91,14 +93,21 @@ typedef IV IV64; } STMT_END #define BGET_objindex(arg, type) STMT_START { \ - U32 ix; \ BGET_U32(ix); \ - arg = (type)bytecode_obj_list[ix]; \ + arg = (type)bstate->bs_obj_list[ix]; \ } STMT_END #define BGET_svindex(arg) BGET_objindex(arg, svindex) #define BGET_opindex(arg) BGET_objindex(arg, opindex) +#define BGET_pvindex(arg) STMT_START { \ + BGET_objindex(arg, pvindex); \ + arg = arg ? savepv(arg) : arg; \ + } STMT_END #define BSET_ldspecsv(sv, arg) sv = specialsv_list[arg] +#define BSET_stpv(pv, arg) STMT_START { \ + BSET_OBJ_STORE(pv, arg); \ + SAVEFREEPV(pv); \ + } STMT_END #define BSET_sv_refcnt_add(svrefcnt, arg) svrefcnt += arg #define BSET_gp_refcnt_add(gprefcnt, arg) gprefcnt += arg @@ -110,23 +119,29 @@ typedef IV IV64; #define BSET_gv_fetchpv(sv, arg) sv = (SV*)gv_fetchpv(arg, TRUE, SVt_PV) #define BSET_gv_stashpv(sv, arg) sv = (SV*)gv_stashpv(arg, TRUE) #define BSET_sv_magic(sv, arg) sv_magic(sv, Nullsv, arg, 0, 0) -#define BSET_mg_pv(mg, arg) mg->mg_ptr = arg; mg->mg_len = bytecode_pv.xpv_cur +#define BSET_mg_pv(mg, arg) mg->mg_ptr = arg; mg->mg_len = bstate->bs_pv.xpv_cur #define BSET_sv_upgrade(sv, arg) (void)SvUPGRADE(sv, arg) #define BSET_xpv(sv) do { \ - SvPV_set(sv, bytecode_pv.xpv_pv); \ - SvCUR_set(sv, bytecode_pv.xpv_cur); \ - SvLEN_set(sv, bytecode_pv.xpv_len); \ + SvPV_set(sv, bstate->bs_pv.xpv_pv); \ + SvCUR_set(sv, bstate->bs_pv.xpv_cur); \ + SvLEN_set(sv, bstate->bs_pv.xpv_len); \ } while (0) #define BSET_av_extend(sv, arg) av_extend((AV*)sv, arg) #define BSET_av_push(sv, arg) av_push((AV*)sv, arg) #define BSET_hv_store(sv, arg) \ - hv_store((HV*)sv, bytecode_pv.xpv_pv, bytecode_pv.xpv_cur, arg, 0) + hv_store((HV*)sv, bstate->bs_pv.xpv_pv, bstate->bs_pv.xpv_cur, arg, 0) #define BSET_pv_free(pv) Safefree(pv.xpv_pv) #define BSET_pregcomp(o, arg) \ ((PMOP*)o)->op_pmregexp = arg ? \ - CALLREGCOMP(aTHX_ arg, arg + bytecode_pv.xpv_cur, ((PMOP*)o)) : 0 -#define BSET_newsv(sv, arg) sv = NEWSV(666,0); SvUPGRADE(sv, arg) + CALLREGCOMP(aTHX_ arg, arg + bstate->bs_pv.xpv_cur, ((PMOP*)o)) : 0 +#define BSET_newsv(sv, arg) \ + STMT_START { \ + sv = (arg == SVt_PVAV ? (SV*)newAV() : \ + arg == SVt_PVHV ? (SV*)newHV() : \ + NEWSV(666,0)); \ + SvUPGRADE(sv, arg); \ + } STMT_END #define BSET_newop(o, arg) ((o = (OP*)safemalloc(optype_size[arg])), \ memzero((char*)o,optype_size[arg])) #define BSET_newopn(o, arg) STMT_START { \ @@ -135,7 +150,10 @@ typedef IV IV64; oldop->op_next = o; \ } STMT_END -#define BSET_ret(foo) return +#define BSET_ret(foo) STMT_START { \ + Safefree(bstate->bs_obj_list); \ + return; \ + } STMT_END /* * Kludge special-case workaround for OP_MAPSTART @@ -152,10 +170,88 @@ typedef IV IV64; PL_comppad = (AV *)arg; \ pad = AvARRAY(arg); \ } STMT_END +/* this works now that Sarathy's changed the CopFILE_set macro to do the SvREFCNT_inc() + -- BKS 6-2-2000 */ #define BSET_cop_file(cop, arg) CopFILE_set(cop,arg) #define BSET_cop_line(cop, arg) CopLINE_set(cop,arg) #define BSET_cop_stashpv(cop, arg) CopSTASHPV_set(cop,arg) -#define BSET_OBJ_STORE(obj, ix) \ - (I32)ix > bytecode_obj_list_fill ? \ - bset_obj_store(aTHXo_ obj, (I32)ix) : (bytecode_obj_list[ix] = obj) +/* this is simply stolen from the code in newATTRSUB() */ +#define BSET_push_begin(ary,cv) \ + STMT_START { \ + I32 oldscope = PL_scopestack_ix; \ + ENTER; \ + SAVECOPFILE(&PL_compiling); \ + SAVECOPLINE(&PL_compiling); \ + save_svref(&PL_rs); \ + sv_setsv(PL_rs, PL_nrs); \ + if (!PL_beginav) \ + PL_beginav = newAV(); \ + av_push(PL_beginav, cv); \ + call_list(oldscope, PL_beginav); \ + PL_curcop = &PL_compiling; \ + PL_compiling.op_private = PL_hints; \ + LEAVE; \ + } STMT_END +#define BSET_push_init(ary,cv) \ + STMT_START { \ + av_unshift((PL_initav ? PL_initav : (PL_initav = newAV(), PL_initav)), 1); \ + av_store(PL_initav, 0, cv); \ + } STMT_END +#define BSET_push_end(ary,cv) \ + STMT_START { \ + av_unshift((PL_endav ? PL_endav : (PL_endav = newAV(), PL_endav)), 1); \ + av_store(PL_endav, 0, cv); \ + } STMT_END +#define BSET_OBJ_STORE(obj, ix) \ + (I32)ix > bstate->bs_obj_list_fill ? \ + bset_obj_store(aTHXo_ bstate, obj, (I32)ix) : (bstate->bs_obj_list[ix] = obj) + +/* NOTE: the bytecode header only sanity-checks the bytecode. If a script cares about + * what version of Perl it's being called under, it should do a 'require 5.6.0' or + * equivalent. However, since the header includes checks requiring an exact match in + * ByteLoader versions (we can't guarantee forward compatibility), you don't + * need to specify one: + * use ByteLoader; + * is all you need. + * -- BKS, June 2000 +*/ + +#define HEADER_FAIL(f) \ + Perl_croak(aTHX_ "Invalid bytecode for this architecture: " f) +#define HEADER_FAIL1(f, arg1) \ + Perl_croak(aTHX_ "Invalid bytecode for this architecture: " f, arg1) +#define HEADER_FAIL2(f, arg1, arg2) \ + Perl_croak(aTHX_ "Invalid bytecode for this architecture: " f, arg1, arg2) + +#define BYTECODE_HEADER_CHECK \ + STMT_START { \ + U32 sz = 0; \ + strconst str; \ + \ + BGET_U32(sz); /* Magic: 'PLBC' */ \ + if (sz != 0x43424c50) { \ + HEADER_FAIL1("bad magic (want 0x43424c50, got %#x)", (int)sz); \ + } \ + BGET_strconst(str); /* archname */ \ + if (strNE(str, ARCHNAME)) { \ + HEADER_FAIL2("wrong architecture (want %s, you have %s)",str,ARCHNAME); \ + } \ + BGET_strconst(str); /* ByteLoader version */ \ + if (strNE(str, VERSION)) { \ + HEADER_FAIL2("mismatched ByteLoader versions (want %s, you have %s)", \ + str, VERSION); \ + } \ + BGET_U32(sz); /* ivsize */ \ + if (sz != IVSIZE) { \ + HEADER_FAIL("different IVSIZE"); \ + } \ + BGET_U32(sz); /* ptrsize */ \ + if (sz != PTRSIZE) { \ + HEADER_FAIL("different PTRSIZE"); \ + } \ + BGET_strconst(str); /* byteorder */ \ + if (strNE(str, STRINGIFY(BYTEORDER))) { \ + HEADER_FAIL("different byteorder"); \ + } \ + } STMT_END diff --git a/ext/ByteLoader/byterun.c b/ext/ByteLoader/byterun.c index a1044ab2c0..19f1f6b44c 100644 --- a/ext/ByteLoader/byterun.c +++ b/ext/ByteLoader/byterun.c @@ -26,7 +26,7 @@ #include "bytecode.h" -static int optype_size[] = { +static const int optype_size[] = { sizeof(OP), sizeof(UNOP), sizeof(BINOP), @@ -40,38 +40,35 @@ static int optype_size[] = { sizeof(COP) }; -static SV *specialsv_list[4]; - -static int bytecode_iv_overflows = 0; -static SV *bytecode_sv; -static XPV bytecode_pv; -static void **bytecode_obj_list; -static I32 bytecode_obj_list_fill = -1; - void * -bset_obj_store(pTHXo_ void *obj, I32 ix) +bset_obj_store(pTHXo_ struct byteloader_state *bstate, void *obj, I32 ix) { - if (ix > bytecode_obj_list_fill) { - if (bytecode_obj_list_fill == -1) - New(666, bytecode_obj_list, ix + 1, void*); - else - Renew(bytecode_obj_list, ix + 1, void*); - bytecode_obj_list_fill = ix; + if (ix > bstate->bs_obj_list_fill) { + Renew(bstate->bs_obj_list, ix + 32, void*); + bstate->bs_obj_list_fill = ix + 31; } - bytecode_obj_list[ix] = obj; + bstate->bs_obj_list[ix] = obj; return obj; } void -byterun(pTHXo_ struct bytestream bs) +byterun(pTHXo_ register struct byteloader_state *bstate) { dTHR; - int insn; + 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 */ + bstate->bs_obj_list_fill = 31; specialsv_list[0] = Nullsv; specialsv_list[1] = &PL_sv_undef; specialsv_list[2] = &PL_sv_yes; specialsv_list[3] = &PL_sv_no; + specialsv_list[4] = pWARN_ALL; + specialsv_list[5] = pWARN_NONE; while ((insn = BGET_FGETC()) != EOF) { switch (insn) { @@ -95,7 +92,7 @@ byterun(pTHXo_ struct bytestream bs) { svindex arg; BGET_svindex(arg); - bytecode_sv = arg; + bstate->bs_sv = arg; break; } case INSN_LDOP: /* 2 */ @@ -109,7 +106,7 @@ byterun(pTHXo_ struct bytestream bs) { U32 arg; BGET_U32(arg); - BSET_OBJ_STORE(bytecode_sv, arg); + BSET_OBJ_STORE(bstate->bs_sv, arg); break; } case INSN_STOP: /* 4 */ @@ -119,778 +116,806 @@ byterun(pTHXo_ struct bytestream bs) BSET_OBJ_STORE(PL_op, arg); break; } - case INSN_LDSPECSV: /* 5 */ + case INSN_STPV: /* 5 */ + { + U32 arg; + BGET_U32(arg); + BSET_stpv(bstate->bs_pv.xpv_pv, arg); + break; + } + case INSN_LDSPECSV: /* 6 */ { U8 arg; BGET_U8(arg); - BSET_ldspecsv(bytecode_sv, arg); + BSET_ldspecsv(bstate->bs_sv, arg); break; } - case INSN_NEWSV: /* 6 */ + case INSN_NEWSV: /* 7 */ { U8 arg; BGET_U8(arg); - BSET_newsv(bytecode_sv, arg); + BSET_newsv(bstate->bs_sv, arg); break; } - case INSN_NEWOP: /* 7 */ + case INSN_NEWOP: /* 8 */ { U8 arg; BGET_U8(arg); BSET_newop(PL_op, arg); break; } - case INSN_NEWOPN: /* 8 */ + case INSN_NEWOPN: /* 9 */ { U8 arg; BGET_U8(arg); BSET_newopn(PL_op, arg); break; } - case INSN_NEWPV: /* 9 */ + case INSN_NEWPV: /* 11 */ { PV arg; BGET_PV(arg); break; } - case INSN_PV_CUR: /* 11 */ + case INSN_PV_CUR: /* 12 */ { STRLEN arg; BGET_U32(arg); - bytecode_pv.xpv_cur = arg; + bstate->bs_pv.xpv_cur = arg; break; } - case INSN_PV_FREE: /* 12 */ + case INSN_PV_FREE: /* 13 */ { - BSET_pv_free(bytecode_pv); + BSET_pv_free(bstate->bs_pv); break; } - case INSN_SV_UPGRADE: /* 13 */ + case INSN_SV_UPGRADE: /* 14 */ { char arg; BGET_U8(arg); - BSET_sv_upgrade(bytecode_sv, arg); + BSET_sv_upgrade(bstate->bs_sv, arg); break; } - case INSN_SV_REFCNT: /* 14 */ + case INSN_SV_REFCNT: /* 15 */ { U32 arg; BGET_U32(arg); - SvREFCNT(bytecode_sv) = arg; + SvREFCNT(bstate->bs_sv) = arg; break; } - case INSN_SV_REFCNT_ADD: /* 15 */ + case INSN_SV_REFCNT_ADD: /* 16 */ { I32 arg; BGET_I32(arg); - BSET_sv_refcnt_add(SvREFCNT(bytecode_sv), arg); + BSET_sv_refcnt_add(SvREFCNT(bstate->bs_sv), arg); break; } - case INSN_SV_FLAGS: /* 16 */ + case INSN_SV_FLAGS: /* 17 */ { U32 arg; BGET_U32(arg); - SvFLAGS(bytecode_sv) = arg; + SvFLAGS(bstate->bs_sv) = arg; break; } - case INSN_XRV: /* 17 */ + case INSN_XRV: /* 18 */ { svindex arg; BGET_svindex(arg); - SvRV(bytecode_sv) = arg; + SvRV(bstate->bs_sv) = arg; break; } - case INSN_XPV: /* 18 */ + case INSN_XPV: /* 19 */ { - BSET_xpv(bytecode_sv); + BSET_xpv(bstate->bs_sv); break; } - case INSN_XIV32: /* 19 */ + case INSN_XIV32: /* 20 */ { I32 arg; BGET_I32(arg); - SvIVX(bytecode_sv) = arg; + SvIVX(bstate->bs_sv) = arg; break; } - case INSN_XIV64: /* 20 */ + case INSN_XIV64: /* 21 */ { IV64 arg; BGET_IV64(arg); - SvIVX(bytecode_sv) = arg; + SvIVX(bstate->bs_sv) = arg; break; } - case INSN_XNV: /* 21 */ + case INSN_XNV: /* 22 */ { NV arg; BGET_NV(arg); - SvNVX(bytecode_sv) = arg; + SvNVX(bstate->bs_sv) = arg; break; } - case INSN_XLV_TARGOFF: /* 22 */ + case INSN_XLV_TARGOFF: /* 23 */ { STRLEN arg; BGET_U32(arg); - LvTARGOFF(bytecode_sv) = arg; + LvTARGOFF(bstate->bs_sv) = arg; break; } - case INSN_XLV_TARGLEN: /* 23 */ + case INSN_XLV_TARGLEN: /* 24 */ { STRLEN arg; BGET_U32(arg); - LvTARGLEN(bytecode_sv) = arg; + LvTARGLEN(bstate->bs_sv) = arg; break; } - case INSN_XLV_TARG: /* 24 */ + case INSN_XLV_TARG: /* 25 */ { svindex arg; BGET_svindex(arg); - LvTARG(bytecode_sv) = arg; + LvTARG(bstate->bs_sv) = arg; break; } - case INSN_XLV_TYPE: /* 25 */ + case INSN_XLV_TYPE: /* 26 */ { char arg; BGET_U8(arg); - LvTYPE(bytecode_sv) = arg; + LvTYPE(bstate->bs_sv) = arg; break; } - case INSN_XBM_USEFUL: /* 26 */ + case INSN_XBM_USEFUL: /* 27 */ { I32 arg; BGET_I32(arg); - BmUSEFUL(bytecode_sv) = arg; + BmUSEFUL(bstate->bs_sv) = arg; break; } - case INSN_XBM_PREVIOUS: /* 27 */ + case INSN_XBM_PREVIOUS: /* 28 */ { U16 arg; BGET_U16(arg); - BmPREVIOUS(bytecode_sv) = arg; + BmPREVIOUS(bstate->bs_sv) = arg; break; } - case INSN_XBM_RARE: /* 28 */ + case INSN_XBM_RARE: /* 29 */ { U8 arg; BGET_U8(arg); - BmRARE(bytecode_sv) = arg; + BmRARE(bstate->bs_sv) = arg; break; } - case INSN_XFM_LINES: /* 29 */ + case INSN_XFM_LINES: /* 30 */ { I32 arg; BGET_I32(arg); - FmLINES(bytecode_sv) = arg; + FmLINES(bstate->bs_sv) = arg; break; } - case INSN_XIO_LINES: /* 30 */ + case INSN_XIO_LINES: /* 31 */ { long arg; BGET_I32(arg); - IoLINES(bytecode_sv) = arg; + IoLINES(bstate->bs_sv) = arg; break; } - case INSN_XIO_PAGE: /* 31 */ + case INSN_XIO_PAGE: /* 32 */ { long arg; BGET_I32(arg); - IoPAGE(bytecode_sv) = arg; + IoPAGE(bstate->bs_sv) = arg; break; } - case INSN_XIO_PAGE_LEN: /* 32 */ + case INSN_XIO_PAGE_LEN: /* 33 */ { long arg; BGET_I32(arg); - IoPAGE_LEN(bytecode_sv) = arg; + IoPAGE_LEN(bstate->bs_sv) = arg; break; } - case INSN_XIO_LINES_LEFT: /* 33 */ + case INSN_XIO_LINES_LEFT: /* 34 */ { long arg; BGET_I32(arg); - IoLINES_LEFT(bytecode_sv) = arg; + IoLINES_LEFT(bstate->bs_sv) = arg; break; } - case INSN_XIO_TOP_NAME: /* 34 */ + case INSN_XIO_TOP_NAME: /* 36 */ { pvcontents arg; BGET_pvcontents(arg); - IoTOP_NAME(bytecode_sv) = arg; + IoTOP_NAME(bstate->bs_sv) = arg; break; } - case INSN_XIO_TOP_GV: /* 36 */ + case INSN_XIO_TOP_GV: /* 37 */ { svindex arg; BGET_svindex(arg); - *(SV**)&IoTOP_GV(bytecode_sv) = arg; + *(SV**)&IoTOP_GV(bstate->bs_sv) = arg; break; } - case INSN_XIO_FMT_NAME: /* 37 */ + case INSN_XIO_FMT_NAME: /* 38 */ { pvcontents arg; BGET_pvcontents(arg); - IoFMT_NAME(bytecode_sv) = arg; + IoFMT_NAME(bstate->bs_sv) = arg; break; } - case INSN_XIO_FMT_GV: /* 38 */ + case INSN_XIO_FMT_GV: /* 39 */ { svindex arg; BGET_svindex(arg); - *(SV**)&IoFMT_GV(bytecode_sv) = arg; + *(SV**)&IoFMT_GV(bstate->bs_sv) = arg; break; } - case INSN_XIO_BOTTOM_NAME: /* 39 */ + case INSN_XIO_BOTTOM_NAME: /* 40 */ { pvcontents arg; BGET_pvcontents(arg); - IoBOTTOM_NAME(bytecode_sv) = arg; + IoBOTTOM_NAME(bstate->bs_sv) = arg; break; } - case INSN_XIO_BOTTOM_GV: /* 40 */ + case INSN_XIO_BOTTOM_GV: /* 41 */ { svindex arg; BGET_svindex(arg); - *(SV**)&IoBOTTOM_GV(bytecode_sv) = arg; + *(SV**)&IoBOTTOM_GV(bstate->bs_sv) = arg; break; } - case INSN_XIO_SUBPROCESS: /* 41 */ + case INSN_XIO_SUBPROCESS: /* 42 */ { short arg; BGET_U16(arg); - IoSUBPROCESS(bytecode_sv) = arg; + IoSUBPROCESS(bstate->bs_sv) = arg; break; } - case INSN_XIO_TYPE: /* 42 */ + case INSN_XIO_TYPE: /* 43 */ { char arg; BGET_U8(arg); - IoTYPE(bytecode_sv) = arg; + IoTYPE(bstate->bs_sv) = arg; break; } - case INSN_XIO_FLAGS: /* 43 */ + case INSN_XIO_FLAGS: /* 44 */ { char arg; BGET_U8(arg); - IoFLAGS(bytecode_sv) = arg; + IoFLAGS(bstate->bs_sv) = arg; break; } - case INSN_XCV_STASH: /* 44 */ + case INSN_XCV_STASH: /* 45 */ { svindex arg; BGET_svindex(arg); - *(SV**)&CvSTASH(bytecode_sv) = arg; + *(SV**)&CvSTASH(bstate->bs_sv) = arg; break; } - case INSN_XCV_START: /* 45 */ + case INSN_XCV_START: /* 46 */ { opindex arg; BGET_opindex(arg); - CvSTART(bytecode_sv) = arg; + CvSTART(bstate->bs_sv) = arg; break; } - case INSN_XCV_ROOT: /* 46 */ + case INSN_XCV_ROOT: /* 47 */ { opindex arg; BGET_opindex(arg); - CvROOT(bytecode_sv) = arg; + CvROOT(bstate->bs_sv) = arg; break; } - case INSN_XCV_GV: /* 47 */ + case INSN_XCV_GV: /* 48 */ { svindex arg; BGET_svindex(arg); - *(SV**)&CvGV(bytecode_sv) = arg; + *(SV**)&CvGV(bstate->bs_sv) = arg; break; } - case INSN_XCV_FILE: /* 48 */ + case INSN_XCV_FILE: /* 49 */ { - pvcontents arg; - BGET_pvcontents(arg); - CvFILE(bytecode_sv) = arg; + pvindex arg; + BGET_pvindex(arg); + CvFILE(bstate->bs_sv) = arg; break; } - case INSN_XCV_DEPTH: /* 49 */ + case INSN_XCV_DEPTH: /* 50 */ { long arg; BGET_I32(arg); - CvDEPTH(bytecode_sv) = arg; + CvDEPTH(bstate->bs_sv) = arg; break; } - case INSN_XCV_PADLIST: /* 50 */ + case INSN_XCV_PADLIST: /* 51 */ { svindex arg; BGET_svindex(arg); - *(SV**)&CvPADLIST(bytecode_sv) = arg; + *(SV**)&CvPADLIST(bstate->bs_sv) = arg; break; } - case INSN_XCV_OUTSIDE: /* 51 */ + case INSN_XCV_OUTSIDE: /* 52 */ { svindex arg; BGET_svindex(arg); - *(SV**)&CvOUTSIDE(bytecode_sv) = arg; + *(SV**)&CvOUTSIDE(bstate->bs_sv) = arg; break; } - case INSN_XCV_FLAGS: /* 52 */ + case INSN_XCV_FLAGS: /* 53 */ { U16 arg; BGET_U16(arg); - CvFLAGS(bytecode_sv) = arg; + CvFLAGS(bstate->bs_sv) = arg; break; } - case INSN_AV_EXTEND: /* 53 */ + case INSN_AV_EXTEND: /* 54 */ { SSize_t arg; BGET_I32(arg); - BSET_av_extend(bytecode_sv, arg); + BSET_av_extend(bstate->bs_sv, arg); break; } - case INSN_AV_PUSH: /* 54 */ + case INSN_AV_PUSH: /* 55 */ { svindex arg; BGET_svindex(arg); - BSET_av_push(bytecode_sv, arg); + BSET_av_push(bstate->bs_sv, arg); break; } - case INSN_XAV_FILL: /* 55 */ + case INSN_XAV_FILL: /* 56 */ { SSize_t arg; BGET_I32(arg); - AvFILLp(bytecode_sv) = arg; + AvFILLp(bstate->bs_sv) = arg; break; } - case INSN_XAV_MAX: /* 56 */ + case INSN_XAV_MAX: /* 57 */ { SSize_t arg; BGET_I32(arg); - AvMAX(bytecode_sv) = arg; + AvMAX(bstate->bs_sv) = arg; break; } - case INSN_XAV_FLAGS: /* 57 */ + case INSN_XAV_FLAGS: /* 58 */ { U8 arg; BGET_U8(arg); - AvFLAGS(bytecode_sv) = arg; + AvFLAGS(bstate->bs_sv) = arg; break; } - case INSN_XHV_RITER: /* 58 */ + case INSN_XHV_RITER: /* 59 */ { I32 arg; BGET_I32(arg); - HvRITER(bytecode_sv) = arg; + HvRITER(bstate->bs_sv) = arg; break; } - case INSN_XHV_NAME: /* 59 */ + case INSN_XHV_NAME: /* 60 */ { pvcontents arg; BGET_pvcontents(arg); - HvNAME(bytecode_sv) = arg; + HvNAME(bstate->bs_sv) = arg; break; } - case INSN_HV_STORE: /* 60 */ + case INSN_HV_STORE: /* 61 */ { svindex arg; BGET_svindex(arg); - BSET_hv_store(bytecode_sv, arg); + BSET_hv_store(bstate->bs_sv, arg); break; } - case INSN_SV_MAGIC: /* 61 */ + case INSN_SV_MAGIC: /* 62 */ { char arg; BGET_U8(arg); - BSET_sv_magic(bytecode_sv, arg); + BSET_sv_magic(bstate->bs_sv, arg); break; } - case INSN_MG_OBJ: /* 62 */ + case INSN_MG_OBJ: /* 63 */ { svindex arg; BGET_svindex(arg); - SvMAGIC(bytecode_sv)->mg_obj = arg; + SvMAGIC(bstate->bs_sv)->mg_obj = arg; break; } - case INSN_MG_PRIVATE: /* 63 */ + case INSN_MG_PRIVATE: /* 64 */ { U16 arg; BGET_U16(arg); - SvMAGIC(bytecode_sv)->mg_private = arg; + SvMAGIC(bstate->bs_sv)->mg_private = arg; break; } - case INSN_MG_FLAGS: /* 64 */ + case INSN_MG_FLAGS: /* 65 */ { U8 arg; BGET_U8(arg); - SvMAGIC(bytecode_sv)->mg_flags = arg; + SvMAGIC(bstate->bs_sv)->mg_flags = arg; break; } - case INSN_MG_PV: /* 65 */ + case INSN_MG_PV: /* 66 */ { pvcontents arg; BGET_pvcontents(arg); - BSET_mg_pv(SvMAGIC(bytecode_sv), arg); + BSET_mg_pv(SvMAGIC(bstate->bs_sv), arg); break; } - case INSN_XMG_STASH: /* 66 */ + case INSN_XMG_STASH: /* 67 */ { svindex arg; BGET_svindex(arg); - *(SV**)&SvSTASH(bytecode_sv) = arg; + *(SV**)&SvSTASH(bstate->bs_sv) = arg; break; } - case INSN_GV_FETCHPV: /* 67 */ + case INSN_GV_FETCHPV: /* 68 */ { strconst arg; BGET_strconst(arg); - BSET_gv_fetchpv(bytecode_sv, arg); + BSET_gv_fetchpv(bstate->bs_sv, arg); break; } - case INSN_GV_STASHPV: /* 68 */ + case INSN_GV_STASHPV: /* 69 */ { strconst arg; BGET_strconst(arg); - BSET_gv_stashpv(bytecode_sv, arg); + BSET_gv_stashpv(bstate->bs_sv, arg); break; } - case INSN_GP_SV: /* 69 */ + case INSN_GP_SV: /* 70 */ { svindex arg; BGET_svindex(arg); - GvSV(bytecode_sv) = arg; + GvSV(bstate->bs_sv) = arg; break; } - case INSN_GP_REFCNT: /* 70 */ + case INSN_GP_REFCNT: /* 71 */ { U32 arg; BGET_U32(arg); - GvREFCNT(bytecode_sv) = arg; + GvREFCNT(bstate->bs_sv) = arg; break; } - case INSN_GP_REFCNT_ADD: /* 71 */ + case INSN_GP_REFCNT_ADD: /* 72 */ { I32 arg; BGET_I32(arg); - BSET_gp_refcnt_add(GvREFCNT(bytecode_sv), arg); + BSET_gp_refcnt_add(GvREFCNT(bstate->bs_sv), arg); break; } - case INSN_GP_AV: /* 72 */ + case INSN_GP_AV: /* 73 */ { svindex arg; BGET_svindex(arg); - *(SV**)&GvAV(bytecode_sv) = arg; + *(SV**)&GvAV(bstate->bs_sv) = arg; break; } - case INSN_GP_HV: /* 73 */ + case INSN_GP_HV: /* 74 */ { svindex arg; BGET_svindex(arg); - *(SV**)&GvHV(bytecode_sv) = arg; + *(SV**)&GvHV(bstate->bs_sv) = arg; break; } - case INSN_GP_CV: /* 74 */ + case INSN_GP_CV: /* 75 */ { svindex arg; BGET_svindex(arg); - *(SV**)&GvCV(bytecode_sv) = arg; + *(SV**)&GvCV(bstate->bs_sv) = arg; break; } - case INSN_GP_FILE: /* 75 */ + case INSN_GP_FILE: /* 76 */ { - pvcontents arg; - BGET_pvcontents(arg); - GvFILE(bytecode_sv) = arg; + pvindex arg; + BGET_pvindex(arg); + GvFILE(bstate->bs_sv) = arg; break; } - case INSN_GP_IO: /* 76 */ + case INSN_GP_IO: /* 77 */ { svindex arg; BGET_svindex(arg); - *(SV**)&GvIOp(bytecode_sv) = arg; + *(SV**)&GvIOp(bstate->bs_sv) = arg; break; } - case INSN_GP_FORM: /* 77 */ + case INSN_GP_FORM: /* 78 */ { svindex arg; BGET_svindex(arg); - *(SV**)&GvFORM(bytecode_sv) = arg; + *(SV**)&GvFORM(bstate->bs_sv) = arg; break; } - case INSN_GP_CVGEN: /* 78 */ + case INSN_GP_CVGEN: /* 79 */ { U32 arg; BGET_U32(arg); - GvCVGEN(bytecode_sv) = arg; + GvCVGEN(bstate->bs_sv) = arg; break; } - case INSN_GP_LINE: /* 79 */ + case INSN_GP_LINE: /* 80 */ { line_t arg; BGET_U16(arg); - GvLINE(bytecode_sv) = arg; + GvLINE(bstate->bs_sv) = arg; break; } - case INSN_GP_SHARE: /* 80 */ + case INSN_GP_SHARE: /* 81 */ { svindex arg; BGET_svindex(arg); - BSET_gp_share(bytecode_sv, arg); + BSET_gp_share(bstate->bs_sv, arg); break; } - case INSN_XGV_FLAGS: /* 81 */ + case INSN_XGV_FLAGS: /* 82 */ { U8 arg; BGET_U8(arg); - GvFLAGS(bytecode_sv) = arg; + GvFLAGS(bstate->bs_sv) = arg; break; } - case INSN_OP_NEXT: /* 82 */ + case INSN_OP_NEXT: /* 83 */ { opindex arg; BGET_opindex(arg); PL_op->op_next = arg; break; } - case INSN_OP_SIBLING: /* 83 */ + case INSN_OP_SIBLING: /* 84 */ { opindex arg; BGET_opindex(arg); PL_op->op_sibling = arg; break; } - case INSN_OP_PPADDR: /* 84 */ + case INSN_OP_PPADDR: /* 85 */ { strconst arg; BGET_strconst(arg); BSET_op_ppaddr(PL_op->op_ppaddr, arg); break; } - case INSN_OP_TARG: /* 85 */ + case INSN_OP_TARG: /* 86 */ { PADOFFSET arg; BGET_U32(arg); PL_op->op_targ = arg; break; } - case INSN_OP_TYPE: /* 86 */ + case INSN_OP_TYPE: /* 87 */ { OPCODE arg; BGET_U16(arg); BSET_op_type(PL_op, arg); break; } - case INSN_OP_SEQ: /* 87 */ + case INSN_OP_SEQ: /* 88 */ { U16 arg; BGET_U16(arg); PL_op->op_seq = arg; break; } - case INSN_OP_FLAGS: /* 88 */ + case INSN_OP_FLAGS: /* 89 */ { U8 arg; BGET_U8(arg); PL_op->op_flags = arg; break; } - case INSN_OP_PRIVATE: /* 89 */ + case INSN_OP_PRIVATE: /* 90 */ { U8 arg; BGET_U8(arg); PL_op->op_private = arg; break; } - case INSN_OP_FIRST: /* 90 */ + case INSN_OP_FIRST: /* 91 */ { opindex arg; BGET_opindex(arg); cUNOP->op_first = arg; break; } - case INSN_OP_LAST: /* 91 */ + case INSN_OP_LAST: /* 92 */ { opindex arg; BGET_opindex(arg); cBINOP->op_last = arg; break; } - case INSN_OP_OTHER: /* 92 */ + case INSN_OP_OTHER: /* 93 */ { opindex arg; BGET_opindex(arg); cLOGOP->op_other = arg; break; } - case INSN_OP_CHILDREN: /* 93 */ + case INSN_OP_CHILDREN: /* 94 */ { U32 arg; BGET_U32(arg); cLISTOP->op_children = arg; break; } - case INSN_OP_PMREPLROOT: /* 94 */ + case INSN_OP_PMREPLROOT: /* 95 */ { opindex arg; BGET_opindex(arg); cPMOP->op_pmreplroot = arg; break; } - case INSN_OP_PMREPLROOTGV: /* 95 */ + case INSN_OP_PMREPLROOTGV: /* 96 */ { svindex arg; BGET_svindex(arg); *(SV**)&cPMOP->op_pmreplroot = arg; break; } - case INSN_OP_PMREPLSTART: /* 96 */ + case INSN_OP_PMREPLSTART: /* 97 */ { opindex arg; BGET_opindex(arg); cPMOP->op_pmreplstart = arg; break; } - case INSN_OP_PMNEXT: /* 97 */ + case INSN_OP_PMNEXT: /* 98 */ { opindex arg; BGET_opindex(arg); *(OP**)&cPMOP->op_pmnext = arg; break; } - case INSN_PREGCOMP: /* 98 */ + case INSN_PREGCOMP: /* 99 */ { pvcontents arg; BGET_pvcontents(arg); BSET_pregcomp(PL_op, arg); break; } - case INSN_OP_PMFLAGS: /* 99 */ + case INSN_OP_PMFLAGS: /* 100 */ { U16 arg; BGET_U16(arg); cPMOP->op_pmflags = arg; break; } - case INSN_OP_PMPERMFLAGS: /* 100 */ + case INSN_OP_PMPERMFLAGS: /* 101 */ { U16 arg; BGET_U16(arg); cPMOP->op_pmpermflags = arg; break; } - case INSN_OP_SV: /* 101 */ + case INSN_OP_SV: /* 102 */ { svindex arg; BGET_svindex(arg); cSVOP->op_sv = arg; break; } - case INSN_OP_PADIX: /* 102 */ + case INSN_OP_PADIX: /* 103 */ { PADOFFSET arg; BGET_U32(arg); cPADOP->op_padix = arg; break; } - case INSN_OP_PV: /* 103 */ + case INSN_OP_PV: /* 104 */ { pvcontents arg; BGET_pvcontents(arg); cPVOP->op_pv = arg; break; } - case INSN_OP_PV_TR: /* 104 */ + case INSN_OP_PV_TR: /* 105 */ { op_tr_array arg; BGET_op_tr_array(arg); cPVOP->op_pv = arg; break; } - case INSN_OP_REDOOP: /* 105 */ + case INSN_OP_REDOOP: /* 106 */ { opindex arg; BGET_opindex(arg); cLOOP->op_redoop = arg; break; } - case INSN_OP_NEXTOP: /* 106 */ + case INSN_OP_NEXTOP: /* 107 */ { opindex arg; BGET_opindex(arg); cLOOP->op_nextop = arg; break; } - case INSN_OP_LASTOP: /* 107 */ + case INSN_OP_LASTOP: /* 108 */ { opindex arg; BGET_opindex(arg); cLOOP->op_lastop = arg; break; } - case INSN_COP_LABEL: /* 108 */ + case INSN_COP_LABEL: /* 109 */ { - pvcontents arg; - BGET_pvcontents(arg); + pvindex arg; + BGET_pvindex(arg); cCOP->cop_label = arg; break; } - case INSN_COP_STASHPV: /* 109 */ + case INSN_COP_STASHPV: /* 110 */ { - pvcontents arg; - BGET_pvcontents(arg); + pvindex arg; + BGET_pvindex(arg); BSET_cop_stashpv(cCOP, arg); break; } - case INSN_COP_FILE: /* 110 */ + case INSN_COP_FILE: /* 111 */ { - pvcontents arg; - BGET_pvcontents(arg); + pvindex arg; + BGET_pvindex(arg); BSET_cop_file(cCOP, arg); break; } - case INSN_COP_SEQ: /* 111 */ + case INSN_COP_SEQ: /* 112 */ { U32 arg; BGET_U32(arg); cCOP->cop_seq = arg; break; } - case INSN_COP_ARYBASE: /* 112 */ + case INSN_COP_ARYBASE: /* 113 */ { I32 arg; BGET_I32(arg); cCOP->cop_arybase = arg; break; } - case INSN_COP_LINE: /* 113 */ + case INSN_COP_LINE: /* 114 */ { line_t arg; BGET_U16(arg); BSET_cop_line(cCOP, arg); break; } - case INSN_COP_WARNINGS: /* 114 */ + case INSN_COP_WARNINGS: /* 115 */ { svindex arg; BGET_svindex(arg); cCOP->cop_warnings = arg; break; } - case INSN_MAIN_START: /* 115 */ + case INSN_MAIN_START: /* 116 */ { opindex arg; BGET_opindex(arg); PL_main_start = arg; break; } - case INSN_MAIN_ROOT: /* 116 */ + case INSN_MAIN_ROOT: /* 117 */ { opindex arg; BGET_opindex(arg); PL_main_root = arg; break; } - case INSN_CURPAD: /* 117 */ + case INSN_CURPAD: /* 118 */ { svindex arg; BGET_svindex(arg); BSET_curpad(PL_curpad, arg); break; } + case INSN_PUSH_BEGIN: /* 119 */ + { + svindex arg; + BGET_svindex(arg); + BSET_push_begin(PL_beginav, arg); + break; + } + case INSN_PUSH_INIT: /* 120 */ + { + svindex arg; + BGET_svindex(arg); + BSET_push_init(PL_initav, arg); + break; + } + case INSN_PUSH_END: /* 121 */ + { + svindex arg; + BGET_svindex(arg); + BSET_push_end(PL_endav, arg); + break; + } default: Perl_croak(aTHX_ "Illegal bytecode instruction %d\n", insn); /* NOTREACHED */ diff --git a/ext/ByteLoader/byterun.h b/ext/ByteLoader/byterun.h index f0de6b4820..1e67b8967e 100644 --- a/ext/ByteLoader/byterun.h +++ b/ext/ByteLoader/byterun.h @@ -8,133 +8,149 @@ /* * This file is autogenerated from bytecode.pl. Changes made here will be lost. */ -struct bytestream { - void *data; - int (*pfgetc)(void *); - int (*pfread)(char *, size_t, size_t, void *); - void (*pfreadpv)(U32, void *, XPV *); +struct byteloader_fdata { + SV *datasv; + int next_out; + int idx; }; +struct byteloader_state { + struct byteloader_fdata *bs_fdata; + SV *bs_sv; + void **bs_obj_list; + int bs_obj_list_fill; + XPV bs_pv; + int bs_iv_overflows; +}; + +int bl_getc(struct byteloader_fdata *); +int bl_read(struct byteloader_fdata *, char *, size_t, size_t); +extern void byterun(pTHXo_ struct byteloader_state *); + enum { INSN_RET, /* 0 */ INSN_LDSV, /* 1 */ INSN_LDOP, /* 2 */ INSN_STSV, /* 3 */ INSN_STOP, /* 4 */ - INSN_LDSPECSV, /* 5 */ - INSN_NEWSV, /* 6 */ - INSN_NEWOP, /* 7 */ - INSN_NEWOPN, /* 8 */ - INSN_NEWPV, /* 9 */ + INSN_STPV, /* 5 */ + INSN_LDSPECSV, /* 6 */ + INSN_NEWSV, /* 7 */ + INSN_NEWOP, /* 8 */ + INSN_NEWOPN, /* 9 */ INSN_NOP, /* 10 */ - INSN_PV_CUR, /* 11 */ - INSN_PV_FREE, /* 12 */ - INSN_SV_UPGRADE, /* 13 */ - INSN_SV_REFCNT, /* 14 */ - INSN_SV_REFCNT_ADD, /* 15 */ - INSN_SV_FLAGS, /* 16 */ - INSN_XRV, /* 17 */ - INSN_XPV, /* 18 */ - INSN_XIV32, /* 19 */ - INSN_XIV64, /* 20 */ - INSN_XNV, /* 21 */ - INSN_XLV_TARGOFF, /* 22 */ - INSN_XLV_TARGLEN, /* 23 */ - INSN_XLV_TARG, /* 24 */ - INSN_XLV_TYPE, /* 25 */ - INSN_XBM_USEFUL, /* 26 */ - INSN_XBM_PREVIOUS, /* 27 */ - INSN_XBM_RARE, /* 28 */ - INSN_XFM_LINES, /* 29 */ - INSN_XIO_LINES, /* 30 */ - INSN_XIO_PAGE, /* 31 */ - INSN_XIO_PAGE_LEN, /* 32 */ - INSN_XIO_LINES_LEFT, /* 33 */ - INSN_XIO_TOP_NAME, /* 34 */ + INSN_NEWPV, /* 11 */ + INSN_PV_CUR, /* 12 */ + INSN_PV_FREE, /* 13 */ + INSN_SV_UPGRADE, /* 14 */ + INSN_SV_REFCNT, /* 15 */ + INSN_SV_REFCNT_ADD, /* 16 */ + INSN_SV_FLAGS, /* 17 */ + INSN_XRV, /* 18 */ + INSN_XPV, /* 19 */ + INSN_XIV32, /* 20 */ + INSN_XIV64, /* 21 */ + INSN_XNV, /* 22 */ + INSN_XLV_TARGOFF, /* 23 */ + INSN_XLV_TARGLEN, /* 24 */ + INSN_XLV_TARG, /* 25 */ + INSN_XLV_TYPE, /* 26 */ + INSN_XBM_USEFUL, /* 27 */ + INSN_XBM_PREVIOUS, /* 28 */ + INSN_XBM_RARE, /* 29 */ + INSN_XFM_LINES, /* 30 */ + INSN_XIO_LINES, /* 31 */ + INSN_XIO_PAGE, /* 32 */ + INSN_XIO_PAGE_LEN, /* 33 */ + INSN_XIO_LINES_LEFT, /* 34 */ INSN_COMMENT, /* 35 */ - INSN_XIO_TOP_GV, /* 36 */ - INSN_XIO_FMT_NAME, /* 37 */ - INSN_XIO_FMT_GV, /* 38 */ - INSN_XIO_BOTTOM_NAME, /* 39 */ - INSN_XIO_BOTTOM_GV, /* 40 */ - INSN_XIO_SUBPROCESS, /* 41 */ - INSN_XIO_TYPE, /* 42 */ - INSN_XIO_FLAGS, /* 43 */ - INSN_XCV_STASH, /* 44 */ - INSN_XCV_START, /* 45 */ - INSN_XCV_ROOT, /* 46 */ - INSN_XCV_GV, /* 47 */ - INSN_XCV_FILE, /* 48 */ - INSN_XCV_DEPTH, /* 49 */ - INSN_XCV_PADLIST, /* 50 */ - INSN_XCV_OUTSIDE, /* 51 */ - INSN_XCV_FLAGS, /* 52 */ - INSN_AV_EXTEND, /* 53 */ - INSN_AV_PUSH, /* 54 */ - INSN_XAV_FILL, /* 55 */ - INSN_XAV_MAX, /* 56 */ - INSN_XAV_FLAGS, /* 57 */ - INSN_XHV_RITER, /* 58 */ - INSN_XHV_NAME, /* 59 */ - INSN_HV_STORE, /* 60 */ - INSN_SV_MAGIC, /* 61 */ - INSN_MG_OBJ, /* 62 */ - INSN_MG_PRIVATE, /* 63 */ - INSN_MG_FLAGS, /* 64 */ - INSN_MG_PV, /* 65 */ - INSN_XMG_STASH, /* 66 */ - INSN_GV_FETCHPV, /* 67 */ - INSN_GV_STASHPV, /* 68 */ - INSN_GP_SV, /* 69 */ - INSN_GP_REFCNT, /* 70 */ - INSN_GP_REFCNT_ADD, /* 71 */ - INSN_GP_AV, /* 72 */ - INSN_GP_HV, /* 73 */ - INSN_GP_CV, /* 74 */ - INSN_GP_FILE, /* 75 */ - INSN_GP_IO, /* 76 */ - INSN_GP_FORM, /* 77 */ - INSN_GP_CVGEN, /* 78 */ - INSN_GP_LINE, /* 79 */ - INSN_GP_SHARE, /* 80 */ - INSN_XGV_FLAGS, /* 81 */ - INSN_OP_NEXT, /* 82 */ - INSN_OP_SIBLING, /* 83 */ - INSN_OP_PPADDR, /* 84 */ - INSN_OP_TARG, /* 85 */ - INSN_OP_TYPE, /* 86 */ - INSN_OP_SEQ, /* 87 */ - INSN_OP_FLAGS, /* 88 */ - INSN_OP_PRIVATE, /* 89 */ - INSN_OP_FIRST, /* 90 */ - INSN_OP_LAST, /* 91 */ - INSN_OP_OTHER, /* 92 */ - INSN_OP_CHILDREN, /* 93 */ - INSN_OP_PMREPLROOT, /* 94 */ - INSN_OP_PMREPLROOTGV, /* 95 */ - INSN_OP_PMREPLSTART, /* 96 */ - INSN_OP_PMNEXT, /* 97 */ - INSN_PREGCOMP, /* 98 */ - INSN_OP_PMFLAGS, /* 99 */ - INSN_OP_PMPERMFLAGS, /* 100 */ - INSN_OP_SV, /* 101 */ - INSN_OP_PADIX, /* 102 */ - INSN_OP_PV, /* 103 */ - INSN_OP_PV_TR, /* 104 */ - INSN_OP_REDOOP, /* 105 */ - INSN_OP_NEXTOP, /* 106 */ - INSN_OP_LASTOP, /* 107 */ - INSN_COP_LABEL, /* 108 */ - INSN_COP_STASHPV, /* 109 */ - INSN_COP_FILE, /* 110 */ - INSN_COP_SEQ, /* 111 */ - INSN_COP_ARYBASE, /* 112 */ - INSN_COP_LINE, /* 113 */ - INSN_COP_WARNINGS, /* 114 */ - INSN_MAIN_START, /* 115 */ - INSN_MAIN_ROOT, /* 116 */ - INSN_CURPAD, /* 117 */ - MAX_INSN = 117 + INSN_XIO_TOP_NAME, /* 36 */ + INSN_XIO_TOP_GV, /* 37 */ + INSN_XIO_FMT_NAME, /* 38 */ + INSN_XIO_FMT_GV, /* 39 */ + INSN_XIO_BOTTOM_NAME, /* 40 */ + INSN_XIO_BOTTOM_GV, /* 41 */ + INSN_XIO_SUBPROCESS, /* 42 */ + INSN_XIO_TYPE, /* 43 */ + INSN_XIO_FLAGS, /* 44 */ + INSN_XCV_STASH, /* 45 */ + INSN_XCV_START, /* 46 */ + INSN_XCV_ROOT, /* 47 */ + INSN_XCV_GV, /* 48 */ + INSN_XCV_FILE, /* 49 */ + INSN_XCV_DEPTH, /* 50 */ + INSN_XCV_PADLIST, /* 51 */ + INSN_XCV_OUTSIDE, /* 52 */ + INSN_XCV_FLAGS, /* 53 */ + INSN_AV_EXTEND, /* 54 */ + INSN_AV_PUSH, /* 55 */ + INSN_XAV_FILL, /* 56 */ + INSN_XAV_MAX, /* 57 */ + INSN_XAV_FLAGS, /* 58 */ + INSN_XHV_RITER, /* 59 */ + INSN_XHV_NAME, /* 60 */ + INSN_HV_STORE, /* 61 */ + INSN_SV_MAGIC, /* 62 */ + INSN_MG_OBJ, /* 63 */ + INSN_MG_PRIVATE, /* 64 */ + INSN_MG_FLAGS, /* 65 */ + INSN_MG_PV, /* 66 */ + INSN_XMG_STASH, /* 67 */ + INSN_GV_FETCHPV, /* 68 */ + INSN_GV_STASHPV, /* 69 */ + INSN_GP_SV, /* 70 */ + INSN_GP_REFCNT, /* 71 */ + INSN_GP_REFCNT_ADD, /* 72 */ + INSN_GP_AV, /* 73 */ + INSN_GP_HV, /* 74 */ + INSN_GP_CV, /* 75 */ + INSN_GP_FILE, /* 76 */ + INSN_GP_IO, /* 77 */ + INSN_GP_FORM, /* 78 */ + INSN_GP_CVGEN, /* 79 */ + INSN_GP_LINE, /* 80 */ + INSN_GP_SHARE, /* 81 */ + INSN_XGV_FLAGS, /* 82 */ + INSN_OP_NEXT, /* 83 */ + INSN_OP_SIBLING, /* 84 */ + INSN_OP_PPADDR, /* 85 */ + INSN_OP_TARG, /* 86 */ + INSN_OP_TYPE, /* 87 */ + INSN_OP_SEQ, /* 88 */ + INSN_OP_FLAGS, /* 89 */ + INSN_OP_PRIVATE, /* 90 */ + INSN_OP_FIRST, /* 91 */ + INSN_OP_LAST, /* 92 */ + INSN_OP_OTHER, /* 93 */ + INSN_OP_CHILDREN, /* 94 */ + INSN_OP_PMREPLROOT, /* 95 */ + INSN_OP_PMREPLROOTGV, /* 96 */ + INSN_OP_PMREPLSTART, /* 97 */ + INSN_OP_PMNEXT, /* 98 */ + INSN_PREGCOMP, /* 99 */ + INSN_OP_PMFLAGS, /* 100 */ + INSN_OP_PMPERMFLAGS, /* 101 */ + INSN_OP_SV, /* 102 */ + INSN_OP_PADIX, /* 103 */ + INSN_OP_PV, /* 104 */ + INSN_OP_PV_TR, /* 105 */ + INSN_OP_REDOOP, /* 106 */ + INSN_OP_NEXTOP, /* 107 */ + INSN_OP_LASTOP, /* 108 */ + INSN_COP_LABEL, /* 109 */ + INSN_COP_STASHPV, /* 110 */ + INSN_COP_FILE, /* 111 */ + INSN_COP_SEQ, /* 112 */ + INSN_COP_ARYBASE, /* 113 */ + INSN_COP_LINE, /* 114 */ + INSN_COP_WARNINGS, /* 115 */ + INSN_MAIN_START, /* 116 */ + INSN_MAIN_ROOT, /* 117 */ + INSN_CURPAD, /* 118 */ + INSN_PUSH_BEGIN, /* 119 */ + INSN_PUSH_INIT, /* 120 */ + INSN_PUSH_END, /* 121 */ + MAX_INSN = 121 }; enum { @@ -151,11 +167,3 @@ enum { OPt_COP /* 10 */ }; -extern void byterun(pTHXo_ struct bytestream bs); - -#define INIT_SPECIALSV_LIST STMT_START { \ - PL_specialsv_list[0] = Nullsv; \ - PL_specialsv_list[1] = &PL_sv_undef; \ - PL_specialsv_list[2] = &PL_sv_yes; \ - PL_specialsv_list[3] = &PL_sv_no; \ - } STMT_END |