New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REGRESSION (iOS 16): RELEASE_ASSERT in slow_path_wasm_loop_osr #2105
REGRESSION (iOS 16): RELEASE_ASSERT in slow_path_wasm_loop_osr #2105
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with comments.
// as BBQ Air bloats such lengthy Wasm code and will consume a large amount of executable memory. | ||
bool forceUsingB3 = false; | ||
if (Options::webAssemblyBBQAirModeThreshold() && moduleInformation->codeSectionSize >= Options::webAssemblyBBQAirModeThreshold()) | ||
forceUsingB3 = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do early return return true;
// FIXME: Some webpages use very large Wasm module, and it exhausts all executable memory in ARM64 devices since the size of executable memory region is only limited to 128MB. | ||
// The long term solution should be to introduce a Wasm interpreter. But as a short term solution, we introduce heuristics to switch back to BBQ B3 at the sacrifice of start-up time, | ||
// as BBQ Air bloats such lengthy Wasm code and will consume a large amount of executable memory. | ||
bool forceUsingB3 = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need to have this variable.
else if (!Options::wasmBBQUsesAir()) | ||
forceUsingB3 = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make it
if (!Options::wasmBBQUsesAir())
return true;
forceUsingB3 = true; | ||
else if (!Options::wasmBBQUsesAir()) | ||
forceUsingB3 = true; | ||
return forceUsingB3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make it return false
by converting the above if-else into early return.
@@ -75,6 +75,8 @@ class BBQPlan final : public EntryPlan { | |||
return Base::parseAndValidateModule(m_source.data(), m_source.size()); | |||
} | |||
|
|||
static bool forceUsingB3(Ref<ModuleInformation>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's take const ModuleInformation&
@@ -60,6 +60,19 @@ BBQPlan::BBQPlan(Context* context, Ref<ModuleInformation> moduleInformation, uin | |||
dataLogLnIf(WasmBBQPlanInternal::verbose, "Starting BBQ plan for ", functionIndex); | |||
} | |||
|
|||
bool BBQPlan::forceUsingB3(Ref<ModuleInformation> moduleInformation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's take const ModuleInformation&
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest naming this function planGeneratesLoopOSREntrypoints or something along those lines.
forceUsingB3 = true; | ||
|
||
if (forceUsingB3) | ||
if (forceUsingB3(m_moduleInformation)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's pass it by
if (forceUsingB3(m_moduleInformation.get()))
Let's remove the test changes, I can land my test case separately. |
Thanks, followed all of your suggestions. |
Will put |
Thanks! I think I got a bit confused, the function name is currently inverted. So maybe flip the condition or negate the name of |
Flipped the condition. |
https://bugs.webkit.org/show_bug.cgi?id=242294 Reviewed by Yusuke Suzuki. Fix a regression caused by https://bugs.webkit.org/show_bug.cgi?id=234587. This affected only iOS, and only when the WebAssembly module was greater than 10 MB. In that case, the option `webAssemblyBBQAirModeThreshold` caused JavaScriptCore/wasm/WasmBBQPlan.cpp to fall back from Air to B3. However, the change in 234587 in `loop_osr` didn't correctly handle that fallback. Changed it to use the old code path in this case. Test: None (to be added later by @justinmichaud) * Source/JavaScriptCore/wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::planGeneratesLoopOSREntrypoints): Extracted from compileFunction. (JSC::Wasm::BBQPlan::compileFunction): * Source/JavaScriptCore/wasm/WasmBBQPlan.h: * Source/JavaScriptCore/wasm/WasmSlowPaths.cpp: (JSC::LLInt::WASM_SLOW_PATH_DECL): If planGeneratesLoopOSREntrypoints, use the old code path. Canonical link: https://commits.webkit.org/252167@main
f688bc8
to
a1935ab
Compare
Committed 252167@main (a1935ab): https://commits.webkit.org/252167@main Reviewed commits have been landed. Closing PR #2105 and removing active labels. |
a1935ab