|
|
|
@ -362,7 +362,7 @@ u16 GetMaxUsedSlotPlusOne (IM3Compilation o)
|
|
|
|
|
|
|
|
|
|
o->slotMaxAllocatedIndexPlusOne--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ifdef DEBUG
|
|
|
|
|
u16 maxSlot = o->slotMaxAllocatedIndexPlusOne;
|
|
|
|
|
while (maxSlot < d_m3MaxFunctionSlots)
|
|
|
|
@ -465,8 +465,8 @@ M3Result Push (IM3Compilation o, u8 i_type, u16 i_slot)
|
|
|
|
|
u32 regSelect = IsFpRegisterSlotAlias (i_slot);
|
|
|
|
|
AllocateRegister (o, regSelect, stackIndex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (d_m3LogWasmStack) dump_type_stack (o);
|
|
|
|
|
|
|
|
|
|
if (d_m3LogWasmStack) dump_type_stack (o);
|
|
|
|
|
}
|
|
|
|
|
else result = m3Err_functionStackOverflow;
|
|
|
|
|
|
|
|
|
@ -1062,7 +1062,8 @@ _ (CopyStackIndexToSlot (o, returnSlot, stackTop--));
|
|
|
|
|
_ (Pop (o));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_catch: return result;
|
|
|
|
|
|
|
|
|
|
_catch: return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1482,7 +1483,7 @@ _ (GetBlockScope (o, & scope, target));
|
|
|
|
|
|
|
|
|
|
// create a ContinueLoop operation on a fresh page
|
|
|
|
|
_ (AcquireCompilationCodePage (o, & continueOpPage));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pc_t startPC = GetPagePC (continueOpPage);
|
|
|
|
|
IM3CodePage savedPage = o->page;
|
|
|
|
|
o->page = continueOpPage;
|
|
|
|
@ -1514,7 +1515,7 @@ _ (EmitPatchingBranch (o, scope));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ReleaseCompilationCodePage (o); // FIX: continueOpPage can get lost if thrown
|
|
|
|
|
o->page = savedPage;
|
|
|
|
|
|
|
|
|
@ -2367,7 +2368,7 @@ const M3OpInfo c_operations [] =
|
|
|
|
|
|
|
|
|
|
d_m3DebugOp (CopySlot_32), d_m3DebugOp (PreserveCopySlot_32), d_m3DebugOp (If_s), d_m3DebugOp (BranchIfPrologue_s),
|
|
|
|
|
d_m3DebugOp (CopySlot_64), d_m3DebugOp (PreserveCopySlot_64), d_m3DebugOp (If_r), d_m3DebugOp (BranchIfPrologue_r),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
d_m3DebugOp (Select_i32_rss), d_m3DebugOp (Select_i32_srs), d_m3DebugOp (Select_i32_ssr), d_m3DebugOp (Select_i32_sss),
|
|
|
|
|
d_m3DebugOp (Select_i64_rss), d_m3DebugOp (Select_i64_srs), d_m3DebugOp (Select_i64_ssr), d_m3DebugOp (Select_i64_sss),
|
|
|
|
|
|
|
|
|
@ -2744,7 +2745,7 @@ _ (CompileLocals (o));
|
|
|
|
|
_ (ReserveConstants (o));
|
|
|
|
|
|
|
|
|
|
// start tracking the max stack used (Push() also updates this value) so that op_Entry can precisely detect stack overflow
|
|
|
|
|
o->function->maxStackSlots = o->slotMaxAllocatedIndexPlusOne = o->slotFirstDynamicIndex;
|
|
|
|
|
o->maxStackSlots = o->slotMaxAllocatedIndexPlusOne = o->slotFirstDynamicIndex;
|
|
|
|
|
|
|
|
|
|
o->block.blockStackIndex = o->stackFirstDynamicIndex = o->stackIndex; m3log (compile, "start stack index: %d",
|
|
|
|
|
(u32) o->stackFirstDynamicIndex);
|
|
|
|
@ -2757,6 +2758,7 @@ _ (CompileBlockStatements (o));
|
|
|
|
|
_throwif(m3Err_wasmMalformed, o->previousOpcode != c_waOp_end);
|
|
|
|
|
|
|
|
|
|
io_function->compiled = pc;
|
|
|
|
|
io_function->maxStackSlots = o->maxStackSlots;
|
|
|
|
|
|
|
|
|
|
u16 numConstantSlots = o->slotMaxConstIndex - o->slotFirstConstIndex; m3log (compile, "unique constant slots: %d; unused slots: %d",
|
|
|
|
|
numConstantSlots, o->slotFirstDynamicIndex - o->slotMaxConstIndex);
|
|
|
|
|