[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] aaa8d3: Retrieve float register parameters of callback thu...

GitHub noreply at github.com
Sun Sep 11 12:03:57 UTC 2016


  Branch: refs/heads/Cog
  Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
  Commit: aaa8d30f31e8e3fa5b1f81729089b322605578d1
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/aaa8d30f31e8e3fa5b1f81729089b322605578d1
  Author: nicolas-cellier-aka-nice <nicolas.cellier.aka.nice at gmail.com>
  Date:   2016-09-11 (Sun, 11 Sep 2016)

  Changed paths:
    M platforms/Cross/plugins/IA32ABI/x64win64ia32abicc.c
    A platforms/Cross/plugins/IA32ABI/x64win64stub.c
    M platforms/win32/plugins/IA32ABI/Makefile
    M platforms/win32/plugins/IA32ABI/Makefile.plugin

  Log Message:
  -----------
  Retrieve float register parameters of callback thunk for Win64

Note: the float registers are retrieved via a function saveFloatRegsWin64 which must lie into another file
otherwise C Compiler will detect the parameter mismatch and bark, or worse, optimize the call away.

Previously, we did copy the integer param registers into the floating point param registers.
This was wrong, the caller has no such hack.


  Commit: 5b17a270a99e8e71bbc1310e1098501b083d1662
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/5b17a270a99e8e71bbc1310e1098501b083d1662
  Author: nicolas-cellier-aka-nice <nicolas.cellier.aka.nice at gmail.com>
  Date:   2016-09-11 (Sun, 11 Sep 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: ddf2aa41f18c578a3bc8edda5cd74dd42e5890e3
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/ddf2aa41f18c578a3bc8edda5cd74dd42e5890e3
  Author: nicolas-cellier-aka-nice <nicolas.cellier.aka.nice at gmail.com>
  Date:   2016-09-11 (Sun, 11 Sep 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/92e9af6566ef...ddf2aa41f18c


More information about the Vm-dev mailing list