about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/builder.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-02-21 12:45:22 +0100
committerGitHub <noreply@github.com>2025-02-21 12:45:22 +0100
commit8d52aae968e8a4822e3a4c902c148a2280657eb6 (patch)
tree0e2b270af0dd12a7f704f8bfd578d820cb72c6a1 /compiler/rustc_codegen_llvm/src/builder.rs
parente67d4499a61cfe5c4e6ff257e05ced2de652d5b6 (diff)
parent97005678c38fd391c9b502d011cc3f3d4434a18a (diff)
downloadrust-8d52aae968e8a4822e3a4c902c148a2280657eb6.tar.gz
rust-8d52aae968e8a4822e3a4c902c148a2280657eb6.zip
Rollup merge of #136089 - jwong101:box-default-debug-stack-usage, r=Amanieu
Reduce `Box::default` stack copies in debug mode

The `Box::new(T::default())` implementation of `Box::default` only
had two stack copies in debug mode, compared to the current version,
which has four. By avoiding creating any `MaybeUninit<T>`'s and just writing
`T` directly to the `Box` pointer, the stack usage in debug mode remains
the same as the old version.

Another option would be to mark `Box::write` as `#[inline(always)]`,
and change it's implementation to to avoid calling `MaybeUninit::write`
(which creates a `MaybeUninit<T>` on the stack) and to use `ptr::write` instead.

Fixes: #136043
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/builder.rs')
0 files changed, 0 insertions, 0 deletions