-#
-# Boilerplate for byterun.c
-#
-open(BYTERUN_C, ">ext/ByteLoader/byterun.c") or die "ext/ByteLoader/byterun.c: $!";
-print BYTERUN_C $c_header, <<'EOT';
-
-#define PERL_NO_GET_CONTEXT
-#include "EXTERN.h"
-#include "perl.h"
-#define NO_XSLOCKS
-#include "XSUB.h"
-
-#include "byterun.h"
-#include "bytecode.h"
-
-
-static const int optype_size[] = {
-EOT
-my $i = 0;
-for ($i = 0; $i < @optype - 1; $i++) {
- printf BYTERUN_C " sizeof(%s),\n", $optype[$i], $i;
-}
-printf BYTERUN_C " sizeof(%s)\n", $optype[$i], $i;
-print BYTERUN_C <<'EOT';
-};
-
-void *
-bset_obj_store(pTHX_ struct byteloader_state *bstate, void *obj, I32 ix)
-{
- if (ix > bstate->bs_obj_list_fill) {
- Renew(bstate->bs_obj_list, ix + 32, void*);
- bstate->bs_obj_list_fill = ix + 31;
- }
- bstate->bs_obj_list[ix] = obj;
- return obj;
-}
-
-int
-byterun(pTHX_ register struct byteloader_state *bstate)
-{
- 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;
- bstate->bs_obj_list[0] = NULL; /* first is always Null */
-
-EOT
-
-for my $i ( 0 .. $#specialsv ) {
- print BYTERUN_C " specialsv_list[$i] = $specialsv[$i];\n";
-}
-
-print BYTERUN_C <<'EOT';
-
- while ((insn = BGET_FGETC()) != EOF) {
- switch (insn) {
-EOT
-