Skip to content

NCG: Don't double adjust SP before calls on Windows.

Windows ABI requires callers to allocate 32 byte of space in the parameter stack space. This should be rolled into the stack adjustment for

Currently we generate this code:

	subq $8,%rsp   # for stack alignment?
	movq %r13,%rcx # Arg1
	movq %rbx,%rdx # Arg2
	subq $32,%rsp  # Reserve "shadow" space + align stack if required
	xorl %eax,%eax # Not required for windows, even on linux only for vararg functions
	call newCAF

	addq $40,%rsp
	testq %rax,%rax
	je _c9N5

Ideally this should become

	movq %r13,%rcx # Arg1
	movq %rbx,%rdx # Arg2
	subq $40,%rsp  # Reserve "shadow" space
	xorl %eax,%eax
	call newCAF

	addq $40,%rsp
	testq %rax,%rax
	je _c9N5

I haven't looked deeper into this and don't plan in the near future.

But if anyone is interested I'm willing to lend a hand.

Trac metadata
Trac field Value
Version 8.6.3
Type Task
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component Compiler (CodeGen)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information