-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix entry tier-up SIMD check in BBQ baseline JIT #10383
Fix entry tier-up SIMD check in BBQ baseline JIT #10383
Conversation
@@ -5733,13 +5733,13 @@ class BBQJIT { | |||
Jump tierUp = m_jit.branchAdd32(CCallHelpers::PositiveOrZero, TrustedImm32(TierUpCount::functionEntryIncrement()), Address(m_scratchGPR)); | |||
MacroAssembler::Label tierUpResume = m_jit.label(); | |||
auto functionIndex = m_functionIndex; | |||
addLatePath([tierUp, tierUpResume, functionIndex](BBQJIT&, CCallHelpers& jit) { | |||
bool isSIMD = m_isSIMD; |
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 should get this when late path is executed. notifyFunctionUsesSIMD
is not called yet when emitEntryTierUpCheck
is called.
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.
It should be called before addTopLevel
, so it'll be true if any of our arguments or locals are SIMD (which I think is all we need to handle entry tier-up correctly?). But I do agree it's a better, less fragile solution to move the capture (although capturing members is a pain). I'll fix it up.
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.
It is possible that body can include SIMD operations and it generates V128 temp (not local).
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.
Should be resolved in the latest push!
tierUp.link(&jit); | ||
jit.move(TrustedImm32(functionIndex), GPRInfo::argumentGPR1); | ||
MacroAssembler::Call call = jit.nearCall(); | ||
jit.jump(tierUpResume); | ||
|
||
bool isSIMD = false; // TODO: Support SIMD |
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.
So, here, let's get m_isSIMD
from BBQJIT.
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.
So,
bool isSIMD = generator.m_isSIMD;
and capture this bool
in jit.addLinkTask
's lambda.
generator
should be BBQJIT&
which is passed to addLatePath
's lambda.
10436be
to
44c6953
Compare
jit.addLinkTask([=, this] (LinkBuffer& linkBuffer) { | ||
MacroAssembler::repatchNearCall(linkBuffer.locationOfNearCall<NoPtrTag>(call), CodeLocationLabel<JITThunkPtrTag>(Thunks::singleton().stub(triggerOMGEntryTierUpThunkGenerator(this->m_isSIMD)).code())); |
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 think we cannot use this
in LinkTask since BBQJIT is already destroyed at that time.
So, see https://github.com/WebKit/WebKit/pull/10383/files#r1112305847, let's get isSIMD at that time, and pass it here.
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.
Oh good catch! Sorry, makes sense.
@@ -5733,15 +5733,14 @@ class BBQJIT { | |||
Jump tierUp = m_jit.branchAdd32(CCallHelpers::PositiveOrZero, TrustedImm32(TierUpCount::functionEntryIncrement()), Address(m_scratchGPR)); | |||
MacroAssembler::Label tierUpResume = m_jit.label(); | |||
auto functionIndex = m_functionIndex; | |||
addLatePath([tierUp, tierUpResume, functionIndex](BBQJIT&, CCallHelpers& jit) { | |||
addLatePath([tierUp, tierUpResume, functionIndex, this](BBQJIT&, CCallHelpers& jit) { |
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.
Instead of capturing this
, use BBQJIT&
's parameter.
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.
This is probably best. Added it in the latest push.
EWS run on previous version of this PR (hash 44c6953)
|
44c6953
to
701f658
Compare
EWS run on current version of this PR (hash 701f658)
|
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
Land it since new BBQ is not tested yet. |
https://bugs.webkit.org/show_bug.cgi?id=252590 rdar://105689397 Currently, the new WebAssembly BBQ baseline JIT always passes false for the isSIMD parameter when calling into the OMG tier-up trigger thunk. This patch makes it so we track whether the function is a SIMD function using notifyFunctionUsesSIMD(), and pass that into the thunk generator, ensuring we preserve any SIMD registers used to pass arguments to the function. Reviewed by Yusuke Suzuki. * Source/JavaScriptCore/wasm/WasmBBQJIT.cpp: (JSC::Wasm::BBQJIT::emitEntryTierUpCheck): (JSC::Wasm::BBQJIT::notifyFunctionUsesSIMD): Canonical link: https://commits.webkit.org/260562@main
701f658
to
f6adb76
Compare
Committed 260562@main (f6adb76): https://commits.webkit.org/260562@main Reviewed commits have been landed. Closing PR #10383 and removing active labels. |
f6adb76
701f658
π iosπ macπ wpeπ wincairoπ ios-simπ gtkπ§ͺ ios-wk2π§ͺ api-macπ§ͺ gtk-wk2π§ͺ api-iosπ§ͺ mac-wk1π§ͺ api-gtkπ π§ͺ jscπ tvπ§ͺ mac-wk2π jsc-armv7π π§ͺ jsc-arm64π tv-simπ§ͺ mac-AS-debug-wk2π§ͺ jsc-armv7-testsπ watchπ§ͺ mac-wk2-stressπ jsc-mipsπ watch-simπ§ͺ jsc-mips-tests