[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] 6653d1: CogVM source as per VMMaker.oscog-eem.2039

GitHub noreply at github.com
Wed Dec 14 23:54:39 UTC 2016


  Branch: refs/heads/Cog
  Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
  Commit: 6653d19a0ebd0d05e8cfc5d7bb0fcc80f5d81f98
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/6653d19a0ebd0d05e8cfc5d7bb0fcc80f5d81f98
  Author: Eliot Miranda <eliot.miranda at gmail.com>
  Date:   2016-12-14 (Wed, 14 Dec 2016)

  Changed paths:
    M nsspur64src/vm/cogitX64.c
    M nsspur64src/vm/cointerp.c
    M nsspur64src/vm/cointerp.h
    M nsspur64src/vm/gcc3x-cointerp.c
    M nsspursrc/vm/cogitARMv5.c
    M nsspursrc/vm/cogitIA32.c
    M nsspursrc/vm/cogitMIPSEL.c
    M nsspursrc/vm/cointerp.c
    M nsspursrc/vm/cointerp.h
    M nsspursrc/vm/gcc3x-cointerp.c
    M nsspurstack64src/vm/gcc3x-interp.c
    M nsspurstack64src/vm/interp.c
    M nsspurstacksrc/vm/gcc3x-interp.c
    M nsspurstacksrc/vm/interp.c
    M spur64src/vm/cogitX64.c
    M spur64src/vm/cointerp.c
    M spur64src/vm/cointerp.h
    M spur64src/vm/gcc3x-cointerp.c
    M spursista64src/vm/cogitX64.c
    M spursista64src/vm/cointerp.c
    M spursista64src/vm/cointerp.h
    M spursista64src/vm/gcc3x-cointerp.c
    M spursistasrc/vm/cogitARMv5.c
    M spursistasrc/vm/cogitIA32.c
    M spursistasrc/vm/cogitMIPSEL.c
    M spursistasrc/vm/cointerp.c
    M spursistasrc/vm/cointerp.h
    M spursistasrc/vm/gcc3x-cointerp.c
    M spursrc/vm/cogitARMv5.c
    M spursrc/vm/cogitIA32.c
    M spursrc/vm/cogitMIPSEL.c
    M spursrc/vm/cointerp.c
    M spursrc/vm/cointerp.h
    M spursrc/vm/gcc3x-cointerp.c
    M spurstack64src/vm/gcc3x-interp.c
    M spurstack64src/vm/interp.c
    M spurstacksrc/vm/gcc3x-interp.c
    M spurstacksrc/vm/interp.c
    M src/plugins/SqueakFFIPrims/ARM32FFIPlugin.c
    M src/plugins/SqueakFFIPrims/IA32FFIPlugin.c
    M src/plugins/SqueakFFIPrims/X64SysVFFIPlugin.c
    M src/plugins/SqueakFFIPrims/X64Win64FFIPlugin.c
    M src/vm/cogitARMv5.c
    M src/vm/cogitIA32.c
    M src/vm/cogitMIPSEL.c
    M src/vm/cointerp.c
    M src/vm/cointerp.h
    M src/vm/cointerpmt.c
    M src/vm/cointerpmt.h
    M src/vm/gcc3x-cointerp.c
    M src/vm/gcc3x-cointerpmt.c
    M stacksrc/vm/gcc3x-interp.c
    M stacksrc/vm/interp.c

  Log Message:
  -----------
  CogVM source as per VMMaker.oscog-eem.2039

ThreadedFFIPlugin (the FFI plugin)
Fix callout failures for callouts that invoke callbacks.  The VM checks that
interpreter primitive calls (including external calls) have correctly-balanced
stacks on return.  The ThreadedFFIPlugin (and indeed the old FFIPlugin) would use
argumentCount to compute the stack on return, but a callback can alter
argumentCount to arbitrary values, and callback return can't easily determine the
value of argumentCount to restore (especially in a threaded context).  So the
plugin must remember the argumentCount before it calls out and should use this
cached value in restoring the stack.  To this end, remove all uses of
methodReturnValue: in the support code for th ecallouts and use pop:thenPush: in
ffiCall:ArgArrayOrNil:NumArgs: to update the stack correctly.

Streamline the callouts in the plugin to eliminate an extra test on the return
type being float.  Neaten the code for (dis)owning the VM.

Revise ALLOCA_LIES_SO_USE_GET_SP

