Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix thunk return value in case of int64 or double for Win64
Note: Win64 X64 uses registry rax for 1,2,4,8 bytes long int or struct return value it uses xmm0 for float (single) or double floating point values it uses a pointer passed as hidden first parameter (rcx) for anything else returned by value and copy the pointer to rax. To pass a double back we use a call to a function taking double & returning double (fakeReturnDouble) Any of these actions (passing 1 double or returning 1 double) would load xmm0, and we're done. Except the function is no-op and could be entirely eliminated by aggressive optimizer. It's thus vital to lay the function into another file and avoid any sort of link time optimization. TO DO: This code currently does nothing for passing a short struct back by value in rax... If the structure is long or odd sized, its address is expected as (hidden) first parameter (rcx), rather than on stack. So the code does not look quite right yet wrt Win64 X64 ABI. TO DO: the same kind of changes should be applied to X64 system V ABI
- Loading branch information