increased d_m3MaxNumFunctionArgs to 31; cleanup

extensions
Steven Massey 5 years ago
parent a6d1ad6d57
commit cef2a38746

@ -331,10 +331,6 @@ M3Result Push (IM3Compilation o, u8 i_m3Type, i16 i_location)
o->function->maxStackSlots = stackIndex;
}
// wasmStack tracks read counts for args & locals. otherwise, wasmStack represents slot location.
if (stackIndex < GetFunctionNumArgsAndLocals (o->function))
i_location = 0;
o->wasmStack [stackIndex] = i_location;
o->typeStack [stackIndex] = i_m3Type;
@ -844,8 +840,6 @@ _ (ReadLEB_u32 (& localSlot, & o->wasm, o->wasmEnd)); // printf (
u16 preserveSlot;
_ (IsLocalReferencedWithCurrentBlock (o, & preserveSlot, localSlot)); // preserve will be different than local, if referenced
// o->wasmStack [localSlot] |= 0x8000;
if (preserveSlot == localSlot)
_ (CopyTopSlot (o, localSlot))
else
@ -2073,10 +2067,6 @@ _ (PushAllocatedSlot (o, type));
_ (CompileLocals (o));
// the stack for args/locals is used to track # of Sets
for (u32 i = 0; i < o->stackIndex; ++i)
o->wasmStack [i] = 0;
_ (Compile_ReserveConstants (o));
// start tracking the max stack used (Push() also updates this value) so that op_Entry can precisely detect stack overflow

@ -90,7 +90,7 @@ typedef struct
u64 constants [d_m3MaxNumFunctionConstants];
// for args/locals this wasmStack tracks write counts. for the dynamic portion of the stack, the array holds slot locations
// 'wasmStack' is unused for args/locals. for the dynamic portion of the stack, 'wasmStack' holds slot locations
u16 wasmStack [d_m3MaxFunctionStackHeight];
u8 typeStack [d_m3MaxFunctionStackHeight];

@ -11,7 +11,7 @@
#include "m3_config_platforms.h"
# ifndef d_m3MaxNumFunctionArgs
# define d_m3MaxNumFunctionArgs 16
# define d_m3MaxNumFunctionArgs 31
# endif
# ifndef d_m3CodePageAlignSize

@ -246,7 +246,6 @@ d_m3OpDef (SetGlobal_i)
}
d_m3OpDef (Loop)
{
m3ret_t r;
@ -306,6 +305,35 @@ d_m3OpDef (BranchTable)
}
#define d_m3SetRegisterSetSlot(TYPE, REG) \
d_m3OpDef (SetRegister_##TYPE) \
{ \
REG = slot (TYPE); \
return nextOp (); \
} \
\
d_m3OpDef (SetSlot_##TYPE) \
{ \
slot (TYPE) = (TYPE) REG; \
return nextOp (); \
} \
\
d_m3OpDef (PreserveSetSlot_##TYPE) \
{ \
TYPE * stack = slot_ptr (TYPE); \
TYPE * preserve = slot_ptr (TYPE); \
\
* preserve = * stack; \
* stack = (TYPE) REG; \
\
return nextOp (); \
}
d_m3SetRegisterSetSlot (i32, _r0)
d_m3SetRegisterSetSlot (i64, _r0)
d_m3SetRegisterSetSlot (f32, _fp0)
d_m3SetRegisterSetSlot (f64, _fp0)
d_m3OpDef (CopySlot_32)
{

@ -65,23 +65,23 @@ d_m3RetSig Call (d_m3OpSig)
#define d_m3CommutativeOpMacro(RES, REG, TYPE, NAME, OP, ...) \
d_m3Op(TYPE##_##NAME##_sr) \
{ \
TYPE * stack = (TYPE *) (_sp + immediate (i32)); \
OP((RES), (* stack), ((TYPE) REG), ##__VA_ARGS__); \
TYPE operand = slot (TYPE); \
OP((RES), operand, ((TYPE) REG), ##__VA_ARGS__); \
return nextOp (); \
} \
d_m3Op(TYPE##_##NAME##_ss) \
{ \
TYPE * stackB = (TYPE *) (_sp + immediate (i32)); \
TYPE * stackA = (TYPE *) (_sp + immediate (i32)); \
OP((RES), (* stackA), (* stackB), ##__VA_ARGS__); \
TYPE operandB = slot (TYPE); \
TYPE operandA = slot (TYPE); \
OP((RES), operandA, operandB, ##__VA_ARGS__); \
return nextOp (); \
}
#define d_m3OpMacro(RES, REG, TYPE, NAME, OP, ...) \
d_m3Op(TYPE##_##NAME##_rs) \
{ \
TYPE * stack = (TYPE *) (_sp + immediate (i32)); \
OP((RES), ((TYPE) REG), (* stack), ##__VA_ARGS__); \
TYPE operand = slot (TYPE); \
OP((RES), ((TYPE) REG), operand, ##__VA_ARGS__); \
return nextOp (); \
} \
d_m3CommutativeOpMacro(RES, REG, TYPE,NAME, OP, ##__VA_ARGS__)
@ -194,8 +194,8 @@ d_m3Op(TYPE##_##NAME##_r) \
} \
d_m3Op(TYPE##_##NAME##_s) \
{ \
TYPE * stack = (TYPE *) (_sp + immediate (i32));\
OP((RES), (* stack), ##__VA_ARGS__); \
TYPE operand = slot (TYPE); \
OP((RES), operand, ##__VA_ARGS__); \
return nextOp (); \
}
@ -656,36 +656,16 @@ d_m3Op (PreserveCopySlot_64)
return nextOp ();
}
#define d_m3SetRegisterSetSlotDecl(TYPE) \
\
d_m3OpDecl (SetRegister_##TYPE) \
d_m3OpDecl (SetSlot_##TYPE) \
d_m3OpDecl (PreserveSetSlot_##TYPE) \
#define d_m3SetRegisterSetSlot(TYPE, REG) \
d_m3Op (SetRegister_##TYPE) \
{ \
REG = slot (TYPE); \
return nextOp (); \
} \
\
d_m3Op (SetSlot_##TYPE) \
{ \
slot (TYPE) = (TYPE) REG; \
return nextOp (); \
} \
\
d_m3Op (PreserveSetSlot_##TYPE) \
{ \
TYPE * stack = slot_ptr (TYPE); \
TYPE * preserve = slot_ptr (TYPE); \
\
* preserve = * stack; \
* stack = (TYPE) REG; \
\
return nextOp (); \
}
d_m3SetRegisterSetSlot (i32, _r0)
d_m3SetRegisterSetSlot (i64, _r0)
d_m3SetRegisterSetSlot (f32, _fp0)
d_m3SetRegisterSetSlot (f64, _fp0)
d_m3SetRegisterSetSlotDecl (i32)
d_m3SetRegisterSetSlotDecl (i64)
d_m3SetRegisterSetSlotDecl (f32)
d_m3SetRegisterSetSlotDecl (f64)
#if defined(d_m3SkipMemoryBoundsCheck)
@ -724,7 +704,7 @@ d_m3Op(DEST_TYPE##_Load_##SRC_TYPE##_r) \
} \
d_m3Op(DEST_TYPE##_Load_##SRC_TYPE##_s) \
{ \
u64 operand = * (u32 *) (_sp + immediate (i32)); \
u64 operand = slot (u32); \
u32 offset = immediate (u32); \
operand += offset; \
\

Loading…
Cancel
Save