Skip to content

Commit 2c6e802

Browse files
committed
Remove polymorphization
1 parent acabb52 commit 2c6e802

File tree

85 files changed

+50
-2581
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+50
-2581
lines changed

compiler/rustc_codegen_cranelift/build_system/tests.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[
9292
TestCase::build_bin_and_run("aot.mod_bench", "example/mod_bench.rs", &[]),
9393
TestCase::build_bin_and_run("aot.issue-72793", "example/issue-72793.rs", &[]),
9494
TestCase::build_bin("aot.issue-59326", "example/issue-59326.rs"),
95-
TestCase::custom("aot.polymorphize_coroutine", &|runner| {
96-
runner.run_rustc(&["example/polymorphize_coroutine.rs", "-Zpolymorphize"]);
97-
runner.run_out_command("polymorphize_coroutine", &[]);
98-
}),
9995
TestCase::build_bin_and_run("aot.neon", "example/neon.rs", &[]),
10096
TestCase::custom("aot.gen_block_iterate", &|runner| {
10197
runner.run_rustc([

compiler/rustc_codegen_cranelift/config.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ aot.float-minmax-pass
4242
aot.mod_bench
4343
aot.issue-72793
4444
aot.issue-59326
45-
aot.polymorphize_coroutine
4645
aot.neon
4746
aot.gen_block_iterate
4847
aot.raw-dylib

compiler/rustc_codegen_cranelift/src/abi/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
380380
def_id,
381381
fn_args,
382382
source_info.span,
383-
)
384-
.polymorphize(fx.tcx);
383+
);
385384

386385
if is_call_from_compiler_builtins_to_upstream_monomorphization(fx.tcx, instance) {
387386
if target.is_some() {
@@ -684,7 +683,7 @@ pub(crate) fn codegen_drop<'tcx>(
684683
target: BasicBlock,
685684
) {
686685
let ty = drop_place.layout().ty;
687-
let drop_instance = Instance::resolve_drop_in_place(fx.tcx, ty).polymorphize(fx.tcx);
686+
let drop_instance = Instance::resolve_drop_in_place(fx.tcx, ty);
688687

689688
if let ty::InstanceKind::DropGlue(_, None) | ty::InstanceKind::AsyncDropGlueCtorShim(_, None) =
690689
drop_instance.def

compiler/rustc_codegen_cranelift/src/base.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,8 +670,7 @@ fn codegen_stmt<'tcx>(
670670
def_id,
671671
args,
672672
)
673-
.unwrap()
674-
.polymorphize(fx.tcx),
673+
.unwrap(),
675674
);
676675
let func_addr = fx.bcx.ins().func_addr(fx.pointer_type, func_ref);
677676
lval.write_cvalue(fx, CValue::by_val(func_addr, to_layout));
@@ -757,8 +756,7 @@ fn codegen_stmt<'tcx>(
757756
def_id,
758757
args,
759758
ty::ClosureKind::FnOnce,
760-
)
761-
.polymorphize(fx.tcx);
759+
);
762760
let func_ref = fx.get_function_ref(instance);
763761
let func_addr = fx.bcx.ins().func_addr(fx.pointer_type, func_ref);
764762
lval.write_cvalue(fx, CValue::by_val(func_addr, lval.layout()));
@@ -1084,7 +1082,7 @@ fn codegen_panic_inner<'tcx>(
10841082

10851083
let def_id = fx.tcx.require_lang_item(lang_item, span);
10861084

1087-
let instance = Instance::mono(fx.tcx, def_id).polymorphize(fx.tcx);
1085+
let instance = Instance::mono(fx.tcx, def_id);
10881086

10891087
if is_call_from_compiler_builtins_to_upstream_monomorphization(fx.tcx, instance) {
10901088
fx.bcx.ins().trap(TrapCode::user(2).unwrap());

compiler/rustc_codegen_cranelift/src/constant.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
452452
let data_id = match reloc_target_alloc {
453453
GlobalAlloc::Function { instance, .. } => {
454454
assert_eq!(addend, 0);
455-
let func_id =
456-
crate::abi::import_function(tcx, module, instance.polymorphize(tcx));
455+
let func_id = crate::abi::import_function(tcx, module, instance);
457456
let local_func_id = module.declare_func_in_data(func_id, &mut data);
458457
data.write_function_addr(offset.bytes() as u32, local_func_id);
459458
continue;

compiler/rustc_codegen_cranelift/src/main_shim.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub(crate) fn maybe_create_entry_wrapper(
2424
};
2525

2626
if main_def_id.is_local() {
27-
let instance = Instance::mono(tcx, main_def_id).polymorphize(tcx);
27+
let instance = Instance::mono(tcx, main_def_id);
2828
if module.get_name(tcx.symbol_name(instance).name).is_none() {
2929
return;
3030
}
@@ -75,7 +75,7 @@ pub(crate) fn maybe_create_entry_wrapper(
7575
}
7676
};
7777

78-
let instance = Instance::mono(tcx, rust_main_def_id).polymorphize(tcx);
78+
let instance = Instance::mono(tcx, rust_main_def_id);
7979

8080
let main_name = tcx.symbol_name(instance).name;
8181
let main_sig = get_function_sig(tcx, m.target_config().default_call_conv, instance);
@@ -117,8 +117,7 @@ pub(crate) fn maybe_create_entry_wrapper(
117117
report.def_id,
118118
tcx.mk_args(&[GenericArg::from(main_ret_ty)]),
119119
DUMMY_SP,
120-
)
121-
.polymorphize(tcx);
120+
);
122121

123122
let report_name = tcx.symbol_name(report).name;
124123
let report_sig = get_function_sig(tcx, m.target_config().default_call_conv, report);
@@ -143,8 +142,7 @@ pub(crate) fn maybe_create_entry_wrapper(
143142
start_def_id,
144143
tcx.mk_args(&[main_ret_ty.into()]),
145144
DUMMY_SP,
146-
)
147-
.polymorphize(tcx);
145+
);
148146
let start_func_id = import_function(tcx, m, start_instance);
149147

150148
let main_val = bcx.ins().func_addr(m.target_config().pointer_type(), main_func_ref);

compiler/rustc_codegen_cranelift/src/value_and_place.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,9 +1005,6 @@ pub(crate) fn assert_assignable<'tcx>(
10051005
}
10061006
}
10071007
}
1008-
(ty::Param(_), _) | (_, ty::Param(_)) if fx.tcx.sess.opts.unstable_opts.polymorphize => {
1009-
// No way to check if it is correct or not with polymorphization enabled
1010-
}
10111008
_ => {
10121009
assert_eq!(
10131010
from_ty,

compiler/rustc_codegen_gcc/tests/failing-ui-tests.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ tests/ui/functions-closures/parallel-codegen-closures.rs
66
tests/ui/linkage-attr/linkage1.rs
77
tests/ui/lto/dylib-works.rs
88
tests/ui/numbers-arithmetic/saturating-float-casts.rs
9-
tests/ui/polymorphization/promoted-function.rs
109
tests/ui/sepcomp/sepcomp-cci.rs
1110
tests/ui/sepcomp/sepcomp-extern.rs
1211
tests/ui/sepcomp/sepcomp-fns-backwards.rs

compiler/rustc_codegen_llvm/src/common.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,9 @@ impl<'ll, 'tcx> ConstCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
302302
(value, AddressSpace::DATA)
303303
}
304304
}
305-
GlobalAlloc::Function { instance, .. } => (
306-
self.get_fn_addr(instance.polymorphize(self.tcx)),
307-
self.data_layout().instruction_address_space,
308-
),
305+
GlobalAlloc::Function { instance, .. } => {
306+
(self.get_fn_addr(instance), self.data_layout().instruction_address_space)
307+
}
309308
GlobalAlloc::VTable(ty, dyn_ty) => {
310309
let alloc = self
311310
.tcx

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -847,10 +847,13 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
847847

848848
let (instance, mut llfn) = match *callee.layout.ty.kind() {
849849
ty::FnDef(def_id, args) => (
850-
Some(
851-
ty::Instance::expect_resolve(bx.tcx(), bx.typing_env(), def_id, args, fn_span)
852-
.polymorphize(bx.tcx()),
853-
),
850+
Some(ty::Instance::expect_resolve(
851+
bx.tcx(),
852+
bx.typing_env(),
853+
def_id,
854+
args,
855+
fn_span,
856+
)),
854857
None,
855858
),
856859
ty::FnPtr(..) => (None, Some(callee.immediate())),

0 commit comments

Comments
 (0)