multi-value tests passing

extensions
Steven Massey 3 years ago
parent 1aa41b9064
commit 8d0efc2b7a

File diff suppressed because it is too large Load Diff

@ -48,9 +48,9 @@ typedef struct M3CompilationScope
struct M3CompilationScope * outer;
pc_t pc; // used by ContinueLoop's
pc_t patches;
pc_t patches;
i32 depth;
u16 exitStackIndex;
u16 exitStackIndex;
i16 blockStackIndex;
// u16 topSlot;
IM3FuncType type;
@ -81,8 +81,8 @@ typedef struct
u32 numOpcodes;
#endif
u16 stackFirstDynamicIndex; // args and locals are pushed to the stack so that their slot locations can be tracked. the wasm model itself doesn't
// treat these values as being on the stack, so stackFirstDynamicIndex marks the start of the real Wasm stack
u16 stackFirstDynamicIndex; // args and locals are pushed to the stack so that their slot locations can be tracked. the wasm model itself doesn't
// treat these values as being on the stack, so stackFirstDynamicIndex marks the start of the real Wasm stack
u16 stackIndex; // current stack top
u16 slotFirstConstIndex;

@ -156,7 +156,7 @@ M3CodePageHeader;
#define d_m3MemPageSize 65536
#define d_m3Reg0SlotAlias 60000
#define d_m3Fp0SlotAlias 60002
#define d_m3Fp0SlotAlias (d_m3Reg0SlotAlias + 2)
#define d_m3MaxSaneTypesCount 100000
#define d_m3MaxSaneFunctionsCount 100000

@ -89,12 +89,12 @@ void EmitSlotOffset (IM3Compilation o, const i32 i_offset)
pc_t EmitPointer (IM3Compilation o, const void * const i_pointer)
{
pc_t ptr = GetPagePC (o->page);
pc_t ptr = GetPagePC (o->page);
if (o->page)
EmitWord (o->page, i_pointer);
return ptr;
return ptr;
}
void * ReservePointer (IM3Compilation o)

@ -747,9 +747,7 @@ u8 * GetStackPointerForArgs (IM3Function i_function)
u64 * stack = (u64 *) i_function->module->runtime->stack;
IM3FuncType ftype = i_function->funcType;
u16 numReturnSlots = ftype->numRets;
stack += numReturnSlots;
stack += ftype->numRets;
return (u8 *) stack;
}
@ -913,7 +911,7 @@ M3Result m3_GetResults (IM3Function i_function, uint32_t i_retc, const void *
switch (d_FuncRetType(ftype, i)) {
case c_m3Type_i32: *(i32*)o_retptrs[i] = *(i32*)(s); s += 8; break;
case c_m3Type_i64: *(i64*)o_retptrs[i] = *(i64*)(s); s += 8; break;
case c_m3Type_f32: *(f32*)o_retptrs[i] = *(f32*)(s); s += 4; break;
case c_m3Type_f32: *(f32*)o_retptrs[i] = *(f32*)(s); s += 8; break;
case c_m3Type_f64: *(f64*)o_retptrs[i] = *(f64*)(s); s += 8; break;
default: return "unknown return type";
}

@ -28,23 +28,23 @@ bool AreFuncTypesEqual (const IM3FuncType i_typeA, const IM3FuncType i_typeB)
u16 GetFuncTypeNumParams (const IM3FuncType i_funcType)
{
return i_funcType ? i_funcType->numArgs : 0;
return i_funcType ? i_funcType->numArgs : 0;
}
u8 GetFuncTypeParamType (const IM3FuncType i_funcType, u16 i_index)
{
u8 type = c_m3Type_unknown;
u8 type = c_m3Type_unknown;
if (i_funcType)
{
if (i_index < i_funcType->numArgs)
{
type = i_funcType->types [i_funcType->numRets + i_index];
}
}
if (i_funcType)
{
if (i_index < i_funcType->numArgs)
{
type = i_funcType->types [i_funcType->numRets + i_index];
}
}
return type;
return type;
}

@ -30,8 +30,8 @@ typedef M3FuncType * IM3FuncType;
M3Result AllocFuncType (IM3FuncType * o_functionType, u32 i_numTypes);
bool AreFuncTypesEqual (const IM3FuncType i_typeA, const IM3FuncType i_typeB);
u16 GetFuncTypeNumParams (const IM3FuncType i_funcType);
u8 GetFuncTypeParamType (const IM3FuncType i_funcType, u16 i_index);
u16 GetFuncTypeNumParams (const IM3FuncType i_funcType);
u8 GetFuncTypeParamType (const IM3FuncType i_funcType, u16 i_index);
u16 GetFuncTypeNumResults (const IM3FuncType i_funcType);
u8 GetFuncTypeResultType (const IM3FuncType i_funcType, u16 i_index);

@ -358,11 +358,14 @@ void dump_type_stack (IM3Compilation o)
printf ("%s %s ", regAllocated [0] ? "(r0)" : " ", regAllocated [1] ? "(fp0)" : " ");
// printf ("%d", o->stackIndex -)
for (u32 i = o->stackFirstDynamicIndex; i < o->stackIndex; ++i)
for (u32 i = 0; i < o->stackIndex; ++i)
{
if (i == o->block.blockStackIndex)
printf (" |");
if (i > 0 and i == o->stackFirstDynamicIndex)
printf ("]");
if (i == o->block.blockStackIndex)
printf (" |");
printf (" %s", c_waCompactTypes [o->typeStack [i]]);
u16 slot = o->wasmStack [i];

Loading…
Cancel
Save