[OpenSmalltalk/opensmalltalk-vm] Patch callback thunkEntry to not optimize (#353)

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

[OpenSmalltalk/opensmalltalk-vm] Patch callback thunkEntry to not optimize (#353)

David T Lewis
 

O2 and O1 compilation produce a segmentation fault due to stack corruption (when debugging we saw some extra pushes from the stack) on callbacks return. This happens on windows 32, when compiling with mingw gcc 7.4.0.

The issue can be reproduced easily by running the Alien qsort example in latest vms in both Pharo and Squeak.

This PR proposes to patch just the thunkEntry function. Not optimizing just that function solves the issue in our environment, though maybe there is a more fine-grained solution. We should still investigate what is the particular optimization that causes the problem.


You can view, comment on, or merge this pull request online at:

  https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/353

Commit Summary

  • Patch callback thunkEntry to not optimize, failing in win32 using gcc 7.4.0

File Changes

Patch Links:


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

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Patch callback thunkEntry to not optimize (#353)"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/353"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/353", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/353", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Patch callback thunkEntry to not optimize (#353)

David T Lewis
 

Sounds good.
Note that Alien exampleCqsort works when VM is compiled with mvm -f and clang...
Just change the default compiler in https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/build.win32x86/common/Makefile.tools

I'm using this version which seems up-to-date on cygwin distrib:

$ i686-w64-mingw32-clang --version
clang version 5.0.1 (tags/RELEASE_501/final)
Target: i686-w64-windows-gnu
Thread model: posix
InstalledDir: /usr/bin


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

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@nicolas-cellier-aka-nice in #353: Sounds good.\r\nNote that `Alien exampleCqsort` works when VM is compiled with `mvm -f` and clang...\r\nJust change the default compiler in https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/build.win32x86/common/Makefile.tools\r\n\r\nI'm using this version which seems up-to-date on cygwin distrib:\r\n\r\n\u003e $ i686-w64-mingw32-clang --version\r\n\u003e clang version 5.0.1 (tags/RELEASE_501/final)\r\n\u003e Target: i686-w64-windows-gnu\r\n\u003e Thread model: posix\r\n\u003e InstalledDir: /usr/bin\r\n"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/353#issuecomment-455515414"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/353#issuecomment-455515414", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/353#issuecomment-455515414", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Patch callback thunkEntry to not optimize (#353)

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

Merged #353 into Cog.


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

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Merged #353 into Cog."}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/353#event-2090132581"}}}</script> <script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/353#event-2090132581", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/353#event-2090132581", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Patch callback thunkEntry to not optimize (#353)

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

qsort still SEGFAULTs for me when compiled via Cygwin with gcc-Version 10.2.0 (GCC) in production mode (./mvm -f). :-(

When trying to qsort a list of 10 floats, the first callback is fine but the second callback has a different address for the callback context -- which should not happen -- and shows bogus values for the stack arguments. Maybe it is related to some sort of stack optimization?

Works fine with DEBUG build, does also SEGFAULT with ASSERT build.


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/pull/353#issuecomment-830607945", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/353#issuecomment-830607945", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>