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

Instance is Copy #123044

Merged
merged 1 commit into from
Mar 26, 2024
Merged

Instance is Copy #123044

merged 1 commit into from
Mar 26, 2024

Conversation

compiler-errors
Copy link
Member

No reason to take it by value; it was confusing @rcvalle to see it being mutated when it's also being passed by ref in some places.

@rustbot
Copy link
Collaborator

rustbot commented Mar 25, 2024

r? @Nadrieril

rustbot has assigned @Nadrieril.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 25, 2024
@rustbot
Copy link
Collaborator

rustbot commented Mar 25, 2024

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@oli-obk
Copy link
Contributor

oli-obk commented Mar 25, 2024

r? @oli-obk

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 25, 2024

📌 Commit 99fbc6f has been approved by oli-obk

It is now in the queue for this repository.

@rustbot rustbot assigned oli-obk and unassigned Nadrieril Mar 25, 2024
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 25, 2024
@RalfJung
Copy link
Member

RalfJung commented Mar 25, 2024

It's 32 bytes large though, so using a reference could still save quite a bit of copying?

OTOH, interpret's Place is 48 bytes and still Copy.
Do we have an accepted threshold for when to stop copying things around and start preferring references?

@compiler-errors
Copy link
Member Author

@RalfJung: For the record, it's being passed by value in many places that are presumably hot -- codegen_mir in cg_ssa, (non-CFI) symbol mangling, collect_items_of_instance, etc.

Do we have an accepted threshold for when to stop copying things around and start preferring references?

Not as far as I am aware.

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Mar 25, 2024
`Instance` is `Copy`

No reason to take it by value; it was confusing `@rcvalle` to see it being mutated when it's also being passed by ref in some places.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 25, 2024
…kingjubilee

Rollup of 10 pull requests

Successful merges:

 - rust-lang#122707 (Fix a typo in the alloc::string::String docs)
 - rust-lang#122769 (extend comments for reachability set computation)
 - rust-lang#122892 (fix(bootstrap/dist): use versioned dirs when vendoring)
 - rust-lang#122896 (Update stdarch submodule)
 - rust-lang#122923 (In `pretty_print_type()`, print `async fn` futures' paths instead of spans.)
 - rust-lang#122950 (Add regression tests for rust-lang#101903)
 - rust-lang#122958 (Port backtrace dylib-dep test to a ui test)
 - rust-lang#123039 (Update books)
 - rust-lang#123044 (`Instance` is `Copy`)
 - rust-lang#123051 (did I mention that tests are super cool? )

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 25, 2024
…kingjubilee

Rollup of 10 pull requests

Successful merges:

 - rust-lang#122707 (Fix a typo in the alloc::string::String docs)
 - rust-lang#122769 (extend comments for reachability set computation)
 - rust-lang#122892 (fix(bootstrap/dist): use versioned dirs when vendoring)
 - rust-lang#122896 (Update stdarch submodule)
 - rust-lang#122923 (In `pretty_print_type()`, print `async fn` futures' paths instead of spans.)
 - rust-lang#122950 (Add regression tests for rust-lang#101903)
 - rust-lang#123039 (Update books)
 - rust-lang#123042 (Import the 2021 prelude in the core crate)
 - rust-lang#123044 (`Instance` is `Copy`)
 - rust-lang#123051 (did I mention that tests are super cool? )

r? `@ghost`
`@rustbot` modify labels: rollup
@workingjubilee
Copy link
Member

workingjubilee commented Mar 26, 2024

most CPUs have a 64 byte cache line, so that might be a reasonable heuristic for when to profile the difference. trying to save on data copying when it is less than a single line often causes more thrashing because the result is that, especially in the big functions with complex loops that rustc can wind up having, you can wind up poking a bunch of different cache lines while trying to evaluate a function in a hot loop, whereas if you just copied all that data in you wouldn't have to worry about that as much.

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 26, 2024
…kingjubilee

Rollup of 10 pull requests

Successful merges:

 - rust-lang#122707 (Fix a typo in the alloc::string::String docs)
 - rust-lang#122769 (extend comments for reachability set computation)
 - rust-lang#122892 (fix(bootstrap/dist): use versioned dirs when vendoring)
 - rust-lang#122896 (Update stdarch submodule)
 - rust-lang#122923 (In `pretty_print_type()`, print `async fn` futures' paths instead of spans.)
 - rust-lang#122950 (Add regression tests for rust-lang#101903)
 - rust-lang#123039 (Update books)
 - rust-lang#123042 (Import the 2021 prelude in the core crate)
 - rust-lang#123044 (`Instance` is `Copy`)
 - rust-lang#123051 (did I mention that tests are super cool? )

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 77de550 into rust-lang:master Mar 26, 2024
11 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Mar 26, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 26, 2024
Rollup merge of rust-lang#123044 - compiler-errors:instance, r=oli-obk

`Instance` is `Copy`

No reason to take it by value; it was confusing ``@rcvalle`` to see it being mutated when it's also being passed by ref in some places.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants