fitzgen opened Issue #1815:
Right now, we only insert them at (resumable) interrupt traps and calls:
But long running wasm could be in a loop, and if this loop doesn't make any calls or have interrupt traps, there will be no safepoints inserted, which in turn means that GC cannot happen inside this long-running wasm loop.
We should fix this by inserting
safepoint
s at loop headers.
fitzgen labeled Issue #1815:
Right now, we only insert them at (resumable) interrupt traps and calls:
But long running wasm could be in a loop, and if this loop doesn't make any calls or have interrupt traps, there will be no safepoints inserted, which in turn means that GC cannot happen inside this long-running wasm loop.
We should fix this by inserting
safepoint
s at loop headers.
fitzgen commented on Issue #1815:
Actually, now that I think about it, the loop header has to have some sort of check for whether the collector requested that the Wasm stop and synchronize for root marking or whatever. This synchronization will most likely will involve some kind of call, e.g
block0: gc_requested = i32.load <known offset from vmctx for the gc flag> brnz gc_requested, block2 fallthrough block1 block1: ... block2: call synchronize_with_gc jump block1
And in the case that a gc is requested, we call some
synchronize_with_gc
function, and this call will get asafepoint
inserted. So maybe everything is ok here?If we want to do the virtual memory tricks described in https://github.com/bytecodealliance/wasmtime/issues/1749 for gc synchronization, then we will need some extra work here though.
fitzgen closed Issue #1815:
Right now, we only insert them at (resumable) interrupt traps and calls:
But long running wasm could be in a loop, and if this loop doesn't make any calls or have interrupt traps, there will be no safepoints inserted, which in turn means that GC cannot happen inside this long-running wasm loop.
We should fix this by inserting
safepoint
s at loop headers.
github-actions[bot] commented on Issue #1815:
Subscribe to Label Action
cc @bnjbvr
<details>
This issue or pull request has been labeled: "cranelift"Thus the following users have been cc'd because of the following labels:
- bnjbvr: cranelift
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
Last updated: Dec 23 2024 at 12:05 UTC