fix PreserveArgsAndLocals bug (#175)

extensions
coderzh 4 years ago committed by GitHub
parent 0f599517ae
commit 273815dfea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1532,17 +1532,18 @@ M3Result PreserveArgsAndLocals (IM3Compilation o)
for (u32 i = 0; i < numArgsAndLocals; ++i)
{
u16 localSlot = GetSlotForStackIndex (o, i);
u16 preservedSlotIndex;
_ (FindReferencedLocalWithinCurrentBlock (o, & preservedSlotIndex, i));
_ (FindReferencedLocalWithinCurrentBlock (o, & preservedSlotIndex, localSlot));
if (preservedSlotIndex != i)
if (preservedSlotIndex != localSlot)
{
u8 type = GetStackBottomType (o, i);
IM3Operation op = Is64BitType (type) ? op_CopySlot_64 : op_CopySlot_32;
EmitOp (o, op);
EmitSlotOffset (o, preservedSlotIndex);
EmitSlotOffset (o, i);
EmitSlotOffset (o, localSlot);
}
}
}

Loading…
Cancel
Save