diff options
author | Tom Hughes <tom@compton.nu> | 1999-05-27 00:59:49 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-05-28 17:13:23 +0000 |
commit | e8edd1e67bd80dbb476d68f78da80ae76c0eb341 (patch) | |
tree | 08109c36ed32868be933b6115d3e25e6c37ac6a9 /ext/ByteLoader | |
parent | 697943021785eb8447e25eb51a6f27fd78921863 (diff) | |
download | perl-e8edd1e67bd80dbb476d68f78da80ae76c0eb341.tar.gz |
ByteLoader mark 2
To: perl5-porters@perl.org
Message-ID: <bf337a0849.tom@compton.compton.nu>
plus resolve tiny conflict with #3479
plus regen_headers.
p4raw-id: //depot/cfgperl@3499
Diffstat (limited to 'ext/ByteLoader')
-rw-r--r-- | ext/ByteLoader/ByteLoader.pm | 6 | ||||
-rw-r--r-- | ext/ByteLoader/ByteLoader.xs | 28 | ||||
-rw-r--r-- | ext/ByteLoader/Makefile.PL | 12 | ||||
-rw-r--r-- | ext/ByteLoader/bytecode.h | 429 | ||||
-rw-r--r-- | ext/ByteLoader/byterun.c | 901 | ||||
-rw-r--r-- | ext/ByteLoader/byterun.h | 181 |
6 files changed, 1531 insertions, 26 deletions
diff --git a/ext/ByteLoader/ByteLoader.pm b/ext/ByteLoader/ByteLoader.pm index d11d9573c7..46870105d8 100644 --- a/ext/ByteLoader/ByteLoader.pm +++ b/ext/ByteLoader/ByteLoader.pm @@ -4,7 +4,7 @@ require DynaLoader; @ISA = qw(DynaLoader); -$VERSION = 0.01; +$VERSION = 0.03; bootstrap ByteLoader $VERSION; @@ -19,10 +19,10 @@ ByteLoader - load byte compiled perl code =head1 SYNOPSIS - use ByteLoader 0.01; + use ByteLoader 0.03; <byte code> - use ByteLoader 0.01; + use ByteLoader 0.03; <byte code> =head1 DESCRIPTION diff --git a/ext/ByteLoader/ByteLoader.xs b/ext/ByteLoader/ByteLoader.xs index 24c3ae8492..ae2e18cd89 100644 --- a/ext/ByteLoader/ByteLoader.xs +++ b/ext/ByteLoader/ByteLoader.xs @@ -1,17 +1,16 @@ #include "EXTERN.h" #include "perl.h" #include "XSUB.h" +#include "byterun.h" -#ifndef WIN32 -/* this is probably not needed manywhere */ -# include "byterun.c" -#endif - -/* defgv must be accessed differently under threaded perl */ -/* DEFSV et al are in 5.004_56 */ -#ifndef DEFSV -#define DEFSV GvSV(defgv) -#endif +static void +freadpv(U32 len, void *data, XPV *pv) +{ + New(666, pv->xpv_pv, len, char); + fread(pv->xpv_pv, 1, len, (FILE*)data); + pv->xpv_len = len; + pv->xpv_cur = len - 1; +} static I32 #ifdef PERL_OBJECT @@ -23,17 +22,14 @@ byteloader_filter(int idx, SV *buf_sv, int maxlen) dTHR; OP *saveroot = PL_main_root; OP *savestart = PL_main_start; - -#ifdef INDIRECT_BGET_MACROS - struct bytesream bs; + struct bytestream bs; bs.data = PL_rsfp; bs.fgetc = (int(*) _((void*)))fgetc; bs.fread = (int(*) _((char*,size_t,size_t,void*)))fread; bs.freadpv = freadpv; -#else - byterun(PL_rsfp); -#endif + + byterun(bs); if (PL_in_eval) { OP *o; diff --git a/ext/ByteLoader/Makefile.PL b/ext/ByteLoader/Makefile.PL index 4aabe79683..1facb5a068 100644 --- a/ext/ByteLoader/Makefile.PL +++ b/ext/ByteLoader/Makefile.PL @@ -1,10 +1,8 @@ use ExtUtils::MakeMaker; -# See lib/ExtUtils/MakeMaker.pm for details of how to influence -# the contents of the Makefile that is written. + WriteMakefile( - 'NAME' => 'ByteLoader', - 'VERSION_FROM' => 'ByteLoader.pm', # finds $VERSION - 'LIBS' => [''], # e.g., '-lm' - 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING' - 'INC' => '-I$(PERL_SRC)', # e.g., '-I/usr/include/other' + NAME => 'ByteLoader', + VERSION_FROM => 'ByteLoader.pm', + XSPROTOARG => '-noprototypes', + OBJECT => 'byterun$(OBJ_EXT) ByteLoader$(OBJ_EXT)', ); diff --git a/ext/ByteLoader/bytecode.h b/ext/ByteLoader/bytecode.h new file mode 100644 index 0000000000..442ea5b5e1 --- /dev/null +++ b/ext/ByteLoader/bytecode.h @@ -0,0 +1,429 @@ +typedef char *pvcontents; +typedef char *strconst; +typedef U32 PV; +typedef char *op_tr_array; +typedef int comment_t; +typedef SV *svindex; +typedef OP *opindex; +typedef IV IV64; + +#define BGET_FREAD(argp, len, nelem) \ + bs.fread((char*)(argp),(len),(nelem),bs.data) +#define BGET_FGETC() bs.fgetc(bs.data) + +#define BGET_U32(arg) \ + BGET_FREAD(&arg, sizeof(U32), 1); arg = PerlSock_ntohl((U32)arg) +#define BGET_I32(arg) \ + BGET_FREAD(&arg, sizeof(I32), 1); arg = (I32)PerlSock_ntohl((U32)arg) +#define BGET_U16(arg) \ + BGET_FREAD(&arg, sizeof(U16), 1); arg = PerlSock_ntohs((U16)arg) +#define BGET_U8(arg) arg = BGET_FGETC() + +#define BGET_PV(arg) STMT_START { \ + BGET_U32(arg); \ + if (arg) \ + bs.freadpv(arg, bs.data, &bytecode_pv); \ + else { \ + bytecode_pv.xpv_pv = 0; \ + bytecode_pv.xpv_len = 0; \ + bytecode_pv.xpv_cur = 0; \ + } \ + } STMT_END + +#define BGET_comment_t(arg) \ + do { arg = BGET_FGETC(); } while (arg != '\n' && arg != EOF) + +/* + * In the following, sizeof(IV)*4 is just a way of encoding 32 on 64-bit-IV + * machines such that 32-bit machine compilers don't whine about the shift + * count being too high even though the code is never reached there. + */ +#define BGET_IV64(arg) STMT_START { \ + U32 hi, lo; \ + BGET_U32(hi); \ + BGET_U32(lo); \ + if (sizeof(IV) == 8) \ + arg = (IV) (hi << (sizeof(IV)*4) | lo); \ + else if (((I32)hi == -1 && (I32)lo < 0) \ + || ((I32)hi == 0 && (I32)lo >= 0)) { \ + arg = (I32)lo; \ + } \ + else { \ + bytecode_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; \ + } while (0) + +#define BGET_pvcontents(arg) arg = bytecode_pv.xpv_pv +#define BGET_strconst(arg) STMT_START { \ + for (arg = PL_tokenbuf; (*arg = BGET_FGETC()); arg++) /* nothing */; \ + arg = PL_tokenbuf; \ + } STMT_END + +#define BGET_double(arg) STMT_START { \ + char *str; \ + BGET_strconst(str); \ + arg = atof(str); \ + } STMT_END + +#define BGET_objindex(arg, type) STMT_START { \ + U32 ix; \ + BGET_U32(ix); \ + arg = (type)bytecode_obj_list[ix]; \ + } STMT_END +#define BGET_svindex(arg) BGET_objindex(arg, svindex) +#define BGET_opindex(arg) BGET_objindex(arg, opindex) + +#define BSET_ldspecsv(sv, arg) sv = specialsv_list[arg] + +#define BSET_sv_refcnt_add(svrefcnt, arg) svrefcnt += arg +#define BSET_gp_refcnt_add(gprefcnt, arg) gprefcnt += arg +#define BSET_gp_share(sv, arg) STMT_START { \ + gp_free((GV*)sv); \ + GvGP(sv) = GvGP(arg); \ + } STMT_END + +#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_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); \ + } 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) +#define BSET_pv_free(pv) Safefree(pv.xpv_pv) +#define BSET_pregcomp(o, arg) \ + ((PMOP*)o)->op_pmregexp = arg ? \ + CALLREGCOMP(arg, arg + bytecode_pv.xpv_cur, ((PMOP*)o)) : 0 +#define BSET_newsv(sv, arg) sv = NEWSV(666,0); SvUPGRADE(sv, arg) +#define BSET_newop(o, arg) o = (OP*)safemalloc(optype_size[arg]) +#define BSET_newopn(o, arg) STMT_START { \ + OP *oldop = o; \ + BSET_newop(o, arg); \ + oldop->op_next = o; \ + } STMT_END + +#define BSET_ret(foo) return + +/* + * Kludge special-case workaround for OP_MAPSTART + * which needs the ppaddr for OP_GREPSTART. Blech. + */ +#define BSET_op_type(o, arg) STMT_START { \ + o->op_type = arg; \ + if (arg == OP_MAPSTART) \ + arg = OP_GREPSTART; \ + o->op_ppaddr = PL_ppaddr[arg]; \ + } STMT_END +#define BSET_op_ppaddr(o, arg) croak("op_ppaddr not yet implemented") +#define BSET_curpad(pad, arg) STMT_START { \ + PL_comppad = (AV *)arg; \ + pad = AvARRAY(arg); \ + } STMT_END + +#define BSET_OBJ_STORE(obj, ix) \ + (I32)ix > bytecode_obj_list_fill ? \ + bset_obj_store(obj, (I32)ix) : (bytecode_obj_list[ix] = obj) +typedef char *pvcontents; +typedef char *strconst; +typedef U32 PV; +typedef char *op_tr_array; +typedef int comment_t; +typedef SV *svindex; +typedef OP *opindex; +typedef IV IV64; + +#define BGET_FREAD(argp, len, nelem) \ + bs.fread((char*)(argp),(len),(nelem),bs.data) +#define BGET_FGETC() bs.fgetc(bs.data) + +#define BGET_U32(arg) \ + BGET_FREAD(&arg, sizeof(U32), 1); arg = PerlSock_ntohl((U32)arg) +#define BGET_I32(arg) \ + BGET_FREAD(&arg, sizeof(I32), 1); arg = (I32)PerlSock_ntohl((U32)arg) +#define BGET_U16(arg) \ + BGET_FREAD(&arg, sizeof(U16), 1); arg = PerlSock_ntohs((U16)arg) +#define BGET_U8(arg) arg = BGET_FGETC() + +#define BGET_PV(arg) STMT_START { \ + BGET_U32(arg); \ + if (arg) \ + bs.freadpv(arg, bs.data, &bytecode_pv); \ + else { \ + bytecode_pv.xpv_pv = 0; \ + bytecode_pv.xpv_len = 0; \ + bytecode_pv.xpv_cur = 0; \ + } \ + } STMT_END + +#define BGET_comment_t(arg) \ + do { arg = BGET_FGETC(); } while (arg != '\n' && arg != EOF) + +/* + * In the following, sizeof(IV)*4 is just a way of encoding 32 on 64-bit-IV + * machines such that 32-bit machine compilers don't whine about the shift + * count being too high even though the code is never reached there. + */ +#define BGET_IV64(arg) STMT_START { \ + U32 hi, lo; \ + BGET_U32(hi); \ + BGET_U32(lo); \ + if (sizeof(IV) == 8) \ + arg = (IV) (hi << (sizeof(IV)*4) | lo); \ + else if (((I32)hi == -1 && (I32)lo < 0) \ + || ((I32)hi == 0 && (I32)lo >= 0)) { \ + arg = (I32)lo; \ + } \ + else { \ + bytecode_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; \ + } while (0) + +#define BGET_pvcontents(arg) arg = bytecode_pv.xpv_pv +#define BGET_strconst(arg) STMT_START { \ + for (arg = PL_tokenbuf; (*arg = BGET_FGETC()); arg++) /* nothing */; \ + arg = PL_tokenbuf; \ + } STMT_END + +#define BGET_double(arg) STMT_START { \ + char *str; \ + BGET_strconst(str); \ + arg = atof(str); \ + } STMT_END + +#define BGET_objindex(arg, type) STMT_START { \ + U32 ix; \ + BGET_U32(ix); \ + arg = (type)bytecode_obj_list[ix]; \ + } STMT_END +#define BGET_svindex(arg) BGET_objindex(arg, svindex) +#define BGET_opindex(arg) BGET_objindex(arg, opindex) + +#define BSET_ldspecsv(sv, arg) sv = specialsv_list[arg] + +#define BSET_sv_refcnt_add(svrefcnt, arg) svrefcnt += arg +#define BSET_gp_refcnt_add(gprefcnt, arg) gprefcnt += arg +#define BSET_gp_share(sv, arg) STMT_START { \ + gp_free((GV*)sv); \ + GvGP(sv) = GvGP(arg); \ + } STMT_END + +#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_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); \ + } 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) +#define BSET_pv_free(pv) Safefree(pv.xpv_pv) +#define BSET_pregcomp(o, arg) \ + ((PMOP*)o)->op_pmregexp = arg ? \ + CALLREGCOMP(arg, arg + bytecode_pv.xpv_cur, ((PMOP*)o)) : 0 +#define BSET_newsv(sv, arg) sv = NEWSV(666,0); SvUPGRADE(sv, arg) +#define BSET_newop(o, arg) o = (OP*)safemalloc(optype_size[arg]) +#define BSET_newopn(o, arg) STMT_START { \ + OP *oldop = o; \ + BSET_newop(o, arg); \ + oldop->op_next = o; \ + } STMT_END + +#define BSET_ret(foo) return + +/* + * Kludge special-case workaround for OP_MAPSTART + * which needs the ppaddr for OP_GREPSTART. Blech. + */ +#define BSET_op_type(o, arg) STMT_START { \ + o->op_type = arg; \ + if (arg == OP_MAPSTART) \ + arg = OP_GREPSTART; \ + o->op_ppaddr = PL_ppaddr[arg]; \ + } STMT_END +#define BSET_op_ppaddr(o, arg) croak("op_ppaddr not yet implemented") +#define BSET_curpad(pad, arg) STMT_START { \ + PL_comppad = (AV *)arg; \ + pad = AvARRAY(arg); \ + } STMT_END + +#define BSET_OBJ_STORE(obj, ix) \ + (I32)ix > bytecode_obj_list_fill ? \ + bset_obj_store(obj, (I32)ix) : (bytecode_obj_list[ix] = obj) +typedef char *pvcontents; +typedef char *strconst; +typedef U32 PV; +typedef char *op_tr_array; +typedef int comment_t; +typedef SV *svindex; +typedef OP *opindex; +typedef IV IV64; + +#define BGET_FREAD(argp, len, nelem) \ + bs.fread((char*)(argp),(len),(nelem),bs.data) +#define BGET_FGETC() bs.fgetc(bs.data) + +#define BGET_U32(arg) \ + BGET_FREAD(&arg, sizeof(U32), 1); arg = PerlSock_ntohl((U32)arg) +#define BGET_I32(arg) \ + BGET_FREAD(&arg, sizeof(I32), 1); arg = (I32)PerlSock_ntohl((U32)arg) +#define BGET_U16(arg) \ + BGET_FREAD(&arg, sizeof(U16), 1); arg = PerlSock_ntohs((U16)arg) +#define BGET_U8(arg) arg = BGET_FGETC() + +#define BGET_PV(arg) STMT_START { \ + BGET_U32(arg); \ + if (arg) \ + bs.freadpv(arg, bs.data, &bytecode_pv); \ + else { \ + bytecode_pv.xpv_pv = 0; \ + bytecode_pv.xpv_len = 0; \ + bytecode_pv.xpv_cur = 0; \ + } \ + } STMT_END + +#define BGET_comment_t(arg) \ + do { arg = BGET_FGETC(); } while (arg != '\n' && arg != EOF) + +/* + * In the following, sizeof(IV)*4 is just a way of encoding 32 on 64-bit-IV + * machines such that 32-bit machine compilers don't whine about the shift + * count being too high even though the code is never reached there. + */ +#define BGET_IV64(arg) STMT_START { \ + U32 hi, lo; \ + BGET_U32(hi); \ + BGET_U32(lo); \ + if (sizeof(IV) == 8) \ + arg = (IV) (hi << (sizeof(IV)*4) | lo); \ + else if (((I32)hi == -1 && (I32)lo < 0) \ + || ((I32)hi == 0 && (I32)lo >= 0)) { \ + arg = (I32)lo; \ + } \ + else { \ + bytecode_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; \ + } while (0) + +#define BGET_pvcontents(arg) arg = bytecode_pv.xpv_pv +#define BGET_strconst(arg) STMT_START { \ + for (arg = PL_tokenbuf; (*arg = BGET_FGETC()); arg++) /* nothing */; \ + arg = PL_tokenbuf; \ + } STMT_END + +#define BGET_double(arg) STMT_START { \ + char *str; \ + BGET_strconst(str); \ + arg = atof(str); \ + } STMT_END + +#define BGET_objindex(arg, type) STMT_START { \ + U32 ix; \ + BGET_U32(ix); \ + arg = (type)bytecode_obj_list[ix]; \ + } STMT_END +#define BGET_svindex(arg) BGET_objindex(arg, svindex) +#define BGET_opindex(arg) BGET_objindex(arg, opindex) + +#define BSET_ldspecsv(sv, arg) sv = specialsv_list[arg] + +#define BSET_sv_refcnt_add(svrefcnt, arg) svrefcnt += arg +#define BSET_gp_refcnt_add(gprefcnt, arg) gprefcnt += arg +#define BSET_gp_share(sv, arg) STMT_START { \ + gp_free((GV*)sv); \ + GvGP(sv) = GvGP(arg); \ + } STMT_END + +#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_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); \ + } 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) +#define BSET_pv_free(pv) Safefree(pv.xpv_pv) +#define BSET_pregcomp(o, arg) \ + ((PMOP*)o)->op_pmregexp = arg ? \ + CALLREGCOMP(arg, arg + bytecode_pv.xpv_cur, ((PMOP*)o)) : 0 +#define BSET_newsv(sv, arg) sv = NEWSV(666,0); SvUPGRADE(sv, arg) +#define BSET_newop(o, arg) o = (OP*)safemalloc(optype_size[arg]) +#define BSET_newopn(o, arg) STMT_START { \ + OP *oldop = o; \ + BSET_newop(o, arg); \ + oldop->op_next = o; \ + } STMT_END + +#define BSET_ret(foo) return + +/* + * Kludge special-case workaround for OP_MAPSTART + * which needs the ppaddr for OP_GREPSTART. Blech. + */ +#define BSET_op_type(o, arg) STMT_START { \ + o->op_type = arg; \ + if (arg == OP_MAPSTART) \ + arg = OP_GREPSTART; \ + o->op_ppaddr = PL_ppaddr[arg]; \ + } STMT_END +#define BSET_op_ppaddr(o, arg) croak("op_ppaddr not yet implemented") +#define BSET_curpad(pad, arg) STMT_START { \ + PL_comppad = (AV *)arg; \ + pad = AvARRAY(arg); \ + } STMT_END + +#define BSET_OBJ_STORE(obj, ix) \ + (I32)ix > bytecode_obj_list_fill ? \ + bset_obj_store(obj, (I32)ix) : (bytecode_obj_list[ix] = obj) diff --git a/ext/ByteLoader/byterun.c b/ext/ByteLoader/byterun.c new file mode 100644 index 0000000000..ab5b5fc6dc --- /dev/null +++ b/ext/ByteLoader/byterun.c @@ -0,0 +1,901 @@ +/* + * Copyright (c) 1996-1999 Malcolm Beattie + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + */ +/* + * This file is autogenerated from bytecode.pl. Changes made here will be lost. + */ + +#include "EXTERN.h" +#include "perl.h" +#include "byterun.h" +#include "bytecode.h" + +static int optype_size[] = { + sizeof(OP), + sizeof(UNOP), + sizeof(BINOP), + sizeof(LOGOP), + sizeof(CONDOP), + sizeof(LISTOP), + sizeof(PMOP), + sizeof(SVOP), + sizeof(GVOP), + sizeof(PVOP), + sizeof(LOOP), + 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(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; + } + bytecode_obj_list[ix] = obj; + return obj; +} + +void byterun(struct bytestream bs) +{ + dTHR; + int insn; + + specialsv_list[0] = Nullsv; + specialsv_list[1] = &PL_sv_undef; + specialsv_list[2] = &PL_sv_yes; + specialsv_list[3] = &PL_sv_no; + + while ((insn = BGET_FGETC()) != EOF) { + switch (insn) { + case INSN_COMMENT: /* 35 */ + { + comment_t arg; + BGET_comment_t(arg); + arg = arg; + break; + } + case INSN_NOP: /* 10 */ + { + break; + } + case INSN_RET: /* 0 */ + { + BSET_ret(none); + break; + } + case INSN_LDSV: /* 1 */ + { + svindex arg; + BGET_svindex(arg); + bytecode_sv = arg; + break; + } + case INSN_LDOP: /* 2 */ + { + opindex arg; + BGET_opindex(arg); + PL_op = arg; + break; + } + case INSN_STSV: /* 3 */ + { + U32 arg; + BGET_U32(arg); + BSET_OBJ_STORE(bytecode_sv, arg); + break; + } + case INSN_STOP: /* 4 */ + { + U32 arg; + BGET_U32(arg); + BSET_OBJ_STORE(PL_op, arg); + break; + } + case INSN_LDSPECSV: /* 5 */ + { + U8 arg; + BGET_U8(arg); + BSET_ldspecsv(bytecode_sv, arg); + break; + } + case INSN_NEWSV: /* 6 */ + { + U8 arg; + BGET_U8(arg); + BSET_newsv(bytecode_sv, arg); + break; + } + case INSN_NEWOP: /* 7 */ + { + U8 arg; + BGET_U8(arg); + BSET_newop(PL_op, arg); + break; + } + case INSN_NEWOPN: /* 8 */ + { + U8 arg; + BGET_U8(arg); + BSET_newopn(PL_op, arg); + break; + } + case INSN_NEWPV: /* 9 */ + { + PV arg; + BGET_PV(arg); + break; + } + case INSN_PV_CUR: /* 11 */ + { + STRLEN arg; + BGET_U32(arg); + bytecode_pv.xpv_cur = arg; + break; + } + case INSN_PV_FREE: /* 12 */ + { + BSET_pv_free(bytecode_pv); + break; + } + case INSN_SV_UPGRADE: /* 13 */ + { + char arg; + BGET_U8(arg); + BSET_sv_upgrade(bytecode_sv, arg); + break; + } + case INSN_SV_REFCNT: /* 14 */ + { + U32 arg; + BGET_U32(arg); + SvREFCNT(bytecode_sv) = arg; + break; + } + case INSN_SV_REFCNT_ADD: /* 15 */ + { + I32 arg; + BGET_I32(arg); + BSET_sv_refcnt_add(SvREFCNT(bytecode_sv), arg); + break; + } + case INSN_SV_FLAGS: /* 16 */ + { + U32 arg; + BGET_U32(arg); + SvFLAGS(bytecode_sv) = arg; + break; + } + case INSN_XRV: /* 17 */ + { + svindex arg; + BGET_svindex(arg); + SvRV(bytecode_sv) = arg; + break; + } + case INSN_XPV: /* 18 */ + { + BSET_xpv(bytecode_sv); + break; + } + case INSN_XIV32: /* 19 */ + { + I32 arg; + BGET_I32(arg); + SvIVX(bytecode_sv) = arg; + break; + } + case INSN_XIV64: /* 20 */ + { + IV64 arg; + BGET_IV64(arg); + SvIVX(bytecode_sv) = arg; + break; + } + case INSN_XNV: /* 21 */ + { + double arg; + BGET_double(arg); + SvNVX(bytecode_sv) = arg; + break; + } + case INSN_XLV_TARGOFF: /* 22 */ + { + STRLEN arg; + BGET_U32(arg); + LvTARGOFF(bytecode_sv) = arg; + break; + } + case INSN_XLV_TARGLEN: /* 23 */ + { + STRLEN arg; + BGET_U32(arg); + LvTARGLEN(bytecode_sv) = arg; + break; + } + case INSN_XLV_TARG: /* 24 */ + { + svindex arg; + BGET_svindex(arg); + LvTARG(bytecode_sv) = arg; + break; + } + case INSN_XLV_TYPE: /* 25 */ + { + char arg; + BGET_U8(arg); + LvTYPE(bytecode_sv) = arg; + break; + } + case INSN_XBM_USEFUL: /* 26 */ + { + I32 arg; + BGET_I32(arg); + BmUSEFUL(bytecode_sv) = arg; + break; + } + case INSN_XBM_PREVIOUS: /* 27 */ + { + U16 arg; + BGET_U16(arg); + BmPREVIOUS(bytecode_sv) = arg; + break; + } + case INSN_XBM_RARE: /* 28 */ + { + U8 arg; + BGET_U8(arg); + BmRARE(bytecode_sv) = arg; + break; + } + case INSN_XFM_LINES: /* 29 */ + { + I32 arg; + BGET_I32(arg); + FmLINES(bytecode_sv) = arg; + break; + } + case INSN_XIO_LINES: /* 30 */ + { + long arg; + BGET_I32(arg); + IoLINES(bytecode_sv) = arg; + break; + } + case INSN_XIO_PAGE: /* 31 */ + { + long arg; + BGET_I32(arg); + IoPAGE(bytecode_sv) = arg; + break; + } + case INSN_XIO_PAGE_LEN: /* 32 */ + { + long arg; + BGET_I32(arg); + IoPAGE_LEN(bytecode_sv) = arg; + break; + } + case INSN_XIO_LINES_LEFT: /* 33 */ + { + long arg; + BGET_I32(arg); + IoLINES_LEFT(bytecode_sv) = arg; + break; + } + case INSN_XIO_TOP_NAME: /* 34 */ + { + pvcontents arg; + BGET_pvcontents(arg); + IoTOP_NAME(bytecode_sv) = arg; + break; + } + case INSN_XIO_TOP_GV: /* 36 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&IoTOP_GV(bytecode_sv) = arg; + break; + } + case INSN_XIO_FMT_NAME: /* 37 */ + { + pvcontents arg; + BGET_pvcontents(arg); + IoFMT_NAME(bytecode_sv) = arg; + break; + } + case INSN_XIO_FMT_GV: /* 38 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&IoFMT_GV(bytecode_sv) = arg; + break; + } + case INSN_XIO_BOTTOM_NAME: /* 39 */ + { + pvcontents arg; + BGET_pvcontents(arg); + IoBOTTOM_NAME(bytecode_sv) = arg; + break; + } + case INSN_XIO_BOTTOM_GV: /* 40 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&IoBOTTOM_GV(bytecode_sv) = arg; + break; + } + case INSN_XIO_SUBPROCESS: /* 41 */ + { + short arg; + BGET_U16(arg); + IoSUBPROCESS(bytecode_sv) = arg; + break; + } + case INSN_XIO_TYPE: /* 42 */ + { + char arg; + BGET_U8(arg); + IoTYPE(bytecode_sv) = arg; + break; + } + case INSN_XIO_FLAGS: /* 43 */ + { + char arg; + BGET_U8(arg); + IoFLAGS(bytecode_sv) = arg; + break; + } + case INSN_XCV_STASH: /* 44 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&CvSTASH(bytecode_sv) = arg; + break; + } + case INSN_XCV_START: /* 45 */ + { + opindex arg; + BGET_opindex(arg); + CvSTART(bytecode_sv) = arg; + break; + } + case INSN_XCV_ROOT: /* 46 */ + { + opindex arg; + BGET_opindex(arg); + CvROOT(bytecode_sv) = arg; + break; + } + case INSN_XCV_GV: /* 47 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&CvGV(bytecode_sv) = arg; + break; + } + case INSN_XCV_FILEGV: /* 48 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&CvFILEGV(bytecode_sv) = arg; + break; + } + case INSN_XCV_DEPTH: /* 49 */ + { + long arg; + BGET_I32(arg); + CvDEPTH(bytecode_sv) = arg; + break; + } + case INSN_XCV_PADLIST: /* 50 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&CvPADLIST(bytecode_sv) = arg; + break; + } + case INSN_XCV_OUTSIDE: /* 51 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&CvOUTSIDE(bytecode_sv) = arg; + break; + } + case INSN_XCV_FLAGS: /* 52 */ + { + U8 arg; + BGET_U8(arg); + CvFLAGS(bytecode_sv) = arg; + break; + } + case INSN_AV_EXTEND: /* 53 */ + { + SSize_t arg; + BGET_I32(arg); + BSET_av_extend(bytecode_sv, arg); + break; + } + case INSN_AV_PUSH: /* 54 */ + { + svindex arg; + BGET_svindex(arg); + BSET_av_push(bytecode_sv, arg); + break; + } + case INSN_XAV_FILL: /* 55 */ + { + SSize_t arg; + BGET_I32(arg); + AvFILLp(bytecode_sv) = arg; + break; + } + case INSN_XAV_MAX: /* 56 */ + { + SSize_t arg; + BGET_I32(arg); + AvMAX(bytecode_sv) = arg; + break; + } + case INSN_XAV_FLAGS: /* 57 */ + { + U8 arg; + BGET_U8(arg); + AvFLAGS(bytecode_sv) = arg; + break; + } + case INSN_XHV_RITER: /* 58 */ + { + I32 arg; + BGET_I32(arg); + HvRITER(bytecode_sv) = arg; + break; + } + case INSN_XHV_NAME: /* 59 */ + { + pvcontents arg; + BGET_pvcontents(arg); + HvNAME(bytecode_sv) = arg; + break; + } + case INSN_HV_STORE: /* 60 */ + { + svindex arg; + BGET_svindex(arg); + BSET_hv_store(bytecode_sv, arg); + break; + } + case INSN_SV_MAGIC: /* 61 */ + { + char arg; + BGET_U8(arg); + BSET_sv_magic(bytecode_sv, arg); + break; + } + case INSN_MG_OBJ: /* 62 */ + { + svindex arg; + BGET_svindex(arg); + SvMAGIC(bytecode_sv)->mg_obj = arg; + break; + } + case INSN_MG_PRIVATE: /* 63 */ + { + U16 arg; + BGET_U16(arg); + SvMAGIC(bytecode_sv)->mg_private = arg; + break; + } + case INSN_MG_FLAGS: /* 64 */ + { + U8 arg; + BGET_U8(arg); + SvMAGIC(bytecode_sv)->mg_flags = arg; + break; + } + case INSN_MG_PV: /* 65 */ + { + pvcontents arg; + BGET_pvcontents(arg); + BSET_mg_pv(SvMAGIC(bytecode_sv), arg); + break; + } + case INSN_XMG_STASH: /* 66 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&SvSTASH(bytecode_sv) = arg; + break; + } + case INSN_GV_FETCHPV: /* 67 */ + { + strconst arg; + BGET_strconst(arg); + BSET_gv_fetchpv(bytecode_sv, arg); + break; + } + case INSN_GV_STASHPV: /* 68 */ + { + strconst arg; + BGET_strconst(arg); + BSET_gv_stashpv(bytecode_sv, arg); + break; + } + case INSN_GP_SV: /* 69 */ + { + svindex arg; + BGET_svindex(arg); + GvSV(bytecode_sv) = arg; + break; + } + case INSN_GP_REFCNT: /* 70 */ + { + U32 arg; + BGET_U32(arg); + GvREFCNT(bytecode_sv) = arg; + break; + } + case INSN_GP_REFCNT_ADD: /* 71 */ + { + I32 arg; + BGET_I32(arg); + BSET_gp_refcnt_add(GvREFCNT(bytecode_sv), arg); + break; + } + case INSN_GP_AV: /* 72 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&GvAV(bytecode_sv) = arg; + break; + } + case INSN_GP_HV: /* 73 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&GvHV(bytecode_sv) = arg; + break; + } + case INSN_GP_CV: /* 74 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&GvCV(bytecode_sv) = arg; + break; + } + case INSN_GP_FILEGV: /* 75 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&GvFILEGV(bytecode_sv) = arg; + break; + } + case INSN_GP_IO: /* 76 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&GvIOp(bytecode_sv) = arg; + break; + } + case INSN_GP_FORM: /* 77 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&GvFORM(bytecode_sv) = arg; + break; + } + case INSN_GP_CVGEN: /* 78 */ + { + U32 arg; + BGET_U32(arg); + GvCVGEN(bytecode_sv) = arg; + break; + } + case INSN_GP_LINE: /* 79 */ + { + line_t arg; + BGET_U16(arg); + GvLINE(bytecode_sv) = arg; + break; + } + case INSN_GP_SHARE: /* 80 */ + { + svindex arg; + BGET_svindex(arg); + BSET_gp_share(bytecode_sv, arg); + break; + } + case INSN_XGV_FLAGS: /* 81 */ + { + U8 arg; + BGET_U8(arg); + GvFLAGS(bytecode_sv) = arg; + break; + } + case INSN_OP_NEXT: /* 82 */ + { + opindex arg; + BGET_opindex(arg); + PL_op->op_next = arg; + break; + } + case INSN_OP_SIBLING: /* 83 */ + { + opindex arg; + BGET_opindex(arg); + PL_op->op_sibling = arg; + break; + } + case INSN_OP_PPADDR: /* 84 */ + { + strconst arg; + BGET_strconst(arg); + BSET_op_ppaddr(PL_op->op_ppaddr, arg); + break; + } + case INSN_OP_TARG: /* 85 */ + { + PADOFFSET arg; + BGET_U32(arg); + PL_op->op_targ = arg; + break; + } + case INSN_OP_TYPE: /* 86 */ + { + OPCODE arg; + BGET_U16(arg); + BSET_op_type(PL_op, arg); + break; + } + case INSN_OP_SEQ: /* 87 */ + { + U16 arg; + BGET_U16(arg); + PL_op->op_seq = arg; + break; + } + case INSN_OP_FLAGS: /* 88 */ + { + U8 arg; + BGET_U8(arg); + PL_op->op_flags = arg; + break; + } + case INSN_OP_PRIVATE: /* 89 */ + { + U8 arg; + BGET_U8(arg); + PL_op->op_private = arg; + break; + } + case INSN_OP_FIRST: /* 90 */ + { + opindex arg; + BGET_opindex(arg); + cUNOP->op_first = arg; + break; + } + case INSN_OP_LAST: /* 91 */ + { + opindex arg; + BGET_opindex(arg); + cBINOP->op_last = arg; + break; + } + case INSN_OP_OTHER: /* 92 */ + { + opindex arg; + BGET_opindex(arg); + cLOGOP->op_other = arg; + break; + } + case INSN_OP_TRUE: /* 93 */ + { + opindex arg; + BGET_opindex(arg); + cCONDOP->op_true = arg; + break; + } + case INSN_OP_FALSE: /* 94 */ + { + opindex arg; + BGET_opindex(arg); + cCONDOP->op_false = arg; + break; + } + case INSN_OP_CHILDREN: /* 95 */ + { + U32 arg; + BGET_U32(arg); + cLISTOP->op_children = arg; + break; + } + case INSN_OP_PMREPLROOT: /* 96 */ + { + opindex arg; + BGET_opindex(arg); + cPMOP->op_pmreplroot = arg; + break; + } + case INSN_OP_PMREPLROOTGV: /* 97 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&cPMOP->op_pmreplroot = arg; + break; + } + case INSN_OP_PMREPLSTART: /* 98 */ + { + opindex arg; + BGET_opindex(arg); + cPMOP->op_pmreplstart = arg; + break; + } + case INSN_OP_PMNEXT: /* 99 */ + { + opindex arg; + BGET_opindex(arg); + *(OP**)&cPMOP->op_pmnext = arg; + break; + } + case INSN_PREGCOMP: /* 100 */ + { + pvcontents arg; + BGET_pvcontents(arg); + BSET_pregcomp(PL_op, arg); + break; + } + case INSN_OP_PMFLAGS: /* 101 */ + { + U16 arg; + BGET_U16(arg); + cPMOP->op_pmflags = arg; + break; + } + case INSN_OP_PMPERMFLAGS: /* 102 */ + { + U16 arg; + BGET_U16(arg); + cPMOP->op_pmpermflags = arg; + break; + } + case INSN_OP_SV: /* 103 */ + { + svindex arg; + BGET_svindex(arg); + cSVOP->op_sv = arg; + break; + } + case INSN_OP_GV: /* 104 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&cGVOP->op_gv = arg; + break; + } + case INSN_OP_PV: /* 105 */ + { + pvcontents arg; + BGET_pvcontents(arg); + cPVOP->op_pv = arg; + break; + } + case INSN_OP_PV_TR: /* 106 */ + { + op_tr_array arg; + BGET_op_tr_array(arg); + cPVOP->op_pv = arg; + break; + } + case INSN_OP_REDOOP: /* 107 */ + { + opindex arg; + BGET_opindex(arg); + cLOOP->op_redoop = arg; + break; + } + case INSN_OP_NEXTOP: /* 108 */ + { + opindex arg; + BGET_opindex(arg); + cLOOP->op_nextop = arg; + break; + } + case INSN_OP_LASTOP: /* 109 */ + { + opindex arg; + BGET_opindex(arg); + cLOOP->op_lastop = arg; + break; + } + case INSN_COP_LABEL: /* 110 */ + { + pvcontents arg; + BGET_pvcontents(arg); + cCOP->cop_label = arg; + break; + } + case INSN_COP_STASH: /* 111 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&cCOP->cop_stash = arg; + break; + } + case INSN_COP_FILEGV: /* 112 */ + { + svindex arg; + BGET_svindex(arg); + *(SV**)&cCOP->cop_filegv = arg; + break; + } + case INSN_COP_SEQ: /* 113 */ + { + U32 arg; + BGET_U32(arg); + cCOP->cop_seq = arg; + break; + } + case INSN_COP_ARYBASE: /* 114 */ + { + I32 arg; + BGET_I32(arg); + cCOP->cop_arybase = arg; + break; + } + case INSN_COP_LINE: /* 115 */ + { + line_t arg; + BGET_U16(arg); + cCOP->cop_line = arg; + break; + } + case INSN_COP_WARNINGS: /* 116 */ + { + svindex arg; + BGET_svindex(arg); + cCOP->cop_warnings = arg; + break; + } + case INSN_MAIN_START: /* 117 */ + { + opindex arg; + BGET_opindex(arg); + PL_main_start = arg; + break; + } + case INSN_MAIN_ROOT: /* 118 */ + { + opindex arg; + BGET_opindex(arg); + PL_main_root = arg; + break; + } + case INSN_CURPAD: /* 119 */ + { + svindex arg; + BGET_svindex(arg); + BSET_curpad(PL_curpad, arg); + break; + } + default: + croak("Illegal bytecode instruction %d\n", insn); + /* NOTREACHED */ + } + } +} diff --git a/ext/ByteLoader/byterun.h b/ext/ByteLoader/byterun.h new file mode 100644 index 0000000000..c293160340 --- /dev/null +++ b/ext/ByteLoader/byterun.h @@ -0,0 +1,181 @@ +/* + * Copyright (c) 1996-1999 Malcolm Beattie + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + */ +/* + * This file is autogenerated from bytecode.pl. Changes made here will be lost. + */ +struct bytestream { + void *data; + int (*fgetc)(void *); + int (*fread)(char *, size_t, size_t, void *); + void (*freadpv)(U32, void *, XPV *); +}; + +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_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_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_FILEGV, /* 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_FILEGV, /* 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_TRUE, /* 93 */ + INSN_OP_FALSE, /* 94 */ + INSN_OP_CHILDREN, /* 95 */ + INSN_OP_PMREPLROOT, /* 96 */ + INSN_OP_PMREPLROOTGV, /* 97 */ + INSN_OP_PMREPLSTART, /* 98 */ + INSN_OP_PMNEXT, /* 99 */ + INSN_PREGCOMP, /* 100 */ + INSN_OP_PMFLAGS, /* 101 */ + INSN_OP_PMPERMFLAGS, /* 102 */ + INSN_OP_SV, /* 103 */ + INSN_OP_GV, /* 104 */ + INSN_OP_PV, /* 105 */ + INSN_OP_PV_TR, /* 106 */ + INSN_OP_REDOOP, /* 107 */ + INSN_OP_NEXTOP, /* 108 */ + INSN_OP_LASTOP, /* 109 */ + INSN_COP_LABEL, /* 110 */ + INSN_COP_STASH, /* 111 */ + INSN_COP_FILEGV, /* 112 */ + INSN_COP_SEQ, /* 113 */ + INSN_COP_ARYBASE, /* 114 */ + INSN_COP_LINE, /* 115 */ + INSN_COP_WARNINGS, /* 116 */ + INSN_MAIN_START, /* 117 */ + INSN_MAIN_ROOT, /* 118 */ + INSN_CURPAD, /* 119 */ + MAX_INSN = 119 +}; + +enum { + OPt_OP, /* 0 */ + OPt_UNOP, /* 1 */ + OPt_BINOP, /* 2 */ + OPt_LOGOP, /* 3 */ + OPt_CONDOP, /* 4 */ + OPt_LISTOP, /* 5 */ + OPt_PMOP, /* 6 */ + OPt_SVOP, /* 7 */ + OPt_GVOP, /* 8 */ + OPt_PVOP, /* 9 */ + OPt_LOOP, /* 10 */ + OPt_COP /* 11 */ +}; + +EXT int PL_optype_size[] +#ifdef DOINIT += { + sizeof(OP), + sizeof(UNOP), + sizeof(BINOP), + sizeof(LOGOP), + sizeof(CONDOP), + sizeof(LISTOP), + sizeof(PMOP), + sizeof(SVOP), + sizeof(GVOP), + sizeof(PVOP), + sizeof(LOOP), + sizeof(COP) +} +#endif /* DOINIT */ +; + +#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 |