Bug 170360

Summary: WebAssembly: downgrade likely unused fast memory modules to slow memory
Product: WebKit Reporter: JF Bastien <jfbastien>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: fpizlo, ggaren, jfbastien, keith_miller, mark.lam, msaboff, sbarati
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 159775    

Description JF Bastien 2017-03-31 14:05:56 PDT
In setting where we have a limited number of fast memories, it's possible that the GC inadvertently keeps one alive by keeping the WebAssemblyInstance alive. That's a bummer because we're wasting a precious fast memory. We could have a heuristic to figure out whether an Instance executes at all (counters on function entry, or from JS exports, or when the GC scans the stack) and if we think an Instance is dead the downgrade it to a BoundsChecking memory instead. This requires changing its mode, deleting all its code, and making damn sure none of the code is currently on a call stack. Or performing OSR.

This is a lot of work and may not be worth it, but let's keep it in mind.