<div dir="ltr">Hi Nicolas,<div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 16, 2017 at 7:10 AM, 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> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-05-15 17:39 GMT+02: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">Hi Nicolas,<div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 15, 2017 at 7:37 AM, 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><div>Hi Eliot,<br></div>I've not worked on it for a month or so, but last time I tried, the VM failed during image startup.<br></div>AFAIR, it had time to produce and execute some JIT, but I can't say more until I have access to my laptop this evening,<br></div>I've tried some crazy things like tracing every VM function thru gdb hack, unfortunately, it does not scale (slow) and also perturbates the VM.<br></div>I'll try to report ASAP.<br><br></div>There's a first thing needed before testing it:<br>either add some -DWIN64ABI compilation flag somewhere, or add these 3 lines in cogit.c preamble<br><br>#if WIN64 <br># define WIN64ABI 1<br>#endif<br></div></blockquote><div><br></div><div>I was thinking it would be natural to add it to the build.win64x64 makefiles.  But I've hacked something up to add the above to cogit.c.</div><div> </div></div></div></div></blockquote><div><div>Yes thanks, if it can work automagically then it's better.<br></div><div>About Win64 status, maybe you remember the thread opened on vm-dev in March 2017, where I mentionned the error:<br></div></div></div></div></div></blockquote><div><br></div><div>Ah, right.  I've reread the thread.  Thank you.  So given that the alignment assert never fails the next likely suspect is unwinding the stack on longjmp.  Since we would like to avoid the cost of unwinding the stack, and because we know there is nothing to run as we unwind the stack we should see if there is a form of longjmp that does not try to unwind the stack.  Alternatively we might have to implement our own longjmp in JIT code for this specific purpose.</div><div><br></div><div>Ben, what have you discovered about unwinding the stack during longjmp on win64?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div><br><div>(gdb)<br>Continuing.<br><br>Breakpoint 5, enterCogCodePopReceiver () at ../../spur64src/vm/cogitX64WIN<wbr>64.c:5171<br>5171            realCEEnterCogCodePopReceiverR<wbr>eg();<br>(gdb)<br>Continuing.<br><br>Breakpoint 6, 0x000007fefd4ce547 in msvcrt!longjmp () from /cygdrive/c/Windows/system32/m<wbr>svcrt.dll<br>(gdb) call printCallStack()<br><br>          0xf0b138 I Set class(HashedCollection class)>new 0xb9f8ee8: a(n) Set class<br>          0xf0b168 M FFICallbackThunk class>startUp: 0xd06b718: a(n) FFICallbackThunk class<br>          0xf0b1c0 M [] in SmalltalkImage>send:toClassesN<wbr>amedIn:with: 0xba53d18: a(n) SmalltalkImage<br>          0xf0b210 I OrderedCollection>do: 0xbda81d8: a(n) OrderedCollection<br>          0xf0b260 I SmalltalkImage>send:toClassesN<wbr>amedIn:with: 0xba53d18: a(n) SmalltalkImage<br>          0xf0b2b8 I SmalltalkImage>processStartUpL<wbr>ist: 0xba53d18: a(n) SmalltalkImage<br>          0xf0b310 I SmalltalkImage>snapshot:andQui<wbr>t:withExitCode:embedded: 0xba53d18: a(n) SmalltalkImage<br>         0xc6187b0 s SmalltalkImage>snapshot:andQui<wbr>t:embedded:<br>         0xbc9ee20 s SmalltalkImage>snapshot:andQui<wbr>t:<br></div>...snip...<br><br>(gdb) print reenterInterpreter<br>$26 = {{Part = {15766176, 4294967295}}, {Part = {15766176, 15975296}}, {Part = {65001, 0}}, {Part = {4294967295, 8}}, {Part = {<br>     
 1998004096, 15989488}}, {Part = {4356103, 3843995738016}}, {Part = {0, 
0}}, {Part = {0, 0}}, {Part = {0, 0}}, {Part = {0, 0}},<br>  {Part = {0, 0}}, {Part = {0, 0}}, {Part = {0, 0}}, {Part = {0, 0}}, {Part = {0, 0}}, {Part = {0, 0}}}<br>(gdb) cont<br>Continuing.<br>[Thread 1912.0x4e4 exited with code 0]<br>gdb: unknown target exception 0xc0000028 at 0x77438078<br><br>Program received signal ?, Unknown signal.<br>0x0000000077438078 in ntdll!RtlRaiseStatus () from /cygdrive/c/Windows/SYSTEM32/n<wbr>tdll.dll<br>(gdb) where<br>#0  0x0000000077438078 in ntdll!RtlRaiseStatus () from /cygdrive/c/Windows/SYSTEM32/n<wbr>tdll.dll<br>#1  0x00000000773d7eb6 in ntdll!TpAlpcRegisterCompletion<wbr>List () from /cygdrive/c/Windows/SYSTEM32/n<wbr>tdll.dll<br>#2  0x000007fefd4ce5a3 in msvcrt!longjmp () from /cygdrive/c/Windows/system32/m<wbr>svcrt.dll<br>#3  0x00000000004314f9 in returnToExecutivepostContextSw<wbr>itch (inInterpreter=0, switchedContext=0)<br>    at ../../spur64src/vm/gcc3x-coint<wbr>erp.c:22130<br>#4  0x000000000043a110 in activateNewMethod () at ../../spur64src/vm/gcc3x-coint<wbr>erp.c:15045<br>#5  0x000000000043c6e2 in interpretMethodFromMachineCode () at ../../spur64src/vm/gcc3x-coint<wbr>erp.c:19204<br>#6  0x0000000000442e19 in ceSendsupertonumArgs (selector=192910456, superNormalBar=0, rcvr=195006184, numArgs=0)<br>    at ../../spur64src/vm/gcc3x-coint<wbr>erp.c:17228<br>#7  0x000000000ac000ba in ?? ()<br>Backtrace stopped: previous frame inner to this frame (corrupt stack?)<br><br>----------------------<br><br></div><div>It
 was quite long to execute the VM step by step, several setjmp/longjmp 
