-
Notifications
You must be signed in to change notification settings - Fork 13.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
parse_tt
: a few more tweaks
#95794
parse_tt
: a few more tweaks
#95794
Conversation
I think the perf effects here should be negligible. @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit c09baac998fa0fc3600a8f7f8650c023e9ac8e60 with merge d1dd78813e5e9620703b973bec06c3a6a03c506a... |
☀️ Try build successful - checks-actions |
Queued d1dd78813e5e9620703b973bec06c3a6a03c506a with parent e745b4d, future comparison URL. |
Finished benchmarking commit (d1dd78813e5e9620703b973bec06c3a6a03c506a): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Footnotes |
The slight perf losses will be from the third commit. I guess I'll drop that one. |
@@ -441,7 +441,8 @@ pub fn compile_declarative_macro( | |||
let argument_gram = mbe::macro_parser::compute_locs(&sess.parse_sess, &argument_gram); | |||
|
|||
let parser = Parser::new(&sess.parse_sess, body, true, rustc_parse::MACRO_ARGUMENTS); | |||
let mut tt_parser = TtParser::new(def.ident); | |||
let mut tt_parser = | |||
TtParser::new(Ident::with_dummy_span(if macro_rules { kw::MacroRules } else { kw::Macro })); |
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.
This is reasonable while we are still matching the macro definition against $( $lhs:tt => $rhs:tt );+
reusing macro_rules
machinery.
However, we really should stop pretending that macro_rules! foo { ... }
or macro foo (...) { ... }
are macro invocations.
This involves removing all the comments saying that, introducing a custom parser for the $( $lhs:tt => $rhs:tt );+
syntax (and its macro
2.0 equivalent), and storing the output from such parser (the lowered macro representation) to crate metadata, so that macro definitions are not reparsed as raw token streams by every dependent crate.
When a `macro_rules! foo { ... }` invocation is compiled the name used is `foo`, not `macro_rules!`. This is different to all other macro invocations, and confused me when I was inserted debugging println statements for macro evaluation. This commit changes it to `macro_rules` (or just `macro`), which is what I expected. There are no externally visible changes.
The `Lrc` isn't necessary, neither is the `SmallVec`. Performance is changed negligibly, but the new code is simpler.
c09baac
to
edd7f2c
Compare
I updated and removed the commit involving The perf results might have been a weird blip. Let's try again. @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit edd7f2c with merge f5c9fe83718933285dee8c5664d4f4c5ae540007... |
☀️ Try build successful - checks-actions |
Queued f5c9fe83718933285dee8c5664d4f4c5ae540007 with parent 1f7fb64, future comparison URL. |
Finished benchmarking commit (f5c9fe83718933285dee8c5664d4f4c5ae540007): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Footnotes |
Perf changes are negligible. I think the simplification of removing the |
@bors r+ |
📌 Commit edd7f2c has been approved by |
@bors rollup=maybe |
Rollup of 4 pull requests Successful merges: - rust-lang#95783 (rustdoc doctest: include signal number in exit status) - rust-lang#95794 (`parse_tt`: a few more tweaks) - rust-lang#95963 ([bootstrap] Grab the right FileCheck binary for dist when cross-compiling.) - rust-lang#95975 (Don't test -Cdefault-linker-libraries=yes when cross compiling.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Oh, I forgot to mark this as triaged: see this comment @rustbot label: +perf-regression-triaged |
r? @petrochenkov