binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

Fix two issues in --spill-pointers

Open juj opened this issue 3 years ago • 5 comments

Fix two issues in --spill-pointers: 1) properly generate the stack frame in a stack-grows-downwards manner, and 2) do not spill pointers in the functions stackAlloc()/stackSave()/stackRestore(), which should operate on the global stack pointer without a stack frame of their own.

juj avatar Dec 02 '22 18:12 juj

What is the status of this patch? Has anyone investigated the CI failures? Thanks for working on this @juj! It looks helpful.

hoodmane avatar Mar 20 '23 10:03 hoodmane

Took quite a bit of time to get back to looking into GC on Emscripten..

I see that in current main branch, the issue 1) has already been fixed.

So I reset this branch now on top of latest main, and only kept the second fix

"2) do not spill pointers in the functions stackAlloc()/stackSave()/stackRestore(), which should operate on the global stack pointer without a stack frame of their own."

from the original code.

I am developing a small toy garbage collector to test things out, and with this Binaryen PR landed, it is now working properly to scan the local stack and global static data section.

juj avatar Feb 20 '24 22:02 juj

I am testing this out against https://github.com/juj/emgc to prototype garbage collection against Emscripten. The plan is to experiment with multithreaded garbage collection from multiple managed threads, with cooperative stop-the-world signaling, and then try to transplant the whole thing back to Boehm, or something like that.

juj avatar Feb 20 '24 22:02 juj

@juj Are you aiming to get this approved and landed here in upstream, or is this just for experimentation at this time?

kripken avatar Feb 20 '24 23:02 kripken

This is now for experimentation, though I'll try to work towards test cases on the stackAlloc issue to make sure I'm proposing a fix that patches that issue.

juj avatar Feb 21 '24 16:02 juj