Remove polymorphization
This commit is contained in:
parent
e8ad19987d
commit
4d01ca8ae9
8 changed files with 10 additions and 41 deletions
|
@ -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.mod_bench", "example/mod_bench.rs", &[]),
|
||||||
TestCase::build_bin_and_run("aot.issue-72793", "example/issue-72793.rs", &[]),
|
TestCase::build_bin_and_run("aot.issue-72793", "example/issue-72793.rs", &[]),
|
||||||
TestCase::build_bin("aot.issue-59326", "example/issue-59326.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::build_bin_and_run("aot.neon", "example/neon.rs", &[]),
|
||||||
TestCase::custom("aot.gen_block_iterate", &|runner| {
|
TestCase::custom("aot.gen_block_iterate", &|runner| {
|
||||||
runner.run_rustc([
|
runner.run_rustc([
|
||||||
|
|
|
@ -42,7 +42,6 @@ aot.float-minmax-pass
|
||||||
aot.mod_bench
|
aot.mod_bench
|
||||||
aot.issue-72793
|
aot.issue-72793
|
||||||
aot.issue-59326
|
aot.issue-59326
|
||||||
aot.polymorphize_coroutine
|
|
||||||
aot.neon
|
aot.neon
|
||||||
aot.gen_block_iterate
|
aot.gen_block_iterate
|
||||||
aot.raw-dylib
|
aot.raw-dylib
|
||||||
|
|
|
@ -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(());
|
|
||||||
}
|
|
|
@ -394,8 +394,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
|
||||||
def_id,
|
def_id,
|
||||||
fn_args,
|
fn_args,
|
||||||
source_info.span,
|
source_info.span,
|
||||||
)
|
);
|
||||||
.polymorphize(fx.tcx);
|
|
||||||
|
|
||||||
if is_call_from_compiler_builtins_to_upstream_monomorphization(fx.tcx, instance) {
|
if is_call_from_compiler_builtins_to_upstream_monomorphization(fx.tcx, instance) {
|
||||||
if target.is_some() {
|
if target.is_some() {
|
||||||
|
@ -698,7 +697,7 @@ pub(crate) fn codegen_drop<'tcx>(
|
||||||
target: BasicBlock,
|
target: BasicBlock,
|
||||||
) {
|
) {
|
||||||
let ty = drop_place.layout().ty;
|
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) =
|
if let ty::InstanceKind::DropGlue(_, None) | ty::InstanceKind::AsyncDropGlueCtorShim(_, None) =
|
||||||
drop_instance.def
|
drop_instance.def
|
||||||
|
|
|
@ -673,8 +673,7 @@ fn codegen_stmt<'tcx>(
|
||||||
def_id,
|
def_id,
|
||||||
args,
|
args,
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap(),
|
||||||
.polymorphize(fx.tcx),
|
|
||||||
);
|
);
|
||||||
let func_addr = fx.bcx.ins().func_addr(fx.pointer_type, func_ref);
|
let func_addr = fx.bcx.ins().func_addr(fx.pointer_type, func_ref);
|
||||||
lval.write_cvalue(fx, CValue::by_val(func_addr, to_layout));
|
lval.write_cvalue(fx, CValue::by_val(func_addr, to_layout));
|
||||||
|
@ -760,8 +759,7 @@ fn codegen_stmt<'tcx>(
|
||||||
def_id,
|
def_id,
|
||||||
args,
|
args,
|
||||||
ty::ClosureKind::FnOnce,
|
ty::ClosureKind::FnOnce,
|
||||||
)
|
);
|
||||||
.polymorphize(fx.tcx);
|
|
||||||
let func_ref = fx.get_function_ref(instance);
|
let func_ref = fx.get_function_ref(instance);
|
||||||
let func_addr = fx.bcx.ins().func_addr(fx.pointer_type, func_ref);
|
let func_addr = fx.bcx.ins().func_addr(fx.pointer_type, func_ref);
|
||||||
lval.write_cvalue(fx, CValue::by_val(func_addr, lval.layout()));
|
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 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) {
|
if is_call_from_compiler_builtins_to_upstream_monomorphization(fx.tcx, instance) {
|
||||||
fx.bcx.ins().trap(TrapCode::user(2).unwrap());
|
fx.bcx.ins().trap(TrapCode::user(2).unwrap());
|
||||||
|
|
|
@ -452,8 +452,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant
|
||||||
let data_id = match reloc_target_alloc {
|
let data_id = match reloc_target_alloc {
|
||||||
GlobalAlloc::Function { instance, .. } => {
|
GlobalAlloc::Function { instance, .. } => {
|
||||||
assert_eq!(addend, 0);
|
assert_eq!(addend, 0);
|
||||||
let func_id =
|
let func_id = crate::abi::import_function(tcx, module, instance);
|
||||||
crate::abi::import_function(tcx, module, instance.polymorphize(tcx));
|
|
||||||
let local_func_id = module.declare_func_in_data(func_id, &mut data);
|
let local_func_id = module.declare_func_in_data(func_id, &mut data);
|
||||||
data.write_function_addr(offset.bytes() as u32, local_func_id);
|
data.write_function_addr(offset.bytes() as u32, local_func_id);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -24,7 +24,7 @@ pub(crate) fn maybe_create_entry_wrapper(
|
||||||
};
|
};
|
||||||
|
|
||||||
if main_def_id.is_local() {
|
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() {
|
if module.get_name(tcx.symbol_name(instance).name).is_none() {
|
||||||
return;
|
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_name = tcx.symbol_name(instance).name;
|
||||||
let main_sig = get_function_sig(tcx, m.target_config().default_call_conv, instance);
|
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,
|
report.def_id,
|
||||||
tcx.mk_args(&[GenericArg::from(main_ret_ty)]),
|
tcx.mk_args(&[GenericArg::from(main_ret_ty)]),
|
||||||
DUMMY_SP,
|
DUMMY_SP,
|
||||||
)
|
);
|
||||||
.polymorphize(tcx);
|
|
||||||
|
|
||||||
let report_name = tcx.symbol_name(report).name;
|
let report_name = tcx.symbol_name(report).name;
|
||||||
let report_sig = get_function_sig(tcx, m.target_config().default_call_conv, report);
|
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,
|
start_def_id,
|
||||||
tcx.mk_args(&[main_ret_ty.into()]),
|
tcx.mk_args(&[main_ret_ty.into()]),
|
||||||
DUMMY_SP,
|
DUMMY_SP,
|
||||||
)
|
);
|
||||||
.polymorphize(tcx);
|
|
||||||
let start_func_id = import_function(tcx, m, start_instance);
|
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);
|
let main_val = bcx.ins().func_addr(m.target_config().pointer_type(), main_func_ref);
|
||||||
|
|
|
@ -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!(
|
assert_eq!(
|
||||||
from_ty,
|
from_ty,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue