dslinux/user/perl/ext/ByteLoader ByteLoader.pm ByteLoader.xs Makefile.PL bytecode.h byterun.c byterun.h

cayenne dslinux_cayenne at user.in-berlin.de
Mon Dec 4 17:59:10 CET 2006


Update of /cvsroot/dslinux/dslinux/user/perl/ext/ByteLoader
In directory antilope:/tmp/cvs-serv17422/ext/ByteLoader

Added Files:
	ByteLoader.pm ByteLoader.xs Makefile.PL bytecode.h byterun.c 
	byterun.h 
Log Message:
Adding fresh perl source to HEAD to branch from

--- NEW FILE: ByteLoader.pm ---
package ByteLoader;

use XSLoader ();

our $VERSION = '0.06';

XSLoader::load 'ByteLoader', $VERSION;

1;
__END__

=head1 NAME

ByteLoader - load byte compiled perl code

=head1 SYNOPSIS

  use ByteLoader 0.06;
  <byte code>

  or just

  perl -MByteLoader bytecode_file

=head1 DESCRIPTION

This module is used to load byte compiled perl code as produced by
C<perl -MO=Bytecode=...>. It uses the source filter mechanism to read
the byte code and insert it into the compiled code at the appropriate point.

=head1 AUTHOR

Tom Hughes <tom at compton.nu> based on the ideas of Tim Bunce and others.
Many changes by Enache Adrian <enache at rdslink.ro> 2003 a.d.

=head1 SEE ALSO

perl(1).

=cut

--- NEW FILE: ByteLoader.xs ---
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "byterun.h"

/* Something arbitary for a buffer size */
#define BYTELOADER_BUFFER 8096

int
bl_getc(struct byteloader_fdata *data)
{
    dTHX;
    if (SvCUR(data->datasv) <= (STRLEN)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 *((U8 *) SvPV_nolen (data->datasv) + data->next_out++);
}

int
bl_read(struct byteloader_fdata *data, char *buf, size_t size, size_t n)
{
    dTHX;
    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);
      } else {
	*start = '\0';	/* Avoid call to memmove. */
      }
      SvCUR_set(data->datasv, len);
      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
byteloader_filter(pTHX_ int idx, SV *buf_sv, int maxlen)
{
    OP *saveroot = PL_main_root;
    OP *savestart = PL_main_start;
    struct byteloader_state bstate;
    struct byteloader_fdata data;
    int len;
    (void)buf_sv;
    (void)maxlen;

    data.next_out = 0;
    data.datasv = FILTER_DATA(idx);
    data.idx = idx;

    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;

/* KLUDGE */
    if (byterun(aTHX_ &bstate)
	    && (len = SvCUR(data.datasv) - (STRLEN)data.next_out))
    {
	PerlIO_seek(PL_rsfp, -len, SEEK_CUR);
	PL_rsfp = NULL;
    }
    filter_del(byteloader_filter);

    if (PL_in_eval) {
        OP *o;

        PL_eval_start = PL_main_start;

        o = newSVOP(OP_CONST, 0, newSViv(1));
        PL_eval_root = newLISTOP(OP_LINESEQ, 0, PL_main_root, o);
        PL_main_root->op_next = o;
        PL_eval_root = newUNOP(OP_LEAVEEVAL, 0, PL_eval_root);
        o->op_next = PL_eval_root;
    
        PL_main_root = saveroot;
        PL_main_start = savestart;
    }

    return 0;
}

MODULE = ByteLoader		PACKAGE = ByteLoader

PROTOTYPES:	ENABLE

void
import(package="ByteLoader", ...)
  char *package
  PREINIT:
    SV *sv = newSVpvn ("", 0);
  PPCODE:
    if (!sv)
      croak ("Could not allocate ByteLoader buffers");
    filter_add(byteloader_filter, sv);

--- NEW FILE: bytecode.h ---
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 char *pvindex;

#define BGET_FREAD(argp, len, nelem)	\
	 bl_read(bstate->bs_fdata,(char*)(argp),(len),(nelem))
#define BGET_FGETC() bl_getc(bstate->bs_fdata)

/* all this should be made endianness-agnostic */

#define BGET_U8(arg)	arg = BGET_FGETC()
#define BGET_U16(arg)	\
	BGET_FREAD(&arg, sizeof(U16), 1)
#define BGET_U32(arg)	\
	BGET_FREAD(&arg, sizeof(U32), 1)
#define BGET_UV(arg)	\
	BGET_FREAD(&arg, sizeof(UV), 1)
#define BGET_PADOFFSET(arg)	\
	BGET_FREAD(&arg, sizeof(PADOFFSET), 1)
#define BGET_long(arg)		\
	BGET_FREAD(&arg, sizeof(long), 1)

#define BGET_I32(arg)	BGET_U32(arg)
#define BGET_IV(arg)	BGET_UV(arg)

#define BGET_PV(arg)	STMT_START {					\
	BGET_U32(arg);							\
	if (arg) {							\
	    Newx(bstate->bs_pv.xpv_pv, arg, char);			\
	    bl_read(bstate->bs_fdata, 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
#  define BGET_comment_t(arg) \
    STMT_START {							\
	char buf[1024];							\
	int i = 0;							\
	do {								\
	    arg = BGET_FGETC();						\
	    buf[i++] = (char)arg;					\
	} while (arg != '\n' && arg != EOF);				\
	buf[i] = '\0';							\
	PerlIO_printf(PerlIO_stderr(), "%s", buf);			\
    } STMT_END
#else
#  define BGET_comment_t(arg) \
	do { arg = BGET_FGETC(); } while (arg != '\n' && arg != EOF)
#endif


#define BGET_op_tr_array(arg) do {			\
	unsigned short *ary, len;			\
	BGET_U16(len);					\
	Newx(ary, len, unsigned short);		\
	BGET_FREAD(ary, sizeof(unsigned short), len);	\
	arg = (char *) ary;				\
    } while (0)

#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;			\
    } STMT_END

#define BGET_NV(arg) STMT_START {	\
	char *str;			\
	BGET_strconst(str);		\
	arg = Atof(str);		\
    } STMT_END

#define BGET_objindex(arg, type) STMT_START {	\
	BGET_U32(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_ldspecsvx(sv, arg) STMT_START {	\
	BSET_ldspecsv(sv, arg);			\
	BSET_OBJ_STOREX(sv);			\
    } STMT_END

#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
#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_fetchpvx(sv, arg) STMT_START {	\
	BSET_gv_fetchpv(sv, arg);		\
	BSET_OBJ_STOREX(sv);			\
    } STMT_END

#define BSET_gv_stashpv(sv, arg)	sv = (SV*)gv_stashpv(arg, TRUE)
#define BSET_gv_stashpvx(sv, arg) STMT_START {	\
	BSET_gv_stashpv(sv, arg);		\
	BSET_OBJ_STOREX(sv);			\
    } STMT_END

#define BSET_sv_magic(sv, arg)		sv_magic(sv, Nullsv, arg, 0, 0)
#define BSET_mg_name(mg, arg)	mg->mg_ptr = arg; mg->mg_len = bstate->bs_pv.xpv_cur
#define BSET_mg_namex(mg, arg)			\
	(mg->mg_ptr = (char*)SvREFCNT_inc((SV*)arg),	\
	 mg->mg_len = HEf_SVKEY)
#define BSET_xmg_stash(sv, arg) *(SV**)&(((XPVMG*)SvANY(sv))->xmg_stash) = (arg)
#define BSET_sv_upgrade(sv, arg)	(void)SvUPGRADE(sv, arg)
#define BSET_xrv(sv, arg) SvRV_set(sv, arg)
#define BSET_xpv(sv)	do {	\
	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_xpv_cur(sv, arg) SvCUR_set(sv, arg)
#define BSET_xpv_len(sv, arg) SvLEN_set(sv, arg)
#define BSET_xiv(sv, arg) SvIV_set(sv, arg)
#define BSET_xnv(sv, arg) SvNV_set(sv, arg)

#define BSET_av_extend(sv, arg)	av_extend((AV*)sv, arg)

#define BSET_av_push(sv, arg)	av_push((AV*)sv, arg)
#define BSET_av_pushx(sv, arg)	(AvARRAY(sv)[++AvFILLp(sv)] = arg)
#define BSET_hv_store(sv, arg)	\
	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)


#ifdef USE_ITHREADS

