<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:large">Hi David,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 17, 2020 at 9:58 AM <a href="mailto:stes@PANDORA.BE">stes@PANDORA.BE</a> <<a href="mailto:stes@telenet.be">stes@telenet.be</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA256<br>
<br>
<br>
Hi,<br>
<br>
Originally when I compiled on Solaris, I had both the "Cog" and "Stack" VM<br>
working.<br>
<br>
Unfortunately there was a change in april which breaks the "Cog" build.<br>
<br>
The "Stack" build continues to work fine for me.<br>
<br>
Since early april there is in the following file the following definition :<br>
<br>
platforms/Cross/vm/sq.h<br>
<br>
#       define getReturnAddress() __builtin_extract_return_addr(__builtin_return_address(0))<br>
<br>
Eliot Miranda wrote in the thread:<br>
<br>
<a href="http://forum.world.st/Broken-5-3-downloads-need-fixing-td5115132.html" rel="noreferrer" target="_blank">http://forum.world.st/Broken-5-3-downloads-need-fixing-td5115132.html</a><br>
<br>
"Things are pretty stable. There was one major change to how the VM moves from machine code into the interpreter, replacing a setjmp/longjmp pair with a much lighter-weight "jump-call with substituted return address". But this "just works".  We're able to perform experments without disturbinf=g trunk.  SO for example, adding makefiles to allow building of the VM under clang-cl.exe on Windows was done without affecting the other builds at all."<br>
<br>
Is there a compiler flag (#define) to re-enable the old code with<br>
setjmp/longjmp ?<br>
<br>
Or is there code in the 'platforms/Cross/vm/sqCog*' files<br>
that could help to implement the required function for 'return address',<br>
if that is not provided by the compiler ... ?<br>
<br>
I am hoping to re-enable the old setjmp/longjmp code.<br>
<br>
Also note that this may be useful for other users as well,<br>
to be able to 'revert' to the legacy old code.<br></blockquote><div><br></div><div class="gmail_default" style="font-size:large">Nah, it's trivial to implement.  The new scheme is much cheaper and hence faster than setjmp/longjmp.  So I'd much rather spread it further than support two versions.  <span style="color:rgb(0,0,0);font-family:-webkit-standard;font-size:medium">The compiler supports gcc's inline extended assembler right?  </span>In a normal frame on x86/x86_64 the frame pointer points to the word below the return address, so would look like this:</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large"><div class="gmail_default">#if __GNUC__ || __clang__</div><div class="gmail_default"><span style="color:rgb(0,0,0)"># if defined(_X86_) || defined(i386) || defined(__i386) || defined(__i386__)</span></div><div class="gmail_default">#   define getretaddr() ({ register usqIntptr_t retpc;                  \</div><div class="gmail_default">                      asm volatile ("movl 4(%%ebp),%0" : "=r"(<span style="color:rgb(0,0,0);font-family:-webkit-standard;font-size:medium">retpc</span>) : ); \</div><div class="gmail_default">                      <span style="color:rgb(0,0,0);font-family:-webkit-standard;font-size:medium">retpc</span>; })</div><div class="gmail_default"># elif defined(x86_64) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(__amd64__) || defined(x64) || defined(_M_AMD64) || defined(_M_X64) || defined(_M_IA64)</div><div class="gmail_default"><span style="color:rgb(0,0,0)">#   define getretaddr() ({ register usqIntptr_t retpc;                  \</span></div><div class="gmail_default" style="color:rgb(0,0,0)"></div><div class="gmail_default" style="color:rgb(0,0,0)">                      asm volatile ("movl 8(%%rbp),%0" : "=r"(<span style="font-size:medium">retpc</span>) : ); \</div><div class="gmail_default" style="color:rgb(0,0,0)">                      <span style="font-size:medium">retpc</span>; })</div></div><div class="gmail_default" style="font-size:large">#endif</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large">To make this convenient we need to decide whether to put it in sqPlatformSpecific.h (easy) or to perhaps rename platforms/Cross/vm/sqCogStackAlignment.h to platforms/Cross/vm/sqCogStackAccess.h and put it there.  That feels better than putting it in sq.h.  But in any case can you try adding the above definitions to the relevant sqPlatformSpecific.h?</div><div class="gmail_default" style="font-size:large"><br></div><div class="gmail_default" style="font-size:large"><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
Regards,<br>
David Stes<br>
<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v2<br>
<br>
iQEcBAEBCAAGBQJfY5VfAAoJEAwpOKXMq1Ma9y8H/15hLjTf3aMfdFaPH1aoXNRK<br>
T61XZtbrOuykLH4IqLZpr85bQgtqdAdZqZ4tYtl8H00B4opoKZ+CVfruCDUoQEIJ<br>
uUYpJ9R8bp60DqQ147VakZaBzl7P9z2yn9mq6BGnb4sh/tSS743AIinURt+jqoKM<br>
MKxPf6cQn6r+fsvRNN+N5By9AIGco9t61SUqIcNzrdGRNwoaMOzc/4DfMYhPs6JT<br>
qyP3sJ0/LlJA7nhLSWmRNbkC2aJuYT4WCBTdEyNbs9lkv4CO8OOska8Y5YINgvpl<br>
FbwnyTABZzMdYuBIJevlB3RKPMTsn+ceFDfqcrDC7YzeVVWaZhhzV5wosjHenck=<br>
=bl73<br>
-----END PGP SIGNATURE-----<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="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></div></div></div></div></div></div></div></div></div></div>