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

Add support for atomic operations, excluding wait and notify, to singlepass. #831

Merged
merged 14 commits into from
Oct 3, 2019

Conversation

nlewycky
Copy link
Contributor

@nlewycky nlewycky commented Sep 24, 2019

Description

Adds support for atomic operations, excluding wait and notify, to singlepass. Enable with --enable-threads.

Review

  • Add a short description of the the change to the CHANGELOG.md file

@nlewycky
Copy link
Contributor Author

bors try

bors bot added a commit that referenced this pull request Sep 24, 2019
@bors
Copy link
Contributor

bors bot commented Sep 24, 2019

try

Build succeeded

  • wasmerio.wasmer

@@ -562,15 +566,15 @@ impl Emitter for Assembler {
(Size::S64, Location::Memory(src, disp), Location::GPR(dst)) => {
dynasm!(self ; lea Rq(dst as u8), [Rq(src as u8) + disp]);
}
_ => unreachable!(),
_ => panic!("LEA {:?} {:?} {:?}", sz, src, dst),
Copy link
Member

@syrusakbary syrusakbary Sep 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make the panics a bit more descriptive?

Just appending singlepass reached (or something similar)

Suggested change
_ => panic!("LEA {:?} {:?} {:?}", sz, src, dst),
_ => panic!("singlepass reached LEA {:?} {:?} {:?}", sz, src, dst),

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.

}

/// Specify that a given register is in use.
pub fn reserve_temp_gpr(&mut self, gpr: GPR) -> GPR {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make the name a bit more distinguishable to acquire_temp_gpr, like reserve_unused_gpr ?

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. I wanted to keep temp part of the name so that it refers to the RAX, RCX, RDX list of registers, not the RSI ... R11 list.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I thought this was used to reserve the RSI..R11 registers :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding a comment explaining this if the new name doesn't make this explicit. As someone without context on this, I'm sure it'd take be a bit to figure this out

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new name is reserve_unused_temp_gpr. It also has a comment on the function, and an assertion in the function. I'm in the position where I know what it does, so I can't see what about it might be confusing. Let me know if I can improve it?

@nlewycky
Copy link
Contributor Author

bors try

bors bot added a commit that referenced this pull request Sep 30, 2019
@bors
Copy link
Contributor

bors bot commented Sep 30, 2019

try

Build succeeded

  • wasmerio.wasmer

@nlewycky
Copy link
Contributor Author

nlewycky commented Oct 1, 2019

Can I get an approval on this? Are @syrusakbary or @MarkMcCaskey OK with doing it or are we waiting for @losfair ?

Copy link
Contributor

@MarkMcCaskey MarkMcCaskey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me 👍

It's a shame we can't generate more of this code -- looks like there's a ton of patterns in the codegen part

Location::GPR(tmp_aligncheck),
);
//a.emit_mov(Size::S64, Location::Imm64(align - 1), Location::GPR(tmp_mask));
//a.emit_and(Size::S64, Location::GPR(tmp_mask), Location::GPR(tmp_aligncheck));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this debug code? Probably best to remove it or explain in a comment why it's there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted.

It's the old code. We're under heavy register pressure here, and I rewrote it to use one less register, but kept the original around in case my changes didn't work properly. Thanks!

@nlewycky
Copy link
Contributor Author

nlewycky commented Oct 1, 2019

bors r+

bors bot added a commit that referenced this pull request Oct 1, 2019
831: Add support for atomic operations, excluding wait and notify, to singlepass. r=nlewycky a=nlewycky

# Description
Adds support for atomic operations, excluding wait and notify, to singlepass. Enable with `--enable-threads`.

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Nick Lewycky <nick@wasmer.io>
@bors
Copy link
Contributor

bors bot commented Oct 1, 2019

Build failed

  • wasmerio.wasmer

@nlewycky nlewycky force-pushed the feature/singlepass-atomicops branch from 5445cde to ab76c23 Compare October 2, 2019 23:39
@nlewycky
Copy link
Contributor Author

nlewycky commented Oct 2, 2019

bors r+

bors bot added a commit that referenced this pull request Oct 2, 2019
831: Add support for atomic operations, excluding wait and notify, to singlepass. r=nlewycky a=nlewycky

# Description
Adds support for atomic operations, excluding wait and notify, to singlepass. Enable with `--enable-threads`.

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Nick Lewycky <nick@wasmer.io>
@bors
Copy link
Contributor

bors bot commented Oct 2, 2019

Canceled

@nlewycky
Copy link
Contributor Author

nlewycky commented Oct 2, 2019

bors r+

bors bot added a commit that referenced this pull request Oct 2, 2019
831: Add support for atomic operations, excluding wait and notify, to singlepass. r=nlewycky a=nlewycky

# Description
Adds support for atomic operations, excluding wait and notify, to singlepass. Enable with `--enable-threads`.

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
@bors
Copy link
Contributor

bors bot commented Oct 3, 2019

Build failed

  • wasmerio.wasmer

@nlewycky
Copy link
Contributor Author

nlewycky commented Oct 3, 2019

bors r+

bors bot added a commit that referenced this pull request Oct 3, 2019
831: Add support for atomic operations, excluding wait and notify, to singlepass. r=nlewycky a=nlewycky

# Description
Adds support for atomic operations, excluding wait and notify, to singlepass. Enable with `--enable-threads`.

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Nick Lewycky <nick@wasmer.io>
Co-authored-by: nlewycky <nick@wasmer.io>
@bors
Copy link
Contributor

bors bot commented Oct 3, 2019

Build succeeded

  • wasmerio.wasmer

@bors bors bot merged commit f63c706 into master Oct 3, 2019
@bors bors bot deleted the feature/singlepass-atomicops branch October 3, 2019 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants