-
Notifications
You must be signed in to change notification settings - Fork 821
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
Conversation
bors try |
tryBuild succeeded
|
@@ -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), |
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.
Can you make the panics a bit more descriptive?
Just appending singlepass reached
(or something similar)
_ => panic!("LEA {:?} {:?} {:?}", sz, src, dst), | |
_ => panic!("singlepass reached LEA {:?} {:?} {:?}", sz, src, dst), |
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.
} | ||
|
||
/// Specify that a given register is in use. | ||
pub fn reserve_temp_gpr(&mut self, gpr: GPR) -> GPR { |
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.
Could you make the name a bit more distinguishable to acquire_temp_gpr
, like reserve_unused_gpr
?
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. 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.
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.
Okay, I thought this was used to reserve the RSI..R11 registers :)
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.
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
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.
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?
be47a51
to
58cd7b9
Compare
bors try |
tryBuild succeeded
|
Can I get an approval on this? Are @syrusakbary or @MarkMcCaskey OK with doing it or are we waiting for @losfair ? |
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.
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)); |
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.
Is this debug code? Probably best to remove it or explain in a comment why it's there
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.
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!
bors r+ |
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>
Build failed
|
BUG: This might allocate RAX twice.
Adds the ability to reserve a specific temp-gpr register. Needed for CMPXCHG which always uses RAX.
Sizes are now ordered, to facilitate an assertion that one size is less (smaller) than another. panic! error messages are provided for remaining emitter functions.
5445cde
to
ab76c23
Compare
bors r+ |
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>
Canceled |
bors r+ |
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>
Build failed
|
bors r+ |
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>
Build succeeded
|
Description
Adds support for atomic operations, excluding wait and notify, to singlepass. Enable with
--enable-threads
.Review