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

Emulate <Box<F> as FnOnce>::call_once without alloca #916

Merged
merged 3 commits into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 0 additions & 73 deletions patches/0015-Remove-usage-of-unsized-locals.patch

This file was deleted.

92 changes: 0 additions & 92 deletions patches/0017-Fix-libtest-compilation.patch

This file was deleted.

174 changes: 0 additions & 174 deletions patches/0018-Add-FnBox-back.patch

This file was deleted.

2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2020-03-07
nightly-2020-03-10
16 changes: 10 additions & 6 deletions src/abi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ fn local_place<'tcx>(
fx.local_map[&local]
}

pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_block: Block) {
pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_block: Block, should_codegen_locals: bool) {
let ssa_analyzed = crate::analyze::analyze(fx);

#[cfg(debug_assertions)]
Expand Down Expand Up @@ -405,13 +405,17 @@ pub fn codegen_fn_prelude(fx: &mut FunctionCx<'_, '_, impl Backend>, start_block
}
}

for local in fx.mir.vars_and_temps_iter() {
let ty = fx.monomorphize(&fx.mir.local_decls[local].ty);
let layout = fx.layout_of(ty);
// HACK should_codegen_locals required for the ``implement `<Box<F> as FnOnce>::call_once`
// without `alloca``` hack in `base::trans_fn`.
if should_codegen_locals {
for local in fx.mir.vars_and_temps_iter() {
let ty = fx.monomorphize(&fx.mir.local_decls[local].ty);
let layout = fx.layout_of(ty);

let is_ssa = ssa_analyzed[local] == crate::analyze::SsaKind::Ssa;
let is_ssa = ssa_analyzed[local] == crate::analyze::SsaKind::Ssa;

local_place(fx, local, layout, is_ssa);
local_place(fx, local, layout, is_ssa);
}
}

fx.bcx
Expand Down
Loading