diff options
Diffstat (limited to 'bytecode.pl')
-rw-r--r-- | bytecode.pl | 63 |
1 files changed, 51 insertions, 12 deletions
diff --git a/bytecode.pl b/bytecode.pl index 0fd036229c..e3759613e2 100644 --- a/bytecode.pl +++ b/bytecode.pl @@ -100,7 +100,7 @@ bset_obj_store(pTHX_ struct byteloader_state *bstate, void *obj, I32 ix) return obj; } -void +int byterun(pTHX_ register struct byteloader_state *bstate) { register int insn; @@ -110,6 +110,7 @@ byterun(pTHX_ register struct byteloader_state *bstate) BYTECODE_HEADER_CHECK; /* croak if incorrect platform */ New(666, 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 */ EOT @@ -127,8 +128,11 @@ EOT my (@insn_name, $insn_num, $insn, $lvalue, $argtype, $flags, $fundtype); while (<DATA>) { + if (/^\s*#/) { + print BYTERUN_C if /^\s*#\s*(?:if|endif|el)/; + next; + } chop; - s/#.*//; # remove comments next unless length; if (/^%number\s+(.*)/) { $insn_num = $1; @@ -181,6 +185,7 @@ print BYTERUN_C <<'EOT'; /* NOTREACHED */ } } + return 0; } EOT @@ -206,7 +211,7 @@ struct byteloader_state { int bl_getc(struct byteloader_fdata *); int bl_read(struct byteloader_fdata *, char *, size_t, size_t); -extern void byterun(pTHX_ struct byteloader_state *); +extern int byterun(pTHX_ struct byteloader_state *); enum { EOT @@ -325,6 +330,7 @@ comment arg comment_t # Then make ord("\n") into a no-op %number 10 nop none none + # Now for the rest of the ordinary ones, beginning with \0 which is # ret so that \0-terminated strings can be read properly as bytecode. %number 0 @@ -350,8 +356,9 @@ sv_refcnt_add SvREFCNT(bstate->bs_sv) I32 x sv_flags SvFLAGS(bstate->bs_sv) U32 xrv SvRV(bstate->bs_sv) svindex xpv bstate->bs_sv none x -xiv32 SvIVX(bstate->bs_sv) I32 -xiv64 SvIVX(bstate->bs_sv) IV64 +xpv_cur SvCUR(bstate->bs_sv) STRLEN +xpv_len SvLEN(bstate->bs_sv) STRLEN +xiv SvIVX(bstate->bs_sv) IV xnv SvNVX(bstate->bs_sv) NV xlv_targoff LvTARGOFF(bstate->bs_sv) STRLEN xlv_targlen LvTARGLEN(bstate->bs_sv) STRLEN @@ -365,15 +372,16 @@ xio_lines IoLINES(bstate->bs_sv) IV xio_page IoPAGE(bstate->bs_sv) IV xio_page_len IoPAGE_LEN(bstate->bs_sv) IV xio_lines_left IoLINES_LEFT(bstate->bs_sv) IV -xio_top_name IoTOP_NAME(bstate->bs_sv) pvcontents +xio_top_name IoTOP_NAME(bstate->bs_sv) pvindex xio_top_gv *(SV**)&IoTOP_GV(bstate->bs_sv) svindex -xio_fmt_name IoFMT_NAME(bstate->bs_sv) pvcontents +xio_fmt_name IoFMT_NAME(bstate->bs_sv) pvindex xio_fmt_gv *(SV**)&IoFMT_GV(bstate->bs_sv) svindex -xio_bottom_name IoBOTTOM_NAME(bstate->bs_sv) pvcontents +xio_bottom_name IoBOTTOM_NAME(bstate->bs_sv) pvindex xio_bottom_gv *(SV**)&IoBOTTOM_GV(bstate->bs_sv) svindex xio_subprocess IoSUBPROCESS(bstate->bs_sv) short xio_type IoTYPE(bstate->bs_sv) char xio_flags IoFLAGS(bstate->bs_sv) char +xcv_xsubany *(SV**)&CvXSUBANY(bstate->bs_sv).any_ptr svindex xcv_stash *(SV**)&CvSTASH(bstate->bs_sv) svindex xcv_start CvSTART(bstate->bs_sv) opindex xcv_root CvROOT(bstate->bs_sv) opindex @@ -385,18 +393,21 @@ xcv_outside *(SV**)&CvOUTSIDE(bstate->bs_sv) svindex xcv_outside_seq CvOUTSIDE_SEQ(bstate->bs_sv) U32 xcv_flags CvFLAGS(bstate->bs_sv) U16 av_extend bstate->bs_sv SSize_t x +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) pvcontents +xhv_name HvNAME(bstate->bs_sv) pvindex +xhv_pmroot *(OP**)&HvPMROOT(bstate->bs_sv) opindex hv_store bstate->bs_sv svindex x sv_magic bstate->bs_sv char x mg_obj SvMAGIC(bstate->bs_sv)->mg_obj svindex mg_private SvMAGIC(bstate->bs_sv)->mg_private U16 mg_flags SvMAGIC(bstate->bs_sv)->mg_flags U8 -mg_pv SvMAGIC(bstate->bs_sv) pvcontents x +mg_name SvMAGIC(bstate->bs_sv) pvcontents x +mg_namex SvMAGIC(bstate->bs_sv) svindex x xmg_stash *(SV**)&SvSTASH(bstate->bs_sv) svindex gv_fetchpv bstate->bs_sv strconst x gv_stashpv bstate->bs_sv strconst x @@ -425,12 +436,19 @@ op_first cUNOP->op_first opindex op_last cBINOP->op_last opindex op_other cLOGOP->op_other opindex op_pmreplroot cPMOP->op_pmreplroot opindex -op_pmreplrootgv *(SV**)&cPMOP->op_pmreplroot svindex op_pmreplstart cPMOP->op_pmreplstart opindex op_pmnext *(OP**)&cPMOP->op_pmnext opindex +#ifdef USE_ITHREADS +op_pmstashpv cPMOP->op_pmstashpv pvindex +op_pmreplrootpo (PADOFFSET)cPMOP->op_pmreplroot PADOFFSET +#else +op_pmstash *(SV**)&cPMOP->op_pmstash svindex +op_pmreplrootgv *(SV**)&cPMOP->op_pmreplroot svindex +#endif pregcomp PL_op pvcontents x op_pmflags cPMOP->op_pmflags U16 op_pmpermflags cPMOP->op_pmpermflags U16 +op_pmdynflags cPMOP->op_pmdynflags U8 op_sv cSVOP->op_sv svindex op_padix cPADOP->op_padix PADOFFSET op_pv cPVOP->op_pv pvcontents @@ -439,15 +457,36 @@ op_redoop cLOOP->op_redoop opindex op_nextop cLOOP->op_nextop opindex op_lastop cLOOP->op_lastop opindex cop_label cCOP->cop_label pvindex +#ifdef USE_ITHREADS cop_stashpv cCOP pvindex x cop_file cCOP pvindex x +#else +cop_stash cCOP svindex x +cop_filegv cCOP svindex x +#endif cop_seq cCOP->cop_seq U32 cop_arybase cCOP->cop_arybase I32 -cop_line cCOP line_t x +cop_line cCOP->cop_line line_t +cop_io cCOP->cop_io svindex cop_warnings cCOP->cop_warnings svindex main_start PL_main_start opindex main_root PL_main_root opindex +main_cv *(SV**)&PL_main_cv svindex curpad PL_curpad svindex x push_begin PL_beginav svindex x push_init PL_initav svindex x push_end PL_endav svindex x +curstash *(SV**)&PL_curstash svindex +defstash *(SV**)&PL_defstash svindex +data none U8 x +incav *(SV**)&GvAVn(PL_incgv) svindex +load_glob none svindex x +#ifdef USE_ITHREADS +regex_padav *(SV**)&PL_regex_padav svindex +#endif +dowarn PL_dowarn U8 +comppad_name *(SV**)&PL_comppad_name svindex +xgv_stash *(SV**)&GvSTASH(bstate->bs_sv) svindex +signal bstate->bs_sv strconst x +# to be removed +formfeed PL_formfeed svindex |