Uh oh!
There was an error while loading. Please reload this page.
Add support for specifying multiple clobber_abi in asm! - #89316
Conversation
asquared31415
commented
Sep 28, 2021
One concern I have is the increase of the size of ast::ItemKind, if that is a problem I think that it can be fixed with some boxed slices? |
77726da to
db8af3fCompare| } | ||
| #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] | ||
| rustc_data_structures::static_assert_size!(ItemKind, 112); |
There was a problem hiding this comment.
Consider boxing the InlineAsm to avoid increasing the size of ItemKind.
| } | ||
| let mut clobber_abi = None; | ||
| let mut clobber_abis = FxHashSet::default(); |
There was a problem hiding this comment.
Use a HashMap keyed on the ABI, otherwise 2 identical ABIs with different spans will both be included.
Uh oh!
There was an error while loading. Please reload this page.
| } else if let Some((_, abi_span)) = args.clobber_abi { | ||
| } else if let Some(&(_, abi_span)) = args.clobber_abis.last() { | ||
| ecx.struct_span_err(span, "arguments are not allowed after clobber_abi") | ||
| .span_label(abi_span, "clobber_abi") |
There was a problem hiding this comment.
I'd like this to point to all the clobber_abi spans, not just the last one.
| if let Some(&(_, abi_span)) = args.clobber_abis.last() { | ||
| if is_global_asm { | ||
| let err = | ||
| ecx.struct_span_err(abi_span, "`clobber_abi` cannot be used with `global_asm!`"); |
Amanieu
commented
Sep 29, 2021
Can you add this to grammar in the asm documentation in the unstable book? Also in the reference-level explanation add a note saying that |
Amanieu
commented
Sep 30, 2021
@bors r+ |
bors
commented
Sep 30, 2021
📌 Commit b159d95 has been approved by |
… r=Amanieu Add support for specifying multiple clobber_abi in `asm!` r? `@Amanieu` cc rust-lang#72016 `@rustbot` label: +A-inline-assembly +F-asm
fee1-dead
commented
Oct 1, 2021
@bors r- Failed in #89420 (comment) |
nbdd0121
left a comment
There was a problem hiding this comment.
I wonder if the syntax should be
clobber_abi("A"),clobber_abi("B")or
clobber_abi("A","B")There was a problem hiding this comment.
| if args.clobber_abis.len() > 0{ | |
| if!args.clobber_abis.is_empty(){ |
Amanieu
commented
Oct 7, 2021
Hmm actually I slightly prefer |
asquared31415
commented
Oct 8, 2021
I like that syntax better too |
59bae7f to
887caebCompareThere was a problem hiding this comment.
| letmut abis = format!("`{}`", supported_abis[0]); | |
| for m in&supported_abis[1..]{ | |
| let _ = write!(abis,", `{}`", m); | |
| } | |
| let abis = supported_abis.join(","); |
There was a problem hiding this comment.
The code there adds ` around the abi name, which can't be replicated using just join like that.
There was a problem hiding this comment.
I think this shall be a Vec. If there are multiple occurrence of the same ABI then it should be error (and emitted during macro expansion), not silently merged.
There was a problem hiding this comment.
Wouldn't this still geenrate multiple clobber_abis?
There was a problem hiding this comment.
I think it's best to treat non-string-literal case and no ABI specified case separately (given that this is now a comma delimited list), so if the user writes clobber_abi() then we should say "at least an ABI name should be specified in clobber_abi" rather than just "expected string literal".
This comment has been minimized.
This comment has been minimized.
5625ff6 to
1114234CompareAmanieu
commented
Oct 10, 2021
@bors r+ |
bors
commented
Oct 10, 2021
📌 Commit 111423454809b548c7d8ad195d100046d99dcd98 has been approved by |
bors
commented
Oct 10, 2021
⌛ Testing commit 111423454809b548c7d8ad195d100046d99dcd98 with merge f1b081eb34e3a1756703a5cd7884ae8132eb52ef... |
This comment has been minimized.
This comment has been minimized.
Allow multiple clobber_abi in asm Update docs Fix aarch64 test Combine abis Emit duplicate ABI error, empty ABI list error multiple clobber_abi
c77cd0a to
3e799e4CompareAmanieu
commented
Nov 10, 2021
@bors r+ |
bors
commented
Nov 10, 2021
📌 Commit 3e799e4 has been approved by |
bors
commented
Nov 10, 2021
⌛ Testing commit 3e799e4 with merge 4de694226be8edf717148c78451fac31fb9ff4f5... |
This comment has been minimized.
This comment has been minimized.
bors
commented
Nov 10, 2021
💔 Test failed - checks-actions |
Amanieu
commented
Nov 12, 2021
@bors r+ |
bors
commented
Nov 12, 2021
📌 Commit e80f300 has been approved by |
bors
commented
Nov 12, 2021
bors
commented
Nov 12, 2021
☀️ Test successful - checks-actions |
rust-timer
commented
Nov 12, 2021
Finished benchmarking commit (220ed09): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
r? @Amanieu
cc #72016
@rustbot label: +A-inline-assembly +F-asm