Bug 169704

Summary: WebAssembly: When we GC to try to get a fast memory, we should call collectAllGarbage(), not collectSync()
Product: WebKit Reporter: Saam Barati <saam>
Component: JavaScriptCoreAssignee: Saam Barati <saam>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, commit-queue, fpizlo, ggaren, gskachkov, jfbastien, keith_miller, mark.lam, msaboff, ticaiolima, ysuzuki
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
patch none

Saam Barati
Reported 2017-03-15 15:36:37 PDT
Otherwise we won't actually end up getting the memory because we don't do any sweeping.
Attachments
patch (1.85 KB, patch)
2017-03-15 15:41 PDT, Saam Barati
no flags
patch (1.96 KB, patch)
2017-03-15 15:42 PDT, Saam Barati
no flags
Saam Barati
Comment 1 2017-03-15 15:41:17 PDT
Saam Barati
Comment 2 2017-03-15 15:42:32 PDT
Mark Lam
Comment 3 2017-03-15 15:43:31 PDT
Comment on attachment 304564 [details] patch r=me
WebKit Commit Bot
Comment 4 2017-03-15 16:17:18 PDT
Comment on attachment 304564 [details] patch Clearing flags on attachment: 304564 Committed r214018: <http://trac.webkit.org/changeset/214018>
WebKit Commit Bot
Comment 5 2017-03-15 16:17:24 PDT
All reviewed patches have been landed. Closing bug.
Filip Pizlo
Comment 6 2017-03-15 16:35:52 PDT
Comment on attachment 304564 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=304564&action=review > Source/JavaScriptCore/wasm/WasmMemory.cpp:123 > - vm.heap.collectSync(); > + vm.heap.collectAllGarbage(); > return dequeFastMemory(); This is sad - isn't this whole thing part of some promise anyway? Seems like waiting for the GC to finish should be part of the promise.
Saam Barati
Comment 7 2017-03-15 16:43:42 PDT
(In reply to comment #6) > Comment on attachment 304564 [details] > patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=304564&action=review > > > Source/JavaScriptCore/wasm/WasmMemory.cpp:123 > > - vm.heap.collectSync(); > > + vm.heap.collectAllGarbage(); > > return dequeFastMemory(); > > This is sad - isn't this whole thing part of some promise anyway? Seems > like waiting for the GC to finish should be part of the promise. I see what you're getting at here, but I think it's somewhat tricky to do. We would need a two-level strategy. Call collectSync, then set up a promise to be called when things get swept, then set up another promise when we're done compiling. I'm not sure exactly how to do that. It might be worth doing as part of Keith's work on async compilation, but we also don't expect this code to run very often.
Filip Pizlo
Comment 8 2017-03-15 16:55:18 PDT
(In reply to comment #7) > (In reply to comment #6) > > Comment on attachment 304564 [details] > > patch > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=304564&action=review > > > > > Source/JavaScriptCore/wasm/WasmMemory.cpp:123 > > > - vm.heap.collectSync(); > > > + vm.heap.collectAllGarbage(); > > > return dequeFastMemory(); > > > > This is sad - isn't this whole thing part of some promise anyway? Seems > > like waiting for the GC to finish should be part of the promise. > > I see what you're getting at here, but I think it's somewhat tricky to do. > We would need a two-level strategy. Call collectSync, then set up a promise > to be called when things get swept, then set up another promise when we're > done compiling. I'm not sure exactly how to do that. It might be worth doing > as part of Keith's work on async compilation, but we also don't expect this > code to run very often. Right, we would need the incremental sweeper to run more aggressively and we would want it to notify us when done. Worth filing a bug.
Saam Barati
Comment 9 2017-03-15 17:36:45 PDT
(In reply to comment #8) > (In reply to comment #7) > > (In reply to comment #6) > > > Comment on attachment 304564 [details] > > > patch > > > > > > View in context: > > > https://bugs.webkit.org/attachment.cgi?id=304564&action=review > > > > > > > Source/JavaScriptCore/wasm/WasmMemory.cpp:123 > > > > - vm.heap.collectSync(); > > > > + vm.heap.collectAllGarbage(); > > > > return dequeFastMemory(); > > > > > > This is sad - isn't this whole thing part of some promise anyway? Seems > > > like waiting for the GC to finish should be part of the promise. > > > > I see what you're getting at here, but I think it's somewhat tricky to do. > > We would need a two-level strategy. Call collectSync, then set up a promise > > to be called when things get swept, then set up another promise when we're > > done compiling. I'm not sure exactly how to do that. It might be worth doing > > as part of Keith's work on async compilation, but we also don't expect this > > code to run very often. > > Right, we would need the incremental sweeper to run more aggressively and we > would want it to notify us when done. > > Worth filing a bug. Filed: https://bugs.webkit.org/show_bug.cgi?id=169728
Note You need to log in before you can comment on or make changes to this bug.