Skip to content
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

Merged
merged 6 commits into from
Feb 28, 2018
Merged

WASM: Atomic load/store #4470

merged 6 commits into from
Feb 28, 2018

Conversation

Cellule
Copy link
Contributor

@Cellule Cellule commented Dec 22, 2017

Implement wasm atomic load/store operations.
Related #3477


This change is Reviewable

@Cellule Cellule self-assigned this Dec 22, 2017
@Cellule
Copy link
Contributor Author

Cellule commented Dec 22, 2017

@Microsoft/chakra-jit I could use some of you for the review

@Cellule
Copy link
Contributor Author

Cellule commented Jan 10, 2018

ping

1 similar comment
@Cellule
Copy link
Contributor Author

Cellule commented Feb 20, 2018

ping

Copy link
Contributor

@Penguinwizzard Penguinwizzard left a 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
Copy link
Contributor

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);
Copy link
Contributor

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?

Copy link
Contributor Author

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())
Copy link
Contributor

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.

Copy link
Contributor Author

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`
@chakrabot chakrabot merged commit 07b0be8 into chakra-core:master Feb 28, 2018
chakrabot pushed a commit that referenced this pull request Feb 28, 2018
Merge pull request #4470 from Cellule:wasm/atomics

Implement wasm atomic load/store operations.
@Cellule Cellule deleted the wasm/atomics branch February 28, 2018 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants