RESOLVED FIXED 208490
Implement 1GB of executable memory on arm64
https://bugs.webkit.org/show_bug.cgi?id=208490
Summary Implement 1GB of executable memory on arm64
Saam Barati
Reported 2020-03-02 17:26:50 PST
...
Attachments
WIP (25.30 KB, patch)
2020-03-03 13:08 PST, Saam Barati
no flags
WIP (31.02 KB, patch)
2020-03-03 18:30 PST, Saam Barati
no flags
WIP (34.82 KB, patch)
2020-03-03 21:25 PST, Saam Barati
no flags
WIP (15.18 KB, patch)
2020-03-04 19:31 PST, Saam Barati
no flags
WIP (15.86 KB, patch)
2020-03-05 12:44 PST, Saam Barati
no flags
WIP (21.37 KB, patch)
2020-03-05 20:03 PST, Saam Barati
no flags
WIP (22.24 KB, patch)
2020-03-06 17:53 PST, Saam Barati
no flags
WIP (22.98 KB, patch)
2020-03-06 19:00 PST, Saam Barati
no flags
WIP (61.82 KB, patch)
2020-03-08 14:08 PDT, Saam Barati
no flags
WIP (61.83 KB, patch)
2020-03-08 14:12 PDT, Saam Barati
no flags
WIP (62.68 KB, patch)
2020-03-08 14:22 PDT, Saam Barati
no flags
WIP (66.27 KB, patch)
2020-03-09 18:34 PDT, Saam Barati
no flags
WIP (66.14 KB, patch)
2020-03-09 20:16 PDT, Saam Barati
no flags
WIP (83.06 KB, patch)
2020-03-10 16:04 PDT, Saam Barati
no flags
patch (115.96 KB, patch)
2020-03-12 13:07 PDT, Saam Barati
no flags
patch (115.96 KB, patch)
2020-03-12 13:14 PDT, Saam Barati
no flags
patch (116.72 KB, patch)
2020-03-12 14:23 PDT, Saam Barati
no flags
patch (116.84 KB, patch)
2020-03-12 14:28 PDT, Saam Barati
no flags
patch (120.59 KB, patch)
2020-03-12 14:37 PDT, Saam Barati
no flags
patch (122.24 KB, patch)
2020-03-12 19:06 PDT, Saam Barati
no flags
patch (122.57 KB, patch)
2020-03-12 19:34 PDT, Saam Barati
no flags
patch (123.26 KB, patch)
2020-03-12 20:50 PDT, Saam Barati
keith_miller: review+
patch for landing (132.38 KB, patch)
2020-03-25 13:18 PDT, Saam Barati
no flags
patch for landing (132.38 KB, patch)
2020-03-26 12:29 PDT, Saam Barati
no flags
Saam Barati
Comment 1 2020-03-03 13:08:55 PST
Created attachment 392317 [details] WIP It begins
Saam Barati
Comment 2 2020-03-03 18:30:25 PST
Saam Barati
Comment 3 2020-03-03 21:25:25 PST
Saam Barati
Comment 4 2020-03-04 19:31:58 PST
Saam Barati
Comment 5 2020-03-05 12:44:54 PST
Saam Barati
Comment 6 2020-03-05 20:03:45 PST
Saam Barati
Comment 7 2020-03-06 17:53:34 PST
Created attachment 392822 [details] WIP Seems to work. Now, I need to implement freeing islands and pick the correct region sizes.
Saam Barati
Comment 8 2020-03-06 19:00:15 PST
Saam Barati
Comment 9 2020-03-08 14:08:22 PDT
Saam Barati
Comment 10 2020-03-08 14:12:01 PDT
Saam Barati
Comment 11 2020-03-08 14:22:55 PDT
Saam Barati
Comment 12 2020-03-09 18:34:12 PDT
Created attachment 393107 [details] WIP I think it might be complete. Time to clean up the code
Saam Barati
Comment 13 2020-03-09 20:16:06 PDT
Created attachment 393118 [details] WIP I need to make jump islands work with live repatching wasm code. Currently, we might load the wrong thing from the icache :-(
Saam Barati
Comment 14 2020-03-10 16:04:51 PDT
Saam Barati
Comment 15 2020-03-10 16:06:42 PDT
(In reply to Saam Barati from comment #14) > Created attachment 393184 [details] > WIP I solved my wasm bug. Turns out, when hot patching code concurrently, you need to do a few things to not SIGILL (surprise surprise...). I need to clean up the code again after my wasm debugging session, and then it should be ready for reviews. Running JS2, and using the random allocation algorithm, our max jump island utilization rate is about 1%. So if we use 16MB, we should have a lot of leeway.
Saam Barati
Comment 16 2020-03-12 13:07:53 PDT
Saam Barati
Comment 17 2020-03-12 13:14:46 PDT
Saam Barati
Comment 18 2020-03-12 14:23:14 PDT
Created attachment 393412 [details] patch try to fix testwtf build error
Saam Barati
Comment 19 2020-03-12 14:28:08 PDT
Created attachment 393413 [details] patch testwtf build fix take 2
Saam Barati
Comment 20 2020-03-12 14:37:34 PDT
Created attachment 393415 [details] patch testwtf build fix take 3
Saam Barati
Comment 21 2020-03-12 19:06:22 PDT
Saam Barati
Comment 22 2020-03-12 19:34:00 PDT
Saam Barati
Comment 23 2020-03-12 20:50:13 PDT
Keith Miller
Comment 24 2020-03-13 11:31:51 PDT
Comment on attachment 393449 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=393449&action=review r=me if you make the requested changes and fix Win build. > Source/JavaScriptCore/jit/ExecutableAllocator.cpp:113 > +#if USE(JUMP_ISLANDS) > +static constexpr size_t fixedExecutableMemoryPoolSize = 1 * 1024 * 1024 * 1024; > +// These sizes guarantee that any jump within an island can jump forwards or backwards > +// to the adjacent island in a single instruction. > +static constexpr size_t regionSize = 112 * 1024 * 1024; > +static constexpr size_t islandRegionSize = 16 * 1024 * 1024; > +static constexpr size_t numberOfRegions = fixedExecutableMemoryPoolSize / regionSize; > +static constexpr size_t islandSizeInBytes = 4; > +static constexpr size_t maxIslandsPerRegion = islandRegionSize / islandSizeInBytes; > +#else > static constexpr size_t fixedExecutableMemoryPoolSize = 128 * 1024 * 1024; > +#endif > #elif CPU(X86_64) > -static constexpr size_t fixedExecutableMemoryPoolSize = 1024 * 1024 * 1024; > +static constexpr size_t fixedExecutableMemoryPoolSize = 1 * 1024 * 1024 * 1024; Can we switch to using the MB/GB constants here? > Source/JavaScriptCore/jit/ExecutableAllocator.cpp:815 > + CodeLocationLabel<ExecutableMemoryPtrTag> rootJumpLocation; Can we call this jumpSourceLocation? rootJumpLocation doesn't really make it clear what this is to me. I thought it was the destination for a while, which clearly would have been borked. > Source/JavaScriptCore/jit/ExecutableAllocator.cpp:824 > + RedBlackTree<Islands, void*> islandsForJumpLocation; ditto on changing this to m_islandsForJumpSourceLocation. You also don't have an m_ prefix which is weird. > Source/JavaScriptCore/wasm/WasmBBQPlan.cpp:173 > + for (unsigned i = 0; i < m_codeBlock->m_wasmToWasmCallsites.size(); ++i) { > + stageRepatch(m_codeBlock->m_wasmToWasmCallsites[i]); > + if (m_codeBlock->m_llintCallees) { > + LLIntCallee& llintCallee = m_codeBlock->m_llintCallees->at(i).get(); > + if (JITCallee* replacementCallee = llintCallee.replacement()) > + stageRepatch(replacementCallee->wasmToWasmCallsites()); > + if (OMGForOSREntryCallee* osrEntryCallee = llintCallee.osrEntryCallee()) > + stageRepatch(osrEntryCallee->wasmToWasmCallsites()); > + } > + if (BBQCallee* bbqCallee = m_codeBlock->m_bbqCallees[i].get()) { > + if (OMGCallee* replacementCallee = bbqCallee->replacement()) > + stageRepatch(replacementCallee->wasmToWasmCallsites()); > + if (OMGForOSREntryCallee* osrEntryCallee = bbqCallee->osrEntryCallee()) > + stageRepatch(osrEntryCallee->wasmToWasmCallsites()); > + } > + } Seems like we could have some code deduplication between the different plans... Can you do that? > Tools/ChangeLog:8 > + * Scripts/run-jsc-stress-tests: I think you need to update this for the TestWTF changes? Can you also add a TestWTF for RedBlackTree::iterate?
Radar WebKit Bug Importer
Comment 25 2020-03-23 16:05:19 PDT
Saam Barati
Comment 26 2020-03-25 12:26:41 PDT
I'm addressing Keith's comments.
Saam Barati
Comment 27 2020-03-25 13:18:17 PDT
Created attachment 394534 [details] patch for landing
Saam Barati
Comment 28 2020-03-26 12:29:44 PDT
Created attachment 394639 [details] patch for landing
EWS
Comment 29 2020-04-06 11:19:57 PDT
Committed r259582: <https://trac.webkit.org/changeset/259582> All reviewed patches have been landed. Closing bug and clearing flags on attachment 394639 [details].
Note You need to log in before you can comment on or make changes to this bug.