-
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
WASM: Atomic load/store #4470
WASM: Atomic load/store #4470
Conversation
@Microsoft/chakra-jit I could use some of you for the review |
b7da005
to
65a14e0
Compare
773d654
to
f37c4b5
Compare
ping |
1 similar comment
ping |
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.
LGTM
IR::Instr* | ||
Lowerer::LowerStAtomicsWasm(IR::Instr* instr) | ||
{ | ||
#ifdef ENABLE_WASM |
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.
nit: If we know at compile time that we don't have WASM enabled, why do we even have this function defined? Shouldn't we wrap the whole function definition to catch issues at link-time instead of at run-time?
Assert(IRType_IsNativeInt(dst->GetType())); | ||
|
||
IR::Instr * done = LowerWasmArrayBoundsCheck(instr, dst); | ||
m_lowererMD.LowerAtomicStore(dst, src1, done); |
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.
nit: Without knowing that LowerWasmArrayBoundsCheck returns a pointer to an instruction that is after the check, this looks like we're putting the store before the bounds check. Not really a problem if you know what's going on, but maybe could be a little clearer?
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 you're right. There is something off about that api as a whole.
I created issue #4751 to track cleaning this up.
// Move src1 to a register of the same type as dst | ||
IR::RegOpnd* tmpSrc = IR::RegOpnd::New(dst->GetType(), func); | ||
Lowerer::InsertMove(tmpSrc, src1, insertBeforeInstr); | ||
if (dst->IsInt64()) |
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.
nit: Maybe put in an assert to make sure that we don't get float dsts, since the spec and this code doesn't support them yet, but not high-priority.
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.
done
Cleanup Uses of ArrayBufferView type
Extract atomics operations from TypedArray.cpp in AtomicsOperations.cpp then share the atomics code for TypedArray and Wasm Add encoding of CMPXCHG8B which has 2 dst and 5 sources
Move generated spec test to `chakra_generated`
fc40797
to
07b0be8
Compare
Implement wasm atomic load/store operations.
Related #3477
This change is