On 12/31/05, Juho Snellman jsnell@iki.fi wrote:
luismbo@gmail.com wrote:
We're not even testing if the callback moves or not. Our libtest is not saving the callbacks' address.
Here's the a testcase, using sb-alien (sort of):
Thanks. The problem is that the callback support assumes that #'SB-VM::ENTER-ALIEN-CALLBACK can never move [*]. Which is no longer true on x86 and x86-64 as of a few releases ago, since everything is in the dynamic space by default, and will get relocated when the core is saved [**].
Okay, that makes sense now. Any pointers to the discussion of why purify doesn't happen by default anymore on those platforms? (curious).
A workaround is to run PURIFY once before creating any callbacks. The proper solution would be adding a level of indirection into the generated callback wrappers. Maybe make 'SB-VM::ENTER-ALIEN-CALLBACK a static symbol, so that it will be guaranteed to not move, and then emit instructions to peek into its symbol-function slot.
The layout of symbols is unlikely to change soon, so that will work fine. But another option would be to cater to what the trampolines do now and move the ENTER-ALIEN-CALLBACK function to static space.
On Sun, Jan 01, 2006 at 12:04:40PM +0100, Thomas F. Burdick wrote:
On 12/31/05, Juho Snellman jsnell@iki.fi wrote:
Thanks. The problem is that the callback support assumes that #'SB-VM::ENTER-ALIEN-CALLBACK can never move [*]. Which is no longer true on x86 and x86-64 as of a few releases ago, since everything is in the dynamic space by default, and will get relocated when the core is saved [**].
Okay, that makes sense now. Any pointers to the discussion of why purify doesn't happen by default anymore on those platforms? (curious).
It's a performance thing. The static space doesn't have a write barrier, and so needs to be scavenged completely on every GC.
http://ww.telent.net/diary/2003/12/#21.34500 http://www.iki.fi/jsnell/blog/archive/2005-05-12.html
The layout of symbols is unlikely to change soon, so that will work fine. But another option would be to cater to what the trampolines do now and move the ENTER-ALIEN-CALLBACK function to static space.
I don't think we have any simple way of moving a single function into the static space. Attached patch implements my suggestion on x86 and x86-64 (with the exception that it uses the symbol-value slot, since the symbol-function slot doesn't actually exist).