<div dir="ltr">More detailed commit message can be found at:<br><a href="http://smalltalkhub.com/?_escaped_fragment_=/~nice/NiceVMExperiments/commits#!/~nice/NiceVMExperiments/commits">http://smalltalkhub.com/?_escaped_fragment_=/~nice/NiceVMExperiments/commits#!/~nice/NiceVMExperiments/commits</a><br><br>VMMaker.oscogLLP64-nice.1927<span><p>Fix ThreadedFFI preamble for X64 WIN64
A hack tells to use getsp() on gcc mingw, but getsp is not defined for x64
it then defaults to 0, resulting in a SEGV when allocating space via alloca.
That happens when returning long-or-non-power-of-two-sized struct by value (like testPoint4)
Presume that alloca is correct for X64.</p></span><br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-11-06 22:26 GMT+01:00 <span dir="ltr"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:<br>
<a href="http://source.squeak.org/VMMaker/VMMaker.oscog-nice.1983.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/<wbr>VMMaker/VMMaker.oscog-nice.<wbr>1983.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: VMMaker.oscog-nice.1983<br>
Author: nice<br>
Time: 6 November 2016, 10:24:48.088401 pm<br>
UUID: 49213785-7d35-4e20-837b-<wbr>ecc45a85000f<br>
Ancestors: VMMaker.oscog-nice.1982<br>
<br>
X64 Win64 FFI requires setsp/getsp<br>
It also uses PLATFORM_API_USES_CALLEE_POPS_<wbr>CONVENTION<br>
<br>
=============== Diff against VMMaker.oscog-nice.1982 ===============<br>
<br>
Item was changed:<br>
----- Method: ThreadedFFIPlugin class>>preambleCCode (in category 'translation') -----<br>
preambleCCode<br>
"For a source of builtin defines grep for builtin_define in a gcc release config directory."<br>
^'<br>
#include "sqAssert.h" /* for assert */<br>
#define ThreadedFFIPlugin 1 /* to filter-out unwanted declarations from sqFFI.h */<br>
#include "sqFFI.h" /* for logging and surface functions */<br>
<br>
#ifdef _MSC_VER<br>
# define alloca _alloca<br>
#endif<br>
#if defined(__GNUC__) && (defined(_X86_) || defined(i386) || defined(__i386) || defined(__i386__))<br>
# define setsp(sp) asm volatile ("movl %0,%%esp" : : "m"(sp))<br>
# define getsp() ({ void *esp; asm volatile ("movl %%esp,%0" : "=r"(esp) : ); esp;})<br>
+ # elif defined(__GNUC__) && (defined(__amd64__) || defined(__x86_64__) || defined(__amd64) || defined(__x86_64))<br>
+ # define setsp(sp) asm volatile ("movq %0,%%rsp" : : "m"(sp))<br>
+ # define getsp() ({ void *rsp; asm volatile ("movq %%rsp,%0" : "=r"(rsp) : ); rsp;})<br>
# elif defined(__GNUC__) && (defined(__arm__))<br>
# define setsp(sp) asm volatile ("ldr %%sp, %0" : : "m"(sp))<br>
# define getsp() ({ void *sp; asm volatile ("mov %0, %%sp" : "=r"(sp) : ); sp;})<br>
#endif<br>
#if !!defined(getsp)<br>
# define getsp() 0<br>
#endif<br>
#if !!defined(setsp)<br>
# define setsp(ignored) 0<br>
#endif<br>
<br>
#if !!defined(STACK_ALIGN_BYTES)<br>
# if __APPLE__ && __MACH__ && __i386__<br>
# define STACK_ALIGN_BYTES 16<br>
# elif __linux__ && __i386__<br>
# define STACK_ALIGN_BYTES 16<br>
# elif defined(__amd64__) || defined(__x86_64__) || defined(__amd64) || defined(__x86_64)<br>
# define STACK_ALIGN_BYTES 16<br>
# elif defined(powerpc) || defined(__powerpc__) || defined(_POWER) || defined(__POWERPC__) || defined(__PPC__)<br>
# define STACK_ALIGN_BYTES 16<br>
# elif defined(__sparc64__) || defined(__sparcv9__) || defined(__sparc_v9__) /* must precede 32-bit sparc defs */<br>
# define STACK_ALIGN_BYTES 16<br>
# elif defined(sparc) || defined(__sparc__) || defined(__sparclite__)<br>
# define STACK_ALIGN_BYTES 8<br>
# elif defined(__arm__)<br>
# define STACK_ALIGN_BYTES 8<br>
# else<br>
# define STACK_ALIGN_BYTES 0<br>
# endif<br>
#endif /* !!defined(STACK_ALIGN_BYTES) */<br>
<br>
#if !!defined(STACK_OFFSET_BYTES)<br>
# define STACK_OFFSET_BYTES 0<br>
#endif<br>
<br>
#if defined(_X86_) || defined(i386) || defined(__i386) || defined(__i386__)<br>
/* Both Mac OS X x86 and Win32 x86 return structs of a power of two in size<br>
* less than or equal to eight bytes in length in registers. Linux never does so.<br>
*/<br>
# if __linux__<br>
# define WIN32_X86_STRUCT_RETURN 0<br>
# else<br>
# define WIN32_X86_STRUCT_RETURN 1<br>
# endif<br>
# if WIN32<br>
# define PLATFORM_API_USES_CALLEE_POPS_<wbr>CONVENTION 1<br>
# endif<br>
+ # elif defined(__amd64__) || defined(__x86_64__) || defined(__amd64) || defined(__x86_64)<br>
+ # if WIN32 | WIN64<br>
+ # define PLATFORM_API_USES_CALLEE_POPS_<wbr>CONVENTION 1<br>
+ # endif<br>
#endif /* defined(_X86_) || defined(i386) || defined(__i386) || defined(__i386__) */<br>
<br>
#if !!defined(ALLOCA_LIES_SO_USE_<wbr>GETSP)<br>
+ # if defined(__MINGW32__) && (__GNUC__ >= 3) && (defined(_X86_) || defined(i386) || defined(__i386) || defined(__i386__))<br>
- # if defined(__MINGW32__) && (__GNUC__ >= 3)<br>
/*<br>
* cygwin -mno-cygwin (MinGW) gcc 3.4.x''s alloca is a library routine that answers<br>
* %esp + 4, so the outgoing stack is offset by one word if uncorrected.<br>
* Grab the actual stack pointer to correct.<br>
*/<br>
# define ALLOCA_LIES_SO_USE_GETSP 1<br>
# else<br>
# define ALLOCA_LIES_SO_USE_GETSP 0<br>
# endif<br>
#endif /* !!defined(ALLOCA_LIES_SO_USE_<wbr>GETSP) */<br>
<br>
#if !!defined(PLATFORM_API_USES_<wbr>CALLEE_POPS_CONVENTION)<br>
# define PLATFORM_API_USES_CALLEE_POPS_<wbr>CONVENTION 0<br>
#endif<br>
<br>
/* The dispatchOn:in:with:with: generates an unwanted call on error. Just squash it. */<br>
#define error(foo) 0<br>
#ifndef SQUEAK_BUILTIN_PLUGIN<br>
/* but print assert failures. */<br>
void<br>
warning(char *s) { /* Print an error message but don''t exit. */<br>
printf("\n%s\n", s);<br>
}<br>
#endif<br>
<br>
/* sanitize */<br>
#ifdef SQUEAK_BUILTIN_PLUGIN<br>
# define EXTERN<br>
#else<br>
# define EXTERN extern<br>
#endif<br>
'!<br>
<br>
</blockquote></div><br></div>