[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] e062ce: thunkEntry type should be long long on Win64

GitHub noreply at github.com
Sun Aug 28 20:57:09 UTC 2016


  Branch: refs/heads/LLP64_v2
  Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
  Commit: e062cead7ce08161d15d215b4563c355ed62f1da
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/e062cead7ce08161d15d215b4563c355ed62f1da
  Author: nicolas-cellier-aka-nice <nicolas.cellier.aka.nice at gmail.com>
  Date:   2016-08-28 (Sun, 28 Aug 2016)

  Changed paths:
    M platforms/Cross/plugins/IA32ABI/ia32abi.h
    M platforms/Cross/plugins/IA32ABI/x64win64ia32abicc.c

  Log Message:
  -----------
  thunkEntry type should be long long on Win64


  Commit: 91569469c31e3358e155c47cd78fe4b98b8929d9
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/91569469c31e3358e155c47cd78fe4b98b8929d9
  Author: nicolas-cellier-aka-nice <nicolas.cellier.aka.nice at gmail.com>
  Date:   2016-08-28 (Sun, 28 Aug 2016)

  Changed paths:
    M platforms/Cross/plugins/IA32ABI/x64win64ia32abicc.c
    M platforms/Cross/plugins/IA32ABI/x64win64stub.c

  Log Message:
  -----------
  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


Compare: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/58aa5c0cd554...91569469c31e


More information about the Vm-dev mailing list