Merge branch 'main' of https://github.com/wasm3/wasm3 into main

extensions
Volodymyr Shymanskyy 3 years ago
commit 307265ae5e

@ -352,6 +352,15 @@ u16 GetMaxUsedSlotPlusOne (IM3Compilation o)
o->slotMaxAllocatedIndexPlusOne--; o->slotMaxAllocatedIndexPlusOne--;
} }
# ifdef DEBUG
u16 maxSlot = o->slotMaxAllocatedIndexPlusOne;
while (maxSlot < d_m3MaxFunctionSlots)
{
d_m3Assert (o->m3Slots [maxSlot] == 0);
maxSlot++;
}
# endif
return o->slotMaxAllocatedIndexPlusOne; return o->slotMaxAllocatedIndexPlusOne;
} }

@ -334,7 +334,7 @@ void dump_type_stack (IM3Compilation o)
i32 regAllocated [2] = { (i32) IsRegisterAllocated (o, 0), (i32) IsRegisterAllocated (o, 1) }; i32 regAllocated [2] = { (i32) IsRegisterAllocated (o, 0), (i32) IsRegisterAllocated (o, 1) };
// display whether r0 or fp0 is allocated. these should then also be reflected somewhere in the stack too. // display whether r0 or fp0 is allocated. these should then also be reflected somewhere in the stack too.
d_m3Log(stack, "\n"); d_m3Log(stack, "\n");
d_m3Log(stack, " "); d_m3Log(stack, " ");
printf ("%s %s ", regAllocated [0] ? "(r0)" : " ", regAllocated [1] ? "(fp0)" : " "); printf ("%s %s ", regAllocated [0] ? "(r0)" : " ", regAllocated [1] ? "(fp0)" : " ");
@ -373,33 +373,33 @@ void dump_type_stack (IM3Compilation o)
for (u32 r = 0; r < 2; ++r) for (u32 r = 0; r < 2; ++r)
d_m3Assert (regAllocated [r] == 0); // reg allocation & stack out of sync d_m3Assert (regAllocated [r] == 0); // reg allocation & stack out of sync
u16 maxSlot = GetMaxUsedSlotPlusOne (o); u16 maxSlot = GetMaxUsedSlotPlusOne (o);
if (maxSlot > o->slotFirstDynamicIndex) if (maxSlot > o->slotFirstDynamicIndex)
{ {
d_m3Log (stack, " -"); d_m3Log (stack, " -");
for (u16 i = o->slotFirstDynamicIndex; i < maxSlot; ++i) for (u16 i = o->slotFirstDynamicIndex; i < maxSlot; ++i)
printf ("----"); printf ("----");
printf ("\n"); printf ("\n");
d_m3Log (stack, " slot |"); d_m3Log (stack, " slot |");
for (u16 i = o->slotFirstDynamicIndex; i < maxSlot; ++i) for (u16 i = o->slotFirstDynamicIndex; i < maxSlot; ++i)
printf ("%3d|", i); printf ("%3d|", i);
printf ("\n"); printf ("\n");
d_m3Log (stack, " alloc |"); d_m3Log (stack, " alloc |");
for (u16 i = o->slotFirstDynamicIndex; i < maxSlot; ++i) for (u16 i = o->slotFirstDynamicIndex; i < maxSlot; ++i)
{ {
printf ("%3d|", o->m3Slots [i]); printf ("%3d|", o->m3Slots [i]);
} }
printf ("\n"); printf ("\n");
} }
d_m3Log(stack, "\n"); d_m3Log(stack, "\n");
} }

Loading…
Cancel
Save