<div dir="ltr"><div><div><div><div><div><div><div>So win32 FFI test crash the VM if compiled with gcc.<br></div>But tests pass if compiled with clang (i686-w64-mingw32-clang on cygwin64)<br><br></div><div>---------------- details following -----------------<br><br></div>The problem with gcc is the famous ALLOCA_LIES_SO_USE_GETSP<br></div>Indeed, alloca reserve 16 more bytes than necessary. That is, it answers a value, but increment<br>    stack pointer = return alloca'd + 16<br></div>It's wrong because we want to pile up FFI args starting at stack pointer, just above the future return address.<br></div><br>So there is a hack in code generation that used to workaround the problem: use SP instead of alloca'd value for marshalling FFI args.<br></div>Unfortunately as we could have guessed it was fragile...<br>Recent versions of gcc do use the 16 extra bytes !!!<br></div>Indeed it seems that the function calls that are used for marshalling FFI arguments will use SP,SP+4,SP+8 and SP+12 for their own arguments, without incrementing SP first<br>Thus when we try and fill the FFI argument stack, we break the own stack of these functions... Since most of these arguments are pointers (oops and calloutState), then we very soon SEGV.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-19 19:05 GMT+02:00 Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">2016-08-19 18:29 GMT+02:00 Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@<wbr>gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hi,<br><br></div>Win32 FFI fails for some time now.<br></div>For example, load latest versions of FFI from <a href="http://source.squeak.org/FFI" target="_blank">http://source.squeak.org/FFI</a><br></div>Then try this snippet:<br><br>FFIPluginTests new testGenericDoubleCall.<br><br></div>And you'll get a segmentation fault, crash.dmp.<br></div>The latest vmI found in bintray already has the problem.<br></div></div></div></div></div></div></blockquote><div><br></div></span><div>Hem, the oldest VM, not the latest<br> <br></div><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><a href="https://dl.bintray.com/opensmalltalk/vm/:cog_win32x86_squeak.cog.spur_201606301459.zip" target="_blank">https://dl.bintray.com/opensma<wbr>lltalk/vm/:cog_win32x86_<wbr>squeak.cog.spur_201606301459.<wbr>zip</a><br><br>This bug delayed the Win64 squeak.stack.spur delivery, because I thought I introduced a regression somewhere...<br><br></div>I did not have time to check other OSes, but it would be worth trying.<br></div>(Before declaring any VM+plugins as stable...)<br></div><br></div>If someone has a way to easily dissect without precompiled artifacts, let me know.<span class="m_-4567770417514994626HOEnZb"><font color="#888888"><br></font></span></div></div></blockquote></span><div>err, bissect not dissect<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><span class="m_-4567770417514994626HOEnZb"><font color="#888888"><br></font></span></div><span class="m_-4567770417514994626HOEnZb"><font color="#888888">Nicolas<br><div><div><div><br></div></div></div></font></span></div>
</blockquote></div><br></div></div>
</blockquote></div><br></div>