Add cross-32/64 bit and deterministic bytecode generation.
Contributed by Peter Cawley. #993 #1008
This commit is contained in:
@@ -281,8 +281,11 @@ static void bcread_knum(LexState *ls, GCproto *pt, MSize sizekn)
|
||||
static void bcread_bytecode(LexState *ls, GCproto *pt, MSize sizebc)
|
||||
{
|
||||
BCIns *bc = proto_bc(pt);
|
||||
bc[0] = BCINS_AD((pt->flags & PROTO_VARARG) ? BC_FUNCV : BC_FUNCF,
|
||||
pt->framesize, 0);
|
||||
BCIns op;
|
||||
if (ls->fr2 != LJ_FR2) op = BC_NOT; /* Mark non-native prototype. */
|
||||
else if ((pt->flags & PROTO_VARARG)) op = BC_FUNCV;
|
||||
else op = BC_FUNCF;
|
||||
bc[0] = BCINS_AD(op, pt->framesize, 0);
|
||||
bcread_block(ls, bc+1, (sizebc-1)*(MSize)sizeof(BCIns));
|
||||
/* Swap bytecode instructions if the endianess differs. */
|
||||
if (bcread_swap(ls)) {
|
||||
@@ -395,7 +398,7 @@ static int bcread_header(LexState *ls)
|
||||
bcread_byte(ls) != BCDUMP_VERSION) return 0;
|
||||
bcread_flags(ls) = flags = bcread_uleb128(ls);
|
||||
if ((flags & ~(BCDUMP_F_KNOWN)) != 0) return 0;
|
||||
if ((flags & BCDUMP_F_FR2) != LJ_FR2*BCDUMP_F_FR2) return 0;
|
||||
if ((flags & BCDUMP_F_FR2) != (uint32_t)ls->fr2*BCDUMP_F_FR2) return 0;
|
||||
if ((flags & BCDUMP_F_FFI)) {
|
||||
#if LJ_HASFFI
|
||||
lua_State *L = ls->L;
|
||||
|
||||
Reference in New Issue
Block a user