<div dir="ltr"><div><div><div><div><div>Now the failure is:<br><br>gdb: unknown target exception 0xc0000028 at 0x76f38078<br><br>Program received signal ?, Unknown signal.<br>0x0000000076f38078 in ntdll!RtlRaiseStatus () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll<br><br>(gdb) where<br>#0  0x0000000076f38078 in ntdll!RtlRaiseStatus () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll<br>#1  0x0000000076ed7eb6 in ntdll!TpAlpcRegisterCompletionList () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll<br>#2  0x000007fefeb7e5a3 in msvcrt!longjmp () from /cygdrive/c/Windows/system32/msvcrt.dll<br>#3  0x00000000004314f9 in returnToExecutivepostContextSwitch (inInterpreter=0, switchedContext=1)<br>    at ../../spur64src/vm/gcc3x-cointerp.c:22130<br>#4  0x000000000043a110 in activateNewMethod () at ../../spur64src/vm/gcc3x-cointerp.c:15045<br>#5  0x000000000043c6e2 in interpretMethodFromMachineCode () at ../../spur64src/vm/gcc3x-cointerp.c:19204<br>#6  0x0000000000442e19 in ceSendsupertonumArgs (selector=204444792, superNormalBar=0, rcvr=206540520, numArgs=0)<br>    at ../../spur64src/vm/gcc3x-cointerp.c:17228<br>#7  0x000000000b7000ba in ?? ()<br>Backtrace stopped: previous frame inner to this frame (corrupt stack?)<br><br></div><div>(gdb) up<br></div>#1  0x0000000076ed7eb6 in ntdll!TpAlpcRegisterCompletionList () from /cygdrive/c/Windows/SYSTEM32/ntdll.dll<br>(gdb) up<br>#2  0x000007fefeb7e5a3 in msvcrt!longjmp () from /cygdrive/c/Windows/system32/msvcrt.dll<br>(gdb) up<br>#3  0x00000000004314f9 in returnToExecutivepostContextSwitch (inInterpreter=0, switchedContext=1)<br>    at ../../spur64src/vm/gcc3x-cointerp.c:22130<br>22130                   siglongjmp(reenterInterpreter, ReturnToInterpreter);<br><br><div>(gdb) call printCallStack()<br></div><div>... snip...<br></div><div>          0xf0b138 I Set class(HashedCollection class)>new 0xc4f8ee8: a(n) Set class<br>          0xf0b168 M FFICallbackThunk class>startUp: 0xdb6b718: a(n) FFICallbackThunk class<br>          0xf0b1c0 M [] in SmalltalkImage>send:toClassesNamedIn:with: 0xc553d18: a(n) SmalltalkImage<br>          0xf0b210 I OrderedCollection>do: 0xc8a81d8: a(n) OrderedCollection<br>          0xf0b260 I SmalltalkImage>send:toClassesNamedIn:with: 0xc553d18: a(n) SmalltalkImage<br>          0xf0b2b8 I SmalltalkImage>processStartUpList: 0xc553d18: a(n) SmalltalkImage<br>          0xf0b310 I SmalltalkImage>snapshot:andQuit:withExitCode:embedded: 0xc553d18: a(n) SmalltalkImage<br>         0xd1187b0 s SmalltalkImage>snapshot:andQuit:embedded:<br>         0xc79ee20 s SmalltalkImage>snapshot:andQuit:<br>         0xdc6c6b8 s TheWorldMenu>saveAndQuit<br>         0xdc6eb20 s TheWorldMenu>doMenuItem:with:<br>         0xdc6ef98 s [] in MenuItemMorph>invokeWithEvent:<br>         0xdc6f200 s BlockClosure>ensure:<br>         0xdc6f2b8 s CursorWithMask(Cursor)>showWhile:<br>         0xdc6f370 s MenuItemMorph>invokeWithEvent:<br></div>...snip...<br><br>(gdb) call longPrintOop(aMethodObj)<br><br>0x0d781f10:  70/112 d1/209 22/34  e0/224 7c/124 ba/186 31/49  86/134<br>0x0d781f18:  fe/254<br>         0xd781ed8: a(n) CompiledMethod (0x468=>0xc4f8168) format 0x1f nbytes 57 hdr8 ..... hash 0x0<br> 0               0x29 5(0x5) nLits 5 nArgs 0 nTemps 0<br> 1          0xc32c900 #initialize:<br> 2          0xc2fa9a8 #basicNew<br> 3               0x29 5(0x5)<br> 4          0xc2f9478 #new<br> 5          0xd759cf0 a(n) Association<br><br></div>This indeed look like HashedCollection class>>new<br>49 <70> self<br>50 <D1> send: basicNew<br>51 <22> pushConstant: 5<br>52 <E0> send: initialize:<br>53 <7C> returnTop<br><br></div>So that's the status of win64 cog currently...<br></div>I'll stop here for tonight.<br></div>Eliot, any clue what to look at?<br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-03-22 0:47 GMT+01: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"><div>Gah, stupid me, I didn't realized that the vm was compiled for SysV...<br></div>I need to define -DWIN64ABI somewhere...<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-03-21 22:18 GMT+01: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"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_6859258035211530516h5">2017-03-21 7:48 GMT+01:00 Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmai<wbr>l.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>Hi Eliot,<br></div>I'll try the assert if I can find a time slot today, otherwise this evening.<br></div>I could also have printed the jump_buf address in gdb, but it was too late yesterday ;)<br></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-03-21 2:19 GMT+01:00 Eliot Miranda <span dir="ltr"><<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 20, 2017 at 6:01 PM, Eliot Miranda <span dir="ltr"><<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Nicolas,<div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_6859258035211530516m_-1094355878081584161gmail-m_6745249080199151534m_4932724552282708272gmail-h5">On Mon, Mar 20, 2017 at 5:56 PM, Eliot Miranda <span dir="ltr"><<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Nicolas,<div class="gmail_extra"><br><div class="gmail_quote"><span class="m_6859258035211530516m_-1094355878081584161gmail-">On Mon, Mar 20, 2017 at 3:45 PM, Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmai<wbr>l.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br><div dir="ltr"><div><div><div><div>Thanks Eliot for pushing WIN64 ABI further!<br><br></div>So the failure is this one:<br><br>gdb: unknown target exception 0xc0000028 at 0x774c8078<br><br>Program received signal ?, Unknown signal.<br>0x00000000774c8078 in ntdll!RtlRaiseStatus () from /cygdrive/c/Windows/SYSTEM32/n<wbr>tdll.dll<br>(gdb) where<br>#0  0x00000000774c8078 in ntdll!RtlRaiseStatus () from /cygdrive/c/Windows/SYSTEM32/n<wbr>tdll.dll<br>#1  0x0000000077467eb6 in ntdll!TpAlpcRegisterCompletion<wbr>List () from /cygdrive/c/Windows/SYSTEM32/n<wbr>tdll.dll<br>#2  0x000007fefe08e5a3 in msvcrt!longjmp () from /cygdrive/c/Windows/system32/m<wbr>svcrt.dll<br>#3  0x0000000000419502 in ceReturnToInterpreter (anOop=176164968) at ../../spur64src/vm/gcc3x-coint<wbr>erp.c:16504<br>#4  0x000000000a801086 in ?? ()<br>Backtrace stopped: previous frame inner to this frame (corrupt stack?)<br><br></div>I now suspect the jmp_buf alignment problem that I had to workaround in jpeg plugin:<br></div>It must be aligned on 16 bytes boundary in Win64, but sometimes the compiler fails to honour this requirement<br></div>See <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/120" target="_blank">https://github.com/OpenSmallta<wbr>lk/opensmalltalk-vm/pull/120</a></div></blockquote><div><br></div></span><div>Hmph.  So the stack /should/ be aligned on a 16-byte boundary and hence the compiler /should/ be able to maintain the invariant (see platforms/Cross/vm/sqCogStackA<wbr>lignment.h; in fact on Mac OS X the alignment is 32 bytes).</div><div> </div><div>Let me suggest that you add the following to the preamble:</div><div><br></div><div><div>#if WIN64</div><div># define sigsetjmp(jb,ssmf) (assert(((int)jb & 15) == 0, setjmp(jb))</div><div># define siglongjmp(jb,v) (assert(((int)jb & 15) == 0, longjmp(jb,v))</div></div><div>#elif WIN32</div><div>...</div><div><br></div><div>and make sure there's a self assertCStackWellAligned send in ceReturnToInterpreter.</div></div></div></div></blockquote><div><br></div></div></div><div>Hmmm.  I expect we need code in the ceReturnToInterpreterTrampolin<wbr>e that establishes the stack alignment requirement.  ceReturnToInterpreter: would be called from machine code where there is only 8 byte alignment on x64 (& 4 byte alignment on 32-bit VMs).  If you like I can try and implement this tomorrow.</div></div></div></div></blockquote><div><br></div><div> Looking at the code, that's not necessary.  The trampoline still switches to the C stack, which should be correctly aligned.  So yes, definitely add the "self assertCStackWellAligned" to both ceReturnToInterpreter: and ceBaseFrameReturn:.  It looks like the issue is whether the returnToInterpreter jmpbuf is correctly aligned.</div><div><br></div></div></div></div></blockquote></div></div></blockquote><div><br></div></div></div><div><br>The STACK_ALIGN_BYTES is 16 in good agreement with 
WIN64 ABI and assertCStackWellAligned() do succeed in 
ceReturnToInterpreter...<br><br>So, I added the assertion on setjmp and longjmp, but they do not fail.<br></div><div>The jmp_buf reenterInterpreter is correctly aligned on 16 bytes boundary.<br></div><div>There is a declaration like this in setjmp.h<br> typedef _CRT_ALIGN(16) struct _SETJMP_FLOAT128<br>So local and global jmp_buf variables are allways well aligned by the C compiler(s)<br></div><div><br></div><div>The jpeg problem was caused by putting the jmp_buf into a structure.<br>Apparently, gcc and clang fail to correctly handle that case<br>(they should first align the whole struct on 16 bytes then align the offset of the jmp_buf member).<br><br></div><div>There are other cases that will be problematic in Win64 exactly like the jpeg case, for example I see:<br>siglongjmp((vmCallbackContext-<wbr>>trampoline)... in returnAsThroughCallbackContext<br>longjmp(GIV(jmpBuf)[GIV(jmpDep<wbr>th)]...in callbackLeave (only #if SQ_USE_GLOBAL_STRUCT)<br><br></div><div>We should memcpy these to a local jmp_buf for WIN64 compatibility.<br></div><div><br></div><div>But the VM failed before ever reaching one of these callbacks (we should have none in Squeak by default)<br><br></div><div>So, wrong guess from my side for the moment, seeing longjmp on the call stack raised that false alarm.<br></div><div><div class="m_6859258035211530516h5"><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="m_6859258035211530516m_-1094355878081584161gmail-m_6745249080199151534m_4932724552282708272gmail-h5"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div><div class="m_6859258035211530516m_-1094355878081584161gmail-h5"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote">2017-03-19 21:03 GMT+01:00 Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmai<wbr>l.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>And currently <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/spur64src/vm/cogitX64.c" target="_blank">https://github.com/OpenSmallta<wbr>lk/opensmalltalk-vm/blob/Cog/s<wbr>pur64src/vm/cogitX64.c</a> is generated for SysV only.<br></div>It's necessary to hack the CogX64Compiler SysV class var initialization and generate a win64 specific cogitX64.c.<br><br></div><div class="m_6859258035211530516m_-1094355878081584161gmail-m_6745249080199151534m_4932724552282708272gmail-m_628046442531548366gmail-m_4452455029169383820gmail-m_3136833395563508300HOEnZb"><div class="m_6859258035211530516m_-1094355878081584161gmail-m_6745249080199151534m_4932724552282708272gmail-m_628046442531548366gmail-m_4452455029169383820gmail-m_3136833395563508300h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-03-19 20:34 GMT+01:00 Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmai<wbr>l.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi Clement,<br></div>it's been a while since I last tested, but in a few words:<br></div>- win64 use it's own ABI<br></div>- we have to assign the registers differently than sysV<br></div>- the experiments I did resulted in VM crashing early (before opening window)<br><br></div>Nicolas<br><div><div><div><div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2017-03-19 20:29 GMT+01:00 Clément Bera <span dir="ltr"><<a href="mailto:bera.clement@gmail.com" target="_blank">bera.clement@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br><div dir="ltr">Thank you very much for doing Nicolas. It is very important for many Pharo users to use Pharo 64 bits on Windows.<div><br></div><div>What are the problems you have when trying to build the VM with the JIT that you don't have when building the stack VM ? Is it about API to make the memory executable, is it about calling conventions ?</div></div><div><div class="m_6859258035211530516m_-1094355878081584161gmail-m_6745249080199151534m_4932724552282708272gmail-m_628046442531548366gmail-m_4452455029169383820gmail-m_3136833395563508300m_1282566188950751948h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 19, 2017 at 12:14 PM, Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmai<wbr>l.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br><div dir="ltr">And the appveyor builds are green<br><a href="https://ci.appveyor.com/project/OpenSmalltalk/vm/build/1.0.579" target="_blank">https://ci.appveyor.com/projec<wbr>t/OpenSmalltalk/vm/build/1.0.5<wbr>79</a><br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-03-19 17:31 GMT+01:00 Nicolas Cellier <span dir="ltr"><<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmai<wbr>l.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div>Hi,<br></div>I've built a 64bits pharo.stack.spur VM for windows on my machine,<br></div>and I'm uploading the changes to opensmalltalk-vm in branch <br></div>build_pharo_win32_with_cygwin<br><br></div>If the appveyor job correctly succeed, I will emit a pull request.<br><br>The VM does not have the SqueakSSL plugin yet.<br><br></div>The 64bits squeak/pharo.cog.spur JIT for windows is still to come,<br></div>but I did not work on it for a few months...<br></div><div>One thing at a time.<br></div><div><br></div><div>Let's cross finger<span class="m_6859258035211530516m_-1094355878081584161gmail-m_6745249080199151534m_4932724552282708272gmail-m_628046442531548366gmail-m_4452455029169383820gmail-m_3136833395563508300m_1282566188950751948m_-8406071533041255915m_-3727487575268912687m_2521325081379501837HOEnZb"><font color="#888888"><br><br></font></span></div><span class="m_6859258035211530516m_-1094355878081584161gmail-m_6745249080199151534m_4932724552282708272gmail-m_628046442531548366gmail-m_4452455029169383820gmail-m_3136833395563508300m_1282566188950751948m_-8406071533041255915m_-3727487575268912687m_2521325081379501837HOEnZb"><font color="#888888"><div>Nicolas<br></div></font></span></div>
</blockquote></div><br></div>
<br></blockquote></div><br></div>
<br></div></div></blockquote></div><br></div></div></div></div></div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
<br></blockquote></div></div></div><span class="m_6859258035211530516m_-1094355878081584161gmail-m_6745249080199151534m_4932724552282708272gmail-m_628046442531548366gmail-HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_6859258035211530516m_-1094355878081584161gmail-m_6745249080199151534m_4932724552282708272gmail-m_628046442531548366gmail-m_4452455029169383820gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</font></span></div></div>
</blockquote></div></div></div><span class="m_6859258035211530516m_-1094355878081584161gmail-m_6745249080199151534m_4932724552282708272gmail-HOEnZb"><font color="#888888"><br><br clear="all"><span class="m_6859258035211530516m_-1094355878081584161gmail-HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_6859258035211530516m_-1094355878081584161gmail-m_6745249080199151534m_4932724552282708272gmail-m_628046442531548366gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</font></span></font></span></div></div><span class="m_6859258035211530516m_-1094355878081584161gmail-HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="m_6859258035211530516m_-1094355878081584161gmail-HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_6859258035211530516m_-1094355878081584161gmail-m_6745249080199151534m_4932724552282708272gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</font></span></div></div><span class="m_6859258035211530516m_-1094355878081584161gmail-HOEnZb"><font color="#888888">
<br></font></span></blockquote></div><br></div>
</blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>