/* copied after the code in newPMOP() */
#define BSET_pregcomp(o, arg) \
    STMT_START { \
        SV* repointer; \
	REGEXP* rx = arg ? \
	    CALLREGCOMP(aTHX_ arg, arg + bstate->bs_pv.xpv_cur, cPMOPx(o)) : \
	    Null(REGEXP*); \
        if(av_len((AV*) PL_regex_pad[0]) > -1) { \
            repointer = av_pop((AV*)PL_regex_pad[0]); \
            cPMOPx(o)->op_pmoffset = SvIV(repointer); \
            SvREPADTMP_off(repointer); \
            sv_setiv(repointer,PTR2IV(rx)); \
        } else { \
            repointer = newSViv(PTR2IV(rx)); \
            av_push(PL_regex_padav,SvREFCNT_inc(repointer)); \
            cPMOPx(o)->op_pmoffset = av_len(PL_regex_padav); \
            PL_regex_pad = AvARRAY(PL_regex_padav); \
        } \
    } STMT_END

#else
#define BSET_pregcomp(o, arg) \
    STMT_START { \
	PM_SETRE(((PMOP*)o), (arg ? \
	     CALLREGCOMP(aTHX_ arg, arg + bstate->bs_pv.xpv_cur, cPMOPx(o)): \
	     Null(REGEXP*))); \
    } STMT_END

#endif /* USE_THREADS */


#define BSET_newsv(sv, arg)				\
	    switch(arg) {				\
	    case SVt_PVAV:				\
		sv = (SV*)newAV();			\
		break;					\
	    case SVt_PVHV:				\
		sv = (SV*)newHV();			\
		break;					\
	    default:					\
		sv = NEWSV(0,0);			\
		SvUPGRADE(sv, (arg));			\
	    }
#define BSET_newsvx(sv, arg) STMT_START {		\
	    BSET_newsv(sv, arg &  SVTYPEMASK);		\
	    SvFLAGS(sv) = arg;				\
	    BSET_OBJ_STOREX(sv);			\
	} STMT_END

#define BSET_newop(o, arg)	NewOpSz(666, o, arg)
#define BSET_newopx(o, arg) STMT_START {	\
	register int sz = arg & 0x7f;		\
	register OP* newop;			\
	BSET_newop(newop, sz);			\
	/* newop->op_next = o; XXX */		\
	o = newop;				\
	arg >>=7;				\
	BSET_op_type(o, arg);			\
	BSET_OBJ_STOREX(o);			\
    } STMT_END

#define BSET_newopn(o, arg) STMT_START {	\
	OP *oldop = o;				\
	BSET_newop(o, arg);			\
	oldop->op_next = o;			\
    } STMT_END

#define BSET_ret(foo) STMT_START {		\
	Safefree(bstate->bs_obj_list);		\
	return 0;				\
    } STMT_END

#define BSET_op_pmstashpv(op, arg)	PmopSTASHPV_set(op, arg)

/* 
 * stolen from toke.c: better if that was a function.
 * in toke.c there are also #ifdefs for dosish systems and i/o layers
 */

#if defined(HAS_FCNTL) && defined(F_SETFD)
#define set_clonex(fp)				\
	STMT_START {				\
	    int fd = PerlIO_fileno(fp);		\
	    fcntl(fd,F_SETFD,fd >= 3);		\
	} STMT_END
#else
#define set_clonex(fp)
#endif

#define BSET_data(dummy,arg)						\
    STMT_START {							\
	GV *gv;								\
	char *pname = "main";						\
	if (arg == 'D')							\
	    pname = HvNAME(PL_curstash ? PL_curstash : PL_defstash);	\
	gv = gv_fetchpv(Perl_form(aTHX_ "%s::DATA", pname), TRUE, SVt_PVIO);\
	GvMULTI_on(gv);							\
	if (!GvIO(gv))							\
	    GvIOp(gv) = newIO();					\
	IoIFP(GvIOp(gv)) = PL_rsfp;					\
	set_clonex(PL_rsfp);						\
	/* Mark this internal pseudo-handle as clean */			\
	IoFLAGS(GvIOp(gv)) |= IOf_UNTAINT;				\
	if (PL_preprocess)						\
	    IoTYPE(GvIOp(gv)) = IoTYPE_PIPE;				\
	else if ((PerlIO*)PL_rsfp == PerlIO_stdin())			\
	    IoTYPE(GvIOp(gv)) = IoTYPE_STD;				\
	else								\
	    IoTYPE(GvIOp(gv)) = IoTYPE_RDONLY;				\
	Safefree(bstate->bs_obj_list);					\
	return 1;							\
    } STMT_END

