Re: [OpenSmalltalk/opensmalltalk-vm] CogVM sources as per VMMaker.oscog-eem.2803 (1b896e9)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] CogVM sources as per VMMaker.oscog-eem.2803 (1b896e9)

David T Lewis
 

Hi Eliot,
unfortunately, it does not seem to work for mingw target (which is what we use, cygwin is just the compiling host, not the target).

../../spur64src/vm/gcc3x-cointerp.c:13681:41: error: too few arguments to function call, expected 2, have 1
if ((_setjmp(GIV(jmpBuf)[GIV(jmpDepth)])) == 0) {
~~~~~~~ ^
/usr/x86_64-w64-mingw32/sys-root/mingw/include/setjmp.h:242:3: note: '_setjmp' declared here
int __cdecl attribute ((nothrow,returns_twice)) _setjmp(jmp_buf _Buf, void *_Ctx);
^

Shouldn't we use a conflict-less osvm_setjmp and osvm_longjmp (or use sq prefix if you prefer) - and either define them as setjmp longjmp where it fits, or use our own implementation when it does not fit ?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

<script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/1b896e93195458099ac6cb27c5bb85dec66501d2#commitcomment-42122148", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/1b896e93195458099ac6cb27c5bb85dec66501d2#commitcomment-42122148", "name": "View Commit" }, "description": "View this Commit on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] CogVM sources as per VMMaker.oscog-eem.2803 (1b896e9)

David T Lewis
 

I has hoping I could fix this in platforms/Cross/vm/sqSetjmpShim.h but so far I have not been able to.

The issue is that mingw defines _setjmp, here's the definition that is used when clang is the compiler:

242 "/usr/x86_64-w64-mingw32/sys-root/mingw/include/setjmp.h" 3

int attribute((cdecl)) attribute ((nothrow,returns_twice))

So I tried a sqSetjmpShim.h like this:

#if !defined(_WIN32)

undef setjmp

undef longjmp

define setjmp _setjmp

define longjmp _longjmp

#endif
/* mingw redeclares _setjmp so we have to provide an alternative /
#if MINGW32 || MINGW64 /
clang on cygwin/mingw */
int attribute((nowthrow,returns_twice)) _setjmp0(jmp_buf);

undef _setjmp

define _setjmp _setjmp0

#endif

I know the code is being selected because if I preprocess via -E I see the declaration for _setjmp0. But the define of _setjmp is not seen and so invocations of _setjmp are not changed by the preprocessor into invocations of _setjmp0. Sigh...

A reason to prefer redefine _setjmp itself rather than adding our own non-conflicting version is that if any library code included in a plugin uses setjmp/longjmp then the longjmp will likely fail unless it uses our code.

The alternatives seem to be
a) try and figure out why sqSetjmpShim.h is unable to map _setjmp to _setjmp0 and fix this
b) if it cant be fixed, still define the symbols _setjmp and _setjmp0 in _setjmp-x64.asm (& _setjmp-x86.asm when we add it), have Slang emit osvm_setjmp and osvm_longjmp, and have sqSetjmpShim.h map osvm_setjmp and osvm_longjmp to _setjmp/_longjmp, and have _setjmp-x64.asm et al override all symbols for _setjmp/_longjmp, e.g.

    .text
    .globl setjmp
    .globl sigsetjmp
    .globl _setjmp
    .globl _setjmp0
    .p2align        4, 0x90

setjmp:
sigsetjmp:
_setjmp:
_setjmp0:
....


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

<script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/1b896e93195458099ac6cb27c5bb85dec66501d2#commitcomment-42130255", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/1b896e93195458099ac6cb27c5bb85dec66501d2#commitcomment-42130255", "name": "View Commit" }, "description": "View this Commit on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] CogVM sources as per VMMaker.oscog-eem.2803 (1b896e9)

David T Lewis
In reply to this post by David T Lewis
 

Ah OK, what we can do is define our own osvm_setjmp in the .asm, then #define setjmp osvm_setjmp when #ifdef WIN64, and use setjmp instead of _setjmp in VMMaker... Can it work?

I don't think that using _setjmp directly in VMMaker is a good idea because too much implementation specific anyway.

The cygwin/mingw makefiles must also be fixed for using the .asm, currently they do not.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

<script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/1b896e93195458099ac6cb27c5bb85dec66501d2#commitcomment-42146642", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/1b896e93195458099ac6cb27c5bb85dec66501d2#commitcomment-42146642", "name": "View Commit" }, "description": "View this Commit on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>