1
Fork 0

Remove polymorphization

This commit is contained in:
Ben Kimock 2024-12-04 21:03:12 -05:00
parent e8ad19987d
commit 4d01ca8ae9
8 changed files with 10 additions and 41 deletions

View file

@ -92,10 +92,6 @@ const BASE_SYSROOT_SUITE: &[TestCase] = &[
TestCase::build_bin_and_run("aot.mod_bench", "example/mod_bench.rs", &[]),
TestCase::build_bin_and_run("aot.issue-72793", "example/issue-72793.rs", &[]),
TestCase::build_bin("aot.issue-59326", "example/issue-59326.rs"),
TestCase::custom("aot.polymorphize_coroutine", &|runner| {
runner.run_rustc(&["example/polymorphize_coroutine.rs", "-Zpolymorphize"]);
runner.run_out_command("polymorphize_coroutine", &[]);
}),
TestCase::build_bin_and_run("aot.neon", "example/neon.rs", &[]),
TestCase::custom("aot.gen_block_iterate", &|runner| {
runner.run_rustc([

View file

@ -42,7 +42,6 @@ aot.float-minmax-pass
aot.mod_bench
aot.issue-72793
aot.issue-59326
aot.polymorphize_coroutine
aot.neon
aot.gen_block_iterate
aot.raw-dylib

View file

@ -1,17 +0,0 @@
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
use std::ops::Coroutine;
use std::pin::Pin;
fn main() {
run_coroutine::<i32>();
}
fn run_coroutine<T>() {
let mut coroutine = #[coroutine]
|| {
yield;
return;
};
Pin::new(&mut coroutine).resume(());
}

View file

@ -394,8 +394,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
def_id,
fn_args,
source_info.span,
)
.polymorphize(fx.tcx);
);
if is_call_from_compiler_builtins_to_upstream_monomorphization(fx.tcx, instance) {
if target.is_some() {
@ -698,7 +697,7 @@ pub(crate) fn codegen_drop<'tcx>(
target: BasicBlock,
) {
let ty = drop_place.layout().ty;
let drop_instance = Instance::resolve_drop_in_place(fx.tcx, ty).polymorphize(fx.tcx);
let drop_instance = Instance::resolve_drop_in_place(fx.tcx, ty);
if let ty::InstanceKind::DropGlue(_, None) | ty::InstanceKind::AsyncDropGlueCtorShim(_, None) =
drop_instance.def

View file

@ -673,8 +673,7 @@ fn codegen_stmt<'tcx>(
def_id,
args,
)
.unwrap()
.polymorphize(fx.tcx),
.unwrap(),
);
let func_addr = fx.bcx.ins().func_addr(fx.pointer_type, func_ref);
lval.write_cvalue(fx, CValue::by_val(func_addr, to_layout));
@ -760,8 +759,7 @@ fn codegen_stmt<'tcx>(
def_id,
args,
ty::ClosureKind::FnOnce,
)
.polymorphize(fx.tcx);
);
let func_ref = fx.get_function_ref(instance);
let func_addr = fx.bcx.ins().func_addr(fx.pointer_type, func_ref);
lval.write_cvalue(fx, CValue::by_val(func_addr, lval.layout()));
@ -1087,7 +1085,7 @@ fn codegen_panic_inner<'tcx>(
let def_id = fx.tcx.require_lang_item(lang_item, span);
let instance = Instance::mono(fx.tcx, def_id).polymorphize(fx.tcx);
let instance = Instance::mono(fx.tcx, def_id);
if is_call_from_compiler_builtins_to_upstream_monomorphization(fx.tcx, instance) {
fx.bcx.ins().trap(TrapCode::user(2).unwrap());

View file

@ -452,8 +452,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
let data_id = match reloc_target_alloc {
GlobalAlloc::Function { instance, .. } => {
assert_eq!(addend, 0);
let func_id =
crate::abi::import_function(tcx, module, instance.polymorphize(tcx));
let func_id = crate::abi::import_function(tcx, module, instance);
let local_func_id = module.declare_func_in_data(func_id, &mut data);
data.write_function_addr(offset.bytes() as u32, local_func_id);
continue;

View file

@ -24,7 +24,7 @@ pub(crate) fn maybe_create_entry_wrapper(
};
if main_def_id.is_local() {
let instance = Instance::mono(tcx, main_def_id).polymorphize(tcx);
let instance = Instance::mono(tcx, main_def_id);
if module.get_name(tcx.symbol_name(instance).name).is_none() {
return;
}
@ -75,7 +75,7 @@ pub(crate) fn maybe_create_entry_wrapper(
}
};
let instance = Instance::mono(tcx, rust_main_def_id).polymorphize(tcx);
let instance = Instance::mono(tcx, rust_main_def_id);
let main_name = tcx.symbol_name(instance).name;
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(
report.def_id,
tcx.mk_args(&[GenericArg::from(main_ret_ty)]),
DUMMY_SP,
)
.polymorphize(tcx);
);
let report_name = tcx.symbol_name(report).name;
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(
start_def_id,
tcx.mk_args(&[main_ret_ty.into()]),
DUMMY_SP,
)
.polymorphize(tcx);
);
let start_func_id = import_function(tcx, m, start_instance);
let main_val = bcx.ins().func_addr(m.target_config().pointer_type(), main_func_ref);

View file

@ -1005,9 +1005,6 @@ pub(crate) fn assert_assignable<'tcx>(
}
}
}
(ty::Param(_), _) | (_, ty::Param(_)) if fx.tcx.sess.opts.unstable_opts.polymorphize => {
// No way to check if it is correct or not with polymorphization enabled
}
_ => {
assert_eq!(
from_ty,