Skip to content

Commit 4d01ca8

Browse files
committed
Remove polymorphization
1 parent e8ad199 commit 4d01ca8

File tree

8 files changed

+10
-41
lines changed

8 files changed

+10
-41
lines changed

build_system/tests.rs

-4
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([

config.txt

-1
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

example/polymorphize_coroutine.rs

-17
This file was deleted.

src/abi/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
394394
def_id,
395395
fn_args,
396396
source_info.span,
397-
)
398-
.polymorphize(fx.tcx);
397+
);
399398

400399
if is_call_from_compiler_builtins_to_upstream_monomorphization(fx.tcx, instance) {
401400
if target.is_some() {
@@ -698,7 +697,7 @@ pub(crate) fn codegen_drop<'tcx>(
698697
target: BasicBlock,
699698
) {
700699
let ty = drop_place.layout().ty;
701-
let drop_instance = Instance::resolve_drop_in_place(fx.tcx, ty).polymorphize(fx.tcx);
700+
let drop_instance = Instance::resolve_drop_in_place(fx.tcx, ty);
702701

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

src/base.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,7 @@ fn codegen_stmt<'tcx>(
673673
def_id,
674674
args,
675675
)
676-
.unwrap()
677-
.polymorphize(fx.tcx),
676+
.unwrap(),
678677
);
679678
let func_addr = fx.bcx.ins().func_addr(fx.pointer_type, func_ref);
680679
lval.write_cvalue(fx, CValue::by_val(func_addr, to_layout));
@@ -760,8 +759,7 @@ fn codegen_stmt<'tcx>(
760759
def_id,
761760
args,
762761
ty::ClosureKind::FnOnce,
763-
)
764-
.polymorphize(fx.tcx);
762+
);
765763
let func_ref = fx.get_function_ref(instance);
766764
let func_addr = fx.bcx.ins().func_addr(fx.pointer_type, func_ref);
767765
lval.write_cvalue(fx, CValue::by_val(func_addr, lval.layout()));
@@ -1087,7 +1085,7 @@ fn codegen_panic_inner<'tcx>(
10871085

10881086
let def_id = fx.tcx.require_lang_item(lang_item, span);
10891087

1090-
let instance = Instance::mono(fx.tcx, def_id).polymorphize(fx.tcx);
1088+
let instance = Instance::mono(fx.tcx, def_id);
10911089

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

src/constant.rs

+1-2
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;

src/main_shim.rs

+4-6
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);

src/value_and_place.rs

-3
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,

0 commit comments

Comments
 (0)