The extra space allocated below the value returned by alloca() is used by mingw32
gcc (it is used for marshalling args of sub-functions - those who marshall ffi
call args) So we cannot use it for marshalling FFI arguments.

Thus we must change the strategy:
rather than using getsp() for changing the value returned by alloca() before
marshalling args (which will lead to SEGV) we must rather use setsp() for
changing the stack pointer before calling the target function.

Thus we rename the macro into ALLOCA_LIES_SO_SET_SP_BEFORE_CALL

Remind that __clang__'s alloca does not lie. (clang compiler does define __GNUC__)

---

Revise FFI stack alignment:

1) use STACK_BYTES_ALIGNMENT and getsp() as provided by include file
   sqCogStackAlignment.h
2) use a new macro MUST_ALIGN_STACK that check STACK_BYTES_ALIGNMENT against
   sizeof(void *).  Indeed, some nice STACK_BYTES_ALIGNMENT might be > 0 now,
   which does not necessarily mean that we must realign the stack.
   This macro is used both for aligning alloca'ed space before marshalling and
   for aligning SP before call.

It is still questionable whether we must do some further alignment over alloca(),
because alloca() should be aware of ABI requirements, but if it ain't broken...

---

nuke STACK_OFFSET_BYTES from the preamble since it is unused.

---

get rid of registerArgsSlop
It was intended for reserving stack space for shadowing register args as mandated
by Win64 X64 ABI (and maybe PPC).  But this is completely unecessary as this stack
space will be reserved by the callout itself (at least on WIN64).  For PPC, don't
do anything, it's currently unsupported (unmaintained/untested/unnecessary)

---

Let cogit generate remove float args from stack only if more than 0 float args
(by symmetry with int args).  This was forgotten in a previous commit.
Note that this is only used by lowcode experiments and still waits to be ported
to architectures other than IA32.

StackInterpreter (helping resolve callback issue above):
Refactor handleStackOverflow into checkForStackOverflow and handleStackOverflow
to get better inlining/better readability.

Fix a bug in checkStackPointerIndexForFrame: for the current frame that caused
many false assert-fails during callbacks.

SistaV1:

Added support for BranchIfInstanceOf in addition to BranchIfNotInstanceOf
by using the sign bit of extB as annotation.


  Commit: 78489f4909b34c9497af948b656a0ef34626ce74
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/78489f4909b34c9497af948b656a0ef34626ce74
  Author: Eliot Miranda <eliot.miranda at gmail.com>
  Date:   2016-12-14 (Wed, 14 Dec 2016)

  Changed paths:
    M platforms/Cross/vm/sqCogStackAlignment.h
    M platforms/unix/vm/sqUnixMain.c
    M platforms/win32/vm/sqWin32Main.c
    M platforms/win32/vm/sqWin32Window.c
    M src/plugins/SqueakFFIPrims/ARM32FFIPlugin.c
    M src/plugins/SqueakFFIPrims/IA32FFIPlugin.c
    M src/plugins/SqueakFFIPrims/SqueakFFIPrims.c
    M src/plugins/SqueakFFIPrims/X64SysVFFIPlugin.c
    M src/plugins/SqueakFFIPrims/X64Win64FFIPlugin.c
    M third-party/libpng.spec.win

  Log Message:
  -----------
  Merge branch 'Cog' of http://github.com/OpenSmalltalk/vm into Cog
Clumsy merge with 3a6a4e05ed7fe09f6f6702bc8207059f88b3c7a5


  Commit: ce197ec08e8c54887b8a5010bbe0097b0ff29242
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/ce197ec08e8c54887b8a5010bbe0097b0ff29242
  Author: Eliot Miranda <eliot.miranda at gmail.com>
  Date:   2016-12-14 (Wed, 14 Dec 2016)

  Changed paths:
    M src/plugins/SqueakFFIPrims/ARM32FFIPlugin.c
    M src/plugins/SqueakFFIPrims/IA32FFIPlugin.c
    M src/plugins/SqueakFFIPrims/X64SysVFFIPlugin.c
    M src/plugins/SqueakFFIPrims/X64Win64FFIPlugin.c

  Log Message:
  -----------
  Merge 3a6a4e05ed7fe09f6f6702bc8207059f88b3c7a5 & 6653d19a0ebd0d05e8cfc5d7bb0fcc80f5d81f98


Compare: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/3a6a4e05ed7f...ce197ec08e8c


More information about the Vm-dev mailing list