/* stolen from op.c */
#define BSET_load_glob(foo, gv)						\
    STMT_START {							\
        GV *glob_gv;							\
        ENTER;								\
        Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT,			\
                newSVpvn("File::Glob", 10), Nullsv, Nullsv, Nullsv);	\
        glob_gv = gv_fetchpv("File::Glob::csh_glob", FALSE, SVt_PVCV);	\
        GvCV(gv) = GvCV(glob_gv);					\
        SvREFCNT_inc((SV*)GvCV(gv));					\
        GvIMPORTED_CV_on(gv);						\
        LEAVE;								\
    } STMT_END

/*
 * 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) Perl_croak(aTHX_ "op_ppaddr not yet implemented")
#define BSET_curpad(pad, arg) STMT_START {	\
	PL_comppad = (AV *)arg;			\
	pad = AvARRAY(arg);			\
    } STMT_END

#ifdef USE_ITHREADS
#define BSET_cop_file(cop, arg)		CopFILE_set(cop,arg)
#define BSET_cop_stashpv(cop, arg)	CopSTASHPV_set(cop,arg)
#else
/* this works now that Sarathy's changed the CopFILE_set macro to do the SvREFCNT_inc()
	-- BKS 6-2-2000 */
/* that really meant the actual CopFILEGV_set */
#define BSET_cop_filegv(cop, arg)	CopFILEGV_set(cop,arg)
#define BSET_cop_stash(cop,arg)		CopSTASH_set(cop,(HV*)arg)
#endif

/* 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);			\
            if (!PL_beginav)				\
                PL_beginav = newAV();			\
            av_push(PL_beginav, (SV*)cv);		\
	    GvCV(CvGV(cv)) = 0;               /* cv has been hijacked */\
            call_list(oldscope, PL_beginav);		\
            PL_curcop = &PL_compiling;			\
            PL_compiling.op_private = (U8)(PL_hints & HINT_PRIVATE_MASK);\
            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(aTHX_ bstate, obj, (I32)ix) : \
	 (bstate->bs_obj_list[ix] = obj),	\
	 bstate->bs_ix = ix+1)
#define BSET_OBJ_STOREX(obj)			\
	(bstate->bs_ix > bstate->bs_obj_list_fill ?	\
	 bset_obj_store(aTHX_ bstate, obj, bstate->bs_ix) : \
	 (bstate->bs_obj_list[bstate->bs_ix] = obj),	\
	 bstate->bs_ix++)

#define BSET_signal(cv, name)						\
	mg_set(*hv_store(GvHV(gv_fetchpv("SIG", TRUE, SVt_PVHV)),	\
		name, strlen(name), cv, 0))

#define BSET_xhv_name(hv, name)	hv_name_set((HV*)hv, name, strlen(name), 0)

/* 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 'use 5.006_001' 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");		\
	    }							\
	} STMT_END

--- NEW FILE: byterun.c ---
/* -*- buffer-read-only: t -*-
 *
 *      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.
 */

#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#define NO_XSLOCKS
#include "XSUB.h"

#include "byterun.h"
[...1094 lines suppressed...]
		BGET_strconst(arg);
		BSET_signal(bstate->bs_sv, arg);
		break;
	    }
	  case INSN_FORMFEED:		/* 150 */
	    {
		svindex arg;
		BGET_svindex(arg);
		PL_formfeed = arg;
		break;
	    }
	  default:
	    Perl_croak(aTHX_ "Illegal bytecode instruction %d\n", insn);
	    /* NOTREACHED */
	}
    }
    return 0;
}

/* ex: set ro: */

