Browse files

Ignore stdcall c-call in native codegen on x86_64

The stdcall calling convention is not supported on x86_64.
When an ffi import requests stdcall, a warning is issued as
desired by #3336. However, the native codegen was still
generating code that expected the callee to cleanup the
stack arguments when calling a c function that requests

This patch changes the codegen to actually use the ccall
calling convention as intended.
  • Loading branch information...
dmpots committed Oct 20, 2011
1 parent e3b3248 commit 42b052d9c1dc17d74bd6a5c52f8edc226f270531
Showing with 3 additions and 2 deletions.
  1. +3 −2 compiler/nativeGen/X86/CodeGen.hs
@@ -1887,8 +1887,9 @@ genCCall64 target dest_regs args =
let call = callinsns `appOL`
toOL (
-- Deallocate parameters after call for ccall;
- -- but not for stdcall (callee does it)
- (if cconv == StdCallConv || real_size==0 then [] else
+ -- stdcall has callee do it, but is not supported on
+ -- x86_64 target (see #3336)
+ (if real_size==0 then [] else
[ADD (intSize wordWidth) (OpImm (ImmInt real_size)) (OpReg esp)])
[DELTA (delta + real_size)]

0 comments on commit 42b052d

Please sign in to comment.