More bytecode patching from Enache.
[p5sagit/p5-mst-13.2.git] / ext / ByteLoader / bytecode.h
index 8ef6d38..7fb91da 100644 (file)
@@ -20,6 +20,10 @@ typedef char *pvindex;
        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)
@@ -171,10 +175,17 @@ typedef char *pvindex;
 
 
 #define BSET_newsv(sv, arg)                            \
-       STMT_START {                                    \
-           sv = NEWSV(0,0));                           \
-           SvUPGRADE(sv, (arg));                       \
-       } STMT_END
+           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;                          \
@@ -370,8 +381,4 @@ typedef char *pvindex;
            if (sz != PTRSIZE) {                                \
                HEADER_FAIL("different PTRSIZE");               \
            }                                                   \
-           BGET_strconst(str); /* byteorder */                 \
-           if (strNE(str, STRINGIFY(BYTEORDER))) {             \
-               HEADER_FAIL("different byteorder");     \
-           }                                                   \
        } STMT_END