--- NEW FILE: byterun.h ---
/* -*- buffer-read-only: t -*-
 *
 *      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 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;
    int				bs_ix;
    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 int byterun(pTHX_ struct byteloader_state *);

enum {
    INSN_RET,			/* 0 */
    INSN_LDSV,			/* 1 */
    INSN_LDOP,			/* 2 */
    INSN_STSV,			/* 3 */
    INSN_STOP,			/* 4 */
    INSN_STPV,			/* 5 */
    INSN_LDSPECSV,			/* 6 */
    INSN_LDSPECSVX,			/* 7 */
    INSN_NEWSV,			/* 8 */
    INSN_NEWSVX,			/* 9 */
    INSN_NOP,			/* 10 */
    INSN_NEWOP,			/* 11 */
    INSN_NEWOPX,			/* 12 */
    INSN_NEWOPN,			/* 13 */
    INSN_NEWPV,			/* 14 */
    INSN_PV_CUR,			/* 15 */
    INSN_PV_FREE,			/* 16 */
    INSN_SV_UPGRADE,			/* 17 */
    INSN_SV_REFCNT,			/* 18 */
    INSN_SV_REFCNT_ADD,			/* 19 */
    INSN_SV_FLAGS,			/* 20 */
    INSN_XRV,			/* 21 */
    INSN_XPV,			/* 22 */
    INSN_XPV_CUR,			/* 23 */
    INSN_XPV_LEN,			/* 24 */
    INSN_XIV,			/* 25 */
    INSN_XNV,			/* 26 */
    INSN_XLV_TARGOFF,			/* 27 */
    INSN_XLV_TARGLEN,			/* 28 */
    INSN_XLV_TARG,			/* 29 */
    INSN_XLV_TYPE,			/* 30 */
    INSN_XBM_USEFUL,			/* 31 */
    INSN_XBM_PREVIOUS,			/* 32 */
    INSN_XBM_RARE,			/* 33 */
    INSN_XFM_LINES,			/* 34 */
    INSN_COMMENT,			/* 35 */
    INSN_XIO_LINES,			/* 36 */
    INSN_XIO_PAGE,			/* 37 */
    INSN_XIO_PAGE_LEN,			/* 38 */
    INSN_XIO_LINES_LEFT,			/* 39 */
    INSN_XIO_TOP_NAME,			/* 40 */
    INSN_XIO_TOP_GV,			/* 41 */
    INSN_XIO_FMT_NAME,			/* 42 */
    INSN_XIO_FMT_GV,			/* 43 */
    INSN_XIO_BOTTOM_NAME,			/* 44 */
    INSN_XIO_BOTTOM_GV,			/* 45 */
    INSN_XIO_SUBPROCESS,			/* 46 */
    INSN_XIO_TYPE,			/* 47 */
    INSN_XIO_FLAGS,			/* 48 */
    INSN_XCV_XSUBANY,			/* 49 */
    INSN_XCV_STASH,			/* 50 */
    INSN_XCV_START,			/* 51 */
    INSN_XCV_ROOT,			/* 52 */
    INSN_XCV_GV,			/* 53 */
    INSN_XCV_FILE,			/* 54 */
    INSN_XCV_DEPTH,			/* 55 */
    INSN_XCV_PADLIST,			/* 56 */
    INSN_XCV_OUTSIDE,			/* 57 */
    INSN_XCV_OUTSIDE_SEQ,			/* 58 */
    INSN_XCV_FLAGS,			/* 59 */
    INSN_AV_EXTEND,			/* 60 */
    INSN_AV_PUSHX,			/* 61 */
    INSN_AV_PUSH,			/* 62 */
    INSN_XAV_FILL,			/* 63 */
    INSN_XAV_MAX,			/* 64 */
    INSN_XAV_FLAGS,			/* 65 */
    INSN_XHV_RITER,			/* 66 */
    INSN_XHV_NAME,			/* 67 */
    INSN_XHV_PMROOT,			/* 68 */
    INSN_HV_STORE,			/* 69 */
    INSN_SV_MAGIC,			/* 70 */
    INSN_MG_OBJ,			/* 71 */
    INSN_MG_PRIVATE,			/* 72 */
    INSN_MG_FLAGS,			/* 73 */
    INSN_MG_NAME,			/* 74 */
    INSN_MG_NAMEX,			/* 75 */
    INSN_XMG_STASH,			/* 76 */
    INSN_GV_FETCHPV,			/* 77 */
    INSN_GV_FETCHPVX,			/* 78 */
    INSN_GV_STASHPV,			/* 79 */
    INSN_GV_STASHPVX,			/* 80 */
    INSN_GP_SV,			/* 81 */
    INSN_GP_REFCNT,			/* 82 */
    INSN_GP_REFCNT_ADD,			/* 83 */
    INSN_GP_AV,			/* 84 */
    INSN_GP_HV,			/* 85 */
    INSN_GP_CV,			/* 86 */
    INSN_GP_FILE,			/* 87 */
    INSN_GP_IO,			/* 88 */
    INSN_GP_FORM,			/* 89 */
    INSN_GP_CVGEN,			/* 90 */
    INSN_GP_LINE,			/* 91 */
    INSN_GP_SHARE,			/* 92 */
    INSN_XGV_FLAGS,			/* 93 */
    INSN_OP_NEXT,			/* 94 */
    INSN_OP_SIBLING,			/* 95 */
    INSN_OP_PPADDR,			/* 96 */
    INSN_OP_TARG,			/* 97 */
    INSN_OP_TYPE,			/* 98 */
    INSN_OP_SEQ,			/* 99 */
    INSN_OP_FLAGS,			/* 100 */
    INSN_OP_PRIVATE,			/* 101 */
    INSN_OP_FIRST,			/* 102 */
    INSN_OP_LAST,			/* 103 */
    INSN_OP_OTHER,			/* 104 */
    INSN_OP_PMREPLROOT,			/* 105 */
    INSN_OP_PMREPLSTART,			/* 106 */
    INSN_OP_PMNEXT,			/* 107 */
    INSN_OP_PMSTASHPV,			/* 108 */
    INSN_OP_PMREPLROOTPO,			/* 109 */
    INSN_OP_PMSTASH,			/* 110 */
    INSN_OP_PMREPLROOTGV,			/* 111 */
    INSN_PREGCOMP,			/* 112 */
    INSN_OP_PMFLAGS,			/* 113 */
    INSN_OP_PMPERMFLAGS,			/* 114 */
    INSN_OP_PMDYNFLAGS,			/* 115 */
    INSN_OP_SV,			/* 116 */
    INSN_OP_PADIX,			/* 117 */
    INSN_OP_PV,			/* 118 */
    INSN_OP_PV_TR,			/* 119 */
    INSN_OP_REDOOP,			/* 120 */
    INSN_OP_NEXTOP,			/* 121 */
    INSN_OP_LASTOP,			/* 122 */
    INSN_COP_LABEL,			/* 123 */
    INSN_COP_STASHPV,			/* 124 */
    INSN_COP_FILE,			/* 125 */
    INSN_COP_STASH,			/* 126 */
    INSN_COP_FILEGV,			/* 127 */
    INSN_COP_SEQ,			/* 128 */
    INSN_COP_ARYBASE,			/* 129 */
    INSN_COP_LINE,			/* 130 */
    INSN_COP_IO,			/* 131 */
    INSN_COP_WARNINGS,			/* 132 */
    INSN_MAIN_START,			/* 133 */
    INSN_MAIN_ROOT,			/* 134 */
    INSN_MAIN_CV,			/* 135 */
    INSN_CURPAD,			/* 136 */
    INSN_PUSH_BEGIN,			/* 137 */
    INSN_PUSH_INIT,			/* 138 */
    INSN_PUSH_END,			/* 139 */
    INSN_CURSTASH,			/* 140 */
    INSN_DEFSTASH,			/* 141 */
    INSN_DATA,			/* 142 */
    INSN_INCAV,			/* 143 */
    INSN_LOAD_GLOB,			/* 144 */
    INSN_REGEX_PADAV,			/* 145 */
    INSN_DOWARN,			/* 146 */
    INSN_COMPPAD_NAME,			/* 147 */
    INSN_XGV_STASH,			/* 148 */
    INSN_SIGNAL,			/* 149 */
    INSN_FORMFEED,			/* 150 */
    MAX_INSN = 150
};

enum {
    OPt_OP,		/* 0 */
    OPt_UNOP,		/* 1 */
    OPt_BINOP,		/* 2 */
    OPt_LOGOP,		/* 3 */
    OPt_LISTOP,		/* 4 */
    OPt_PMOP,		/* 5 */
    OPt_SVOP,		/* 6 */
    OPt_PADOP,		/* 7 */
    OPt_PVOP,		/* 8 */
    OPt_LOOP,		/* 9 */
    OPt_COP		/* 10 */
};

/* ex: set ro: */

--- NEW FILE: Makefile.PL ---
use ExtUtils::MakeMaker;

WriteMakefile(
    NAME		=> 'ByteLoader',
    VERSION_FROM	=> 'ByteLoader.pm',
    XSPROTOARG		=> '-noprototypes',
    MAN3PODS		=> {},     # Pods will be built by installman.
    OBJECT		=> 'byterun$(OBJ_EXT) ByteLoader$(OBJ_EXT)',
);




More information about the dslinux-commit mailing list