First stab at having the GC scan the shadow stack.#5
Conversation
This comes with the caveat that each thread scans all other threads shadow stacks, which may not be completely safe(?). With this, and recent ykllvm/yk changes, this mandelbrot benchmark now runs: https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/fannkuchredux-python3-6.html (If you run with YKD_SERIALISE_COMPILATION=1 however, I get an unimplemented ptrtoint constant expression -- this isn't hard to implement)
|
There's a part of the code where micropython signals another thread (literally a UNIX signal) to scan it's own stack, so we might take that as a cue to do this properly? Not sure. |
|
Scanning other threads' stacks isn't safe in general, but it's fine for now. I think we should undraft this and get it in. |
|
FWIW, here's the code I was referencing: ykmicropython/ports/unix/mpthreadport.c Lines 188 to 212 in 900ae4a |
|
I'm assuming this is probably a stop-the-world GC, so this should be simple, especially given that code segment. But we can finesse this next week. |
|
I think we just need a yk API to get the current thread's shadow stack memory range. At the moment we can only get all threads shadow stacks. But I'm not a GC guy :) |
|
Anyway, undrafted |
This comes with the caveat that each thread scans all other threads shadow stacks, which may not be completely safe(?)
With this, and recent ykllvm/yk changes, this mandelbrot benchmark now runs:
https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/fannkuchredux-python3-6.html
(If you run with YKD_SERIALISE_COMPILATION=1 however, I get an unimplemented ptrtoint constant expression -- this isn't hard to implement)