summaryrefslogtreecommitdiff
path: root/ext/ByteLoader
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ByteLoader')
-rw-r--r--ext/ByteLoader/ByteLoader.xs10
-rw-r--r--ext/ByteLoader/bytecode.h2
-rw-r--r--ext/ByteLoader/byterun.c15
-rw-r--r--ext/ByteLoader/byterun.h2
4 files changed, 19 insertions, 10 deletions
diff --git a/ext/ByteLoader/ByteLoader.xs b/ext/ByteLoader/ByteLoader.xs
index 34002f12b2..07f083843e 100644
--- a/ext/ByteLoader/ByteLoader.xs
+++ b/ext/ByteLoader/ByteLoader.xs
@@ -7,17 +7,13 @@ static void
freadpv(U32 len, void *data, XPV *pv)
{
New(666, pv->xpv_pv, len, char);
- fread(pv->xpv_pv, 1, len, (FILE*)data);
+ PerlIO_read((PerlIO*)data, (void*)pv->xpv_pv, len);
pv->xpv_len = len;
pv->xpv_cur = len - 1;
}
static I32
-#ifdef PERL_OBJECT
-byteloader_filter(CPerlObj *pPerl, int idx, SV *buf_sv, int maxlen)
-#else
-byteloader_filter(pTHX_ int idx, SV *buf_sv, int maxlen)
-#endif
+byteloader_filter(pTHXo_ int idx, SV *buf_sv, int maxlen)
{
dTHR;
OP *saveroot = PL_main_root;
@@ -29,7 +25,7 @@ byteloader_filter(pTHX_ int idx, SV *buf_sv, int maxlen)
bs.pfread = (int(*) (char*,size_t,size_t,void*))fread;
bs.pfreadpv = freadpv;
- byterun(bs);
+ byterun(aTHXo_ bs);
if (PL_in_eval) {
OP *o;
diff --git a/ext/ByteLoader/bytecode.h b/ext/ByteLoader/bytecode.h
index 8a59bb1273..9d597fbed2 100644
--- a/ext/ByteLoader/bytecode.h
+++ b/ext/ByteLoader/bytecode.h
@@ -140,4 +140,4 @@ typedef IV IV64;
#define BSET_OBJ_STORE(obj, ix) \
(I32)ix > bytecode_obj_list_fill ? \
- bset_obj_store(obj, (I32)ix) : (bytecode_obj_list[ix] = obj)
+ bset_obj_store(aTHXo_ obj, (I32)ix) : (bytecode_obj_list[ix] = obj)
diff --git a/ext/ByteLoader/byterun.c b/ext/ByteLoader/byterun.c
index e124c23efc..544a59f042 100644
--- a/ext/ByteLoader/byterun.c
+++ b/ext/ByteLoader/byterun.c
@@ -11,9 +11,20 @@
#include "EXTERN.h"
#include "perl.h"
+#define NO_XSLOCKS
+#include "XSUB.h"
+
+#ifdef PERL_OBJECT
+#undef CALL_FPTR
+#define CALL_FPTR(fptr) (pPerl->*fptr)
+#undef PL_ppaddr
+#define PL_ppaddr (*get_ppaddr())
+#endif
+
#include "byterun.h"
#include "bytecode.h"
+
static int optype_size[] = {
sizeof(OP),
sizeof(UNOP),
@@ -38,7 +49,7 @@ static void **bytecode_obj_list;
static I32 bytecode_obj_list_fill = -1;
void *
-bset_obj_store(void *obj, I32 ix)
+bset_obj_store(pTHXo_ void *obj, I32 ix)
{
if (ix > bytecode_obj_list_fill) {
if (bytecode_obj_list_fill == -1)
@@ -52,7 +63,7 @@ bset_obj_store(void *obj, I32 ix)
}
void
-byterun(pTHX_ struct bytestream bs)
+byterun(pTHXo_ struct bytestream bs)
{
dTHR;
int insn;
diff --git a/ext/ByteLoader/byterun.h b/ext/ByteLoader/byterun.h
index 3c5b2343c5..3a0381f3be 100644
--- a/ext/ByteLoader/byterun.h
+++ b/ext/ByteLoader/byterun.h
@@ -173,6 +173,8 @@ EXT int PL_optype_size[]
#endif /* DOINIT */
;
+EXT void byterun(pTHXo_ struct bytestream bs);
+
#define INIT_SPECIALSV_LIST STMT_START { \
PL_specialsv_list[0] = Nullsv; \
PL_specialsv_list[1] = &PL_sv_undef; \