On Mon, 16 Jun 2008, Nicolas Bertolotti wrote:
>> I tried to add an 'ms_abi' toggle in the amd64 codegen, but couldn't
>> figure out where to add instructions for pushing/popping the "shadow
>> space" (32 bytes) as required. I'd appreciate some help here,
>> Matthew. :-) At the moment I only have it working with the C codegen.
>> I'm hoping that using gcc only as an assembler will make the floating
>> point and ICE regressions go away.
>
> I am unfortunately unable to answer it ... and hope someone can.
<src>/mlton/codegen/amd64-codegen/amd64-generate-transfers.fun:1348 has
code to round the C-stack to a 16byte alignment. You could probably
follow that code by something like:
val (setup_args, size_stack_args) =
if convention = CFunction.Convention.MSx64
then (AppendList.append
(setup_args,
AppendList.single
(Assembly.instruction_binal
{oper = Instruction.SUB,
dst = c_stackP,
src = Operand.immediate_int 32,
size = pointerSize})),
size_stack_args + 32)
else (setup_args, size_stack_args)
You might also need to adjust the fixCStack instructions
(<src>/mlton/codegen/amd64-codegen/amd64-generate-transfers.fun:1554) if
the MSx64 ABI requires the caller to pop the C stack.
The portion of Wesley's patch that adjusts the argument registers
depending on the ABI wasn't committed, so you would need to add that as
well.
_______________________________________________
MLton mailing list
MLton@mlton.org
http://mlton.org/mailman/listinfo/mlton