did succeed before the failing one, and I had got no idea which bug I 
was looking for, nor were enough exercized to decipher the C stack 
and/or the Smalltalk stack (in which variable they are stored etc...).<br><br></div><div>So
 I tried a different angle of attack in end of March: let's trace the VM
 actions and then trace back from the failing point. Maybe it would give
 me a clue.<br></div><div>My idea was to exploit something like:<br><br><a href="http://stackoverflow.com/questions/311840/tool-to-trace-local-function-calls-in-linux#311912" target="_blank">http://stackoverflow.com/quest<wbr>ions/311840/tool-to-trace-loca<wbr>l-function-calls-in-linux#3119<wbr>12</a><br><br>Of course, cygwin is a strange linux, so I tried with dumpbin, but the address were wrong.<br>Finally it did work OK with objdump, see the final make_trace attached.<br></div><div>Unfortunately,
 the debug VM traced by gdb does block before encountering the error 
(despite a few grep -v attempts to not catch the heartbeat).<br></div><div>My crazy ideas do not seem to work...<br>I also managed to get a gdb.exe.stackdump if asking to trace too many functions.<br></div><div>I attach a gdb.log though for the curious.<br><br></div>Since
 then I had no time to work on it. It requires a more intimate 
understanding of stack organization and other VM details. I'm not ready 
yet.<br><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 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">2017-05-15 16:24 GMT+02:00 Eliot Miranda <span dir="ltr"><<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>></span>:<br></div><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"> <br><div dir="auto"><div>Hi Nicolas,</div><div id="m_4853650203158754451m_5068423504776170423gmail-m_-2489083324410839648m_-4836667870530044329m_1069286879506641545AppleMailSignature"><br></div><div id="m_4853650203158754451m_5068423504776170423gmail-m_-2489083324410839648m_-4836667870530044329m_1069286879506641545AppleMailSignature">    can you give a short status report on Cog for Win64?  What is not working for the JIT?  Given that the stack spur vm works we should be close.  So what still needs fixing?<br><br><span style="background-color:rgba(255,255,255,0)">_,,,^..^,,,_ (phone)</span></div><div><br>On May 15, 2017, at 7:13 AM, Nicolas Cellier <<a href="mailto:notifications@github.com" target="_blank">notifications@github.com</a>> wrote:<br><br></div><blockquote type="cite"><div><p>Hi Esteban, currently this fails because with don't build pharo.cog.spur yet in win64.<br>
Could you retry with "${ROOT_DIR}/build.${ARCH}/pha<wbr>ro.<b>stack</b>.spur/build/vm"?<br>
At least, this should turn the appveyor status green again.</p>

<p style="font-size:small;color:rgb(102,102,102)">—<br>You are receiving this because you are subscribed to this thread.<br>Reply to this email directly, <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/bed86c5723c150a7eafad111a1872d739dcbae97#commitcomment-22142928" target="_blank">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/APHa0DePieA9856_kWXXScvpTMsyykRTks5r6F1-gaJpZM4NbMVh" target="_blank">mute the thread</a>.<img alt="" src="https://github.com/notifications/beacon/APHa0Kdo08M5umAcKkBoVZddtHjy04ydks5r6F1-gaJpZM4NbMVh.gif" width="1" height="1"></p>
<div>
<div>
  
  
</div>

</div>

</div></blockquote></div><br></blockquote></div><br></div>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_4853650203158754451m_5068423504776170423gmail-m_-2489083324410839648gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>
<br></blockquote></div><br></div></div>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_4853650203158754451gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>