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

Simplify the define_query macro #100943

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Aug 24, 2022

This moves a bunch of control flow out of the macro into generic functions, leaving the macro just to call the function with a new generic parameter for each query.

It may be possible to improve compile-times / icache by instantiating the generic functions only with the query key, not the query type itself, but I'm going to leave that for a follow-up PR.

Helps with #96524. This is smaller than it looks; it includes the changes from #100436, which should be merged soon.

r? @cjgillot

jyn514 added 10 commits Aug 24, 2022
It's not actually necessary and it makes the code harder to read.
Rustdoc documents these with the name of the type alias instead of normalizing them to the underlying type.
Use associated types instead so that the generated docs for nightly-rustc are easier to read.
This should both make the code easier to read and also greatly reduce the amount of codegen
the compiler has to do, since it only needs to monomorphize `create_query_frame` for each
new key and not for each query.
@rustbot rustbot added the T-compiler label Aug 24, 2022
@rust-highfive rust-highfive added the S-waiting-on-review label Aug 24, 2022
@jyn514 jyn514 added the A-query-system label Aug 24, 2022
@jyn514
Copy link
Member Author

jyn514 commented Aug 24, 2022

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

rust-timer commented Aug 24, 2022

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf label Aug 24, 2022
@bors
Copy link
Contributor

bors commented Aug 24, 2022

Trying commit 61d9559 with merge 2c96ac2...

bors added a commit to rust-lang-ci/rust that referenced this issue Aug 24, 2022
Simplify the `define_query` macro

This moves a bunch of control flow out of the macro into generic functions, leaving the macro just to call the function with a new generic parameter for each query.

It may be possible to improve compile-times / icache by instantiating the generic functions only with the query key, not the query type itself, but I'm going to leave that for a follow-up PR.

Helps with rust-lang#96524. This is smaller than it looks; it includes the changes from rust-lang#100436, which should be merged soon.

r? `@cjgillot`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system S-waiting-on-perf S-waiting-on-review T-compiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants