-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hi, Originally when I compiled on Solaris, I had both the "Cog" and "Stack" VM working. Unfortunately there was a change in april which breaks the "Cog" build. The "Stack" build continues to work fine for me. Since early april there is in the following file the following definition : platforms/Cross/vm/sq.h # define getReturnAddress() __builtin_extract_return_addr(__builtin_return_address(0)) Eliot Miranda wrote in the thread: http://forum.world.st/Broken-5-3-downloads-need-fixing-td5115132.html "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." Is there a compiler flag (#define) to re-enable the old code with setjmp/longjmp ? Or is there code in the 'platforms/Cross/vm/sqCog*' files that could help to implement the required function for 'return address', if that is not provided by the compiler ... ? I am hoping to re-enable the old setjmp/longjmp code. Also note that this may be useful for other users as well, to be able to 'revert' to the legacy old code. Regards, David Stes -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJfY5VfAAoJEAwpOKXMq1Ma9y8H/15hLjTf3aMfdFaPH1aoXNRK T61XZtbrOuykLH4IqLZpr85bQgtqdAdZqZ4tYtl8H00B4opoKZ+CVfruCDUoQEIJ uUYpJ9R8bp60DqQ147VakZaBzl7P9z2yn9mq6BGnb4sh/tSS743AIinURt+jqoKM MKxPf6cQn6r+fsvRNN+N5By9AIGco9t61SUqIcNzrdGRNwoaMOzc/4DfMYhPs6JT qyP3sJ0/LlJA7nhLSWmRNbkC2aJuYT4WCBTdEyNbs9lkv4CO8OOska8Y5YINgvpl FbwnyTABZzMdYuBIJevlB3RKPMTsn+ceFDfqcrDC7YzeVVWaZhhzV5wosjHenck= =bl73 -----END PGP SIGNATURE----- |
Hi David, -----BEGIN PGP SIGNED MESSAGE----- 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. The compiler supports gcc's inline extended assembler right? In a normal frame on x86/x86_64 the frame pointer points to the word below the return address, so would look like this: #if __GNUC__ || __clang__ # if defined(_X86_) || defined(i386) || defined(__i386) || defined(__i386__) # define getretaddr() ({ register usqIntptr_t retpc; \ asm volatile ("movl 4(%%ebp),%0" : "=r"(retpc) : ); \ retpc; }) # 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) # define getretaddr() ({ register usqIntptr_t retpc; \ asm volatile ("movl 8(%%rbp),%0" : "=r"(retpc) : ); \ retpc; }) #endif 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?
_,,,^..^,,,_ best, Eliot |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 I don't know whether the following comment makes sense, but shouldn't this code be in: cogitX64SysV.c or cogitIA32.c in the directory spur64src/vm/ and spursrc/vm ? Basically it seems cointerp.c in spur64src/vm/cointerp.c is using getReturnAddress() And this is ABI specific so should be in spur64src/vm/cogitX64SysV.c ?? (or cogitIA32.c?) right ? Anyway I tried your code (it is after all your choice), even if I don't quite like the idea of the assembly language inline. The code seems to compile and work for i386 (the easy case I think, since my understanding is the IA32 ABI makes this easier). I can open the Cog VM and run Squeak6.0alpha-19547-32bit.zip (image 32bit). However the X64 case is harder. That did not compile at first. It's been a long time that I've looked at assembly language, but the movl instruction is probably not the right one for %rax. I changed it to "movq" instead of "movl" and that seems to work. So good news is that with your suggested code, it works for 32bit and 64bit again on Solaris 11.4 . I say again because COG was already working on Solaris 11.4 until you made the change for the getReturnAddress. I tried on 64bit on Solaris 11.4 with Squeak6.0alpha-19793-64bit.image. David Stes -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJfZJAqAAoJEAwpOKXMq1Ma6nwH/jBal5veROR/lCBuZEZWkxuw mIQEO5pPeQX1Tndp9mBW982Bv7HWRguo11q51CIiwsFqK44zO/WolAhPqcpnOE13 W9buvj6ql73CzxuittmoqBx4IedbWHjWzfIYjLFjG0+E9l6BGOW+FygQkyJ4OS8o UW2qpilIndSL0ZNeiM7ph0Xcq/nVl0RDeH93ZCb6TGjNgm7YZfHTTGcGIk6dp0YF GpliX+nOACFFGfbhvRhhhYlQxo6RO50mdNtTfbQfc/kL4O3jQ+6J57+10puKCC4Z wl2qsd24tW06Lb1hbKGzXGG3mKE1VtYuHc2mYOlKY4qO0gNcERTPAZz3icwZl4U= =2Xay -----END PGP SIGNATURE----- ----- Op 18 sep 2020 om 6:20 schreef Eliot Miranda [hidden email]: > Hi David, > > On Thu, Sep 17, 2020 at 9:58 AM [hidden email] <[hidden email]> wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA256 >> >> >> Hi, >> >> Originally when I compiled on Solaris, I had both the "Cog" and "Stack" VM >> working. >> >> Unfortunately there was a change in april which breaks the "Cog" build. >> >> The "Stack" build continues to work fine for me. >> >> Since early april there is in the following file the following definition : >> >> platforms/Cross/vm/sq.h >> >> # define getReturnAddress() >> __builtin_extract_return_addr(__builtin_return_address(0)) >> >> Eliot Miranda wrote in the thread: >> >> http://forum.world.st/Broken-5-3-downloads-need-fixing-td5115132.html >> >> "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." >> >> Is there a compiler flag (#define) to re-enable the old code with >> setjmp/longjmp ? >> >> Or is there code in the 'platforms/Cross/vm/sqCog*' files >> that could help to implement the required function for 'return address', >> if that is not provided by the compiler ... ? >> >> I am hoping to re-enable the old setjmp/longjmp code. >> >> Also note that this may be useful for other users as well, >> to be able to 'revert' to the legacy old code. >> > > 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. The compiler supports gcc's inline extended > assembler right? In a normal frame on x86/x86_64 the frame pointer points > to the word below the return address, so would look like this: > > #if __GNUC__ || __clang__ > # if defined(_X86_) || defined(i386) || defined(__i386) || defined(__i386__) > # define getretaddr() ({ register usqIntptr_t retpc; \ > asm volatile ("movl 4(%%ebp),%0" : "=r"(retpc) : ); \ > retpc; }) > # 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) > # define getretaddr() ({ register usqIntptr_t retpc; \ > asm volatile ("movl 8(%%rbp),%0" : "=r"(retpc) : ); \ > retpc; }) > #endif > > 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? > > > >> Regards, >> David Stes >> >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v2 >> >> iQEcBAEBCAAGBQJfY5VfAAoJEAwpOKXMq1Ma9y8H/15hLjTf3aMfdFaPH1aoXNRK >> T61XZtbrOuykLH4IqLZpr85bQgtqdAdZqZ4tYtl8H00B4opoKZ+CVfruCDUoQEIJ >> uUYpJ9R8bp60DqQ147VakZaBzl7P9z2yn9mq6BGnb4sh/tSS743AIinURt+jqoKM >> MKxPf6cQn6r+fsvRNN+N5By9AIGco9t61SUqIcNzrdGRNwoaMOzc/4DfMYhPs6JT >> qyP3sJ0/LlJA7nhLSWmRNbkC2aJuYT4WCBTdEyNbs9lkv4CO8OOska8Y5YINgvpl >> FbwnyTABZzMdYuBIJevlB3RKPMTsn+ceFDfqcrDC7YzeVVWaZhhzV5wosjHenck= >> =bl73 >> -----END PGP SIGNATURE----- >> > > > -- > _,,,^..^,,,_ > best, Eliot |
Free forum by Nabble | Edit this page |