-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Avoid memory copy logic for zsts #67658
Conversation
a8b54e3
to
c56a89c
Compare
c56a89c
to
bd93b77
Compare
@bors try |
⌛ Trying commit bd93b77 with merge d5da6a798d2c8b458a417747b9a77b048625569f... |
@rust-timer build d5da6a798d2c8b458a417747b9a77b048625569f |
Queued d5da6a798d2c8b458a417747b9a77b048625569f with parent 8f5f8f9, future comparison URL. |
☀️ Try build successful - checks-azure |
Finished benchmarking try commit d5da6a798d2c8b458a417747b9a77b048625569f, comparison URL. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
60dc96e
to
4741139
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion |
⌛ Trying commit 474113928df0d1d93d1eab80c74419386917c240 with merge e75db45a11dc03a812447008dd53ad3a87e1afde... |
☀️ Try build successful - checks-azure |
Queued e75db45a11dc03a812447008dd53ad3a87e1afde with parent 74c4e6a, future comparison URL. |
4741139
to
8ab0b2b
Compare
src/librustc_mir/interpret/memory.rs
Outdated
|
||
// If `dest_bytes` is empty we just optimize to not run anything for zsts. | ||
// See #67539 | ||
if dest_bytes.is_empty() { |
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.
Is this even reachable? Shouldn't all_bytes_undef
always be true
for empty ranges?
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.
compress_undef_range
sets initial
to self.undef_mask.get(src.offset)
. If the memory immediately following the range is defined, then it will return true
, thus causing all_bytes_undef
to return false
.
8ab0b2b
to
27bffab
Compare
During MIR interpretation it may happen that a place containing uninitialized bytes is copied. This would read the current representation of these bytes and write it to the destination even though they must, by definition, not matter to the execution. This elides that representation change when no bytes are defined in such a copy, saving some cpu cycles. In such a case, the memory of the target allocation is not touched at all which also means that sometimes no physical page backing the memory allocation of the representation needs to be provided by the OS at all, reducing memory pressure on the system.
27bffab
to
250a636
Compare
Finished benchmarking try commit e75db45a11dc03a812447008dd53ad3a87e1afde, comparison URL. |
@bors r+ |
📌 Commit 250a636 has been approved by |
Avoid memory copy logic for zsts r? @oli-obk One of the included commits is work done by @HeroicKatora in #62655
☀️ Test successful - checks-azure |
r? @oli-obk
One of the included commits is work done by @HeroicKatora in #62655