Refactor FnDecl and FnSig non-type fields into a new wrapper type#155223
Refactor FnDecl and FnSig non-type fields into a new wrapper type#155223teor2345 wants to merge 4 commits intorust-lang:mainfrom
Conversation
6150d1f to
27a7d65
Compare
This comment was marked as outdated.
This comment was marked as outdated.
27a7d65 to
18f1956
Compare
18f1956 to
dafb6bb
Compare
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred to the CTFE machinery rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead. cc @rust-lang/rust-analyzer HIR ty lowering was modified cc @fmease
cc @Amanieu, @folkertdev, @sayantn This PR changes rustc_public cc @oli-obk, @celinval, @ouz-a, @makai410 Some changes occurred in compiler/rustc_sanitizers cc @rcvalle The Miri subtree was changed cc @rust-lang/miri Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 Some changes occurred in compiler/rustc_codegen_gcc Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri Some changes occurred in compiler/rustc_passes/src/check_attr.rs cc @jdonszelmann, @JonathanBrouwer Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt These commits modify the If this was unintentional then you should revert the changes before this PR is merged. |
|
r? @mati865 rustbot has assigned @mati865. Use Why was this reviewer chosen?The reviewer was selected based on:
|
There was a problem hiding this comment.
This is ready for review now, but I have some questions for reviewers (or compiler experts) about the legacy name mangling hash.
I'd also like to check if this PR impacts perf, either positively or negatively. I don't think I have permissions, but let's try anyway:
@bors try @rust-timer queue
|
@teor2345: 🔑 Insufficient privileges: not in try users |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Refactor FnDecl and FnSig non-type fields into a new wrapper type
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (d647df9): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary -1.8%, secondary 0.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -2.0%, secondary -1.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.1%, secondary -0.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 490.756s -> 487.632s (-0.64%) |
| $($e_name::$variant $( { unwind: $uw } )* => $tok,)* | ||
| } | ||
| } | ||
| // ALL_VARIANTS.iter().position(|v| v == self), but const |
There was a problem hiding this comment.
position returns an index, this here returns a bool -- something does not check out.
There was a problem hiding this comment.
Oops, that comment should have been on as_packed, it got left behind when I also needed a const equality check.
Why this Refactor?
This PR is part of an initial cleanup for the arg splat experiment, but it's a useful refactor by itself.
It refactors the non-type fields of
FnDecl,FnSig, andFnHeaderinto a new packed wrapper types, based on this comment in thesplatexperiment PR:#153697 (comment)
It also refactors some common
FnSigcreation settings into their own methods. I did this instead of creating a struct with defaults.Relationship to
splatExperimentI don't think we can use functional struct updates (
..default()) to createFnDeclandFnSig, because we need the bit-packing for thesplatexperiment.Bit-packing will avoid breaking "type is small" assertions for commonly used types when
splatis added.This PR packs these types:
unwindvariants (38) -> 6 bitsMinor Changes
Fixes some typos, and applies rustfmt to clippy files that got skipped somehow.