Querify fn_abi_of_{fn_ptr,instance}
.
This commit is contained in:
parent
849b4c4483
commit
e857fabac1
@ -53,7 +53,11 @@ pub(crate) fn get_function_sig<'tcx>(
|
|||||||
inst: Instance<'tcx>,
|
inst: Instance<'tcx>,
|
||||||
) -> Signature {
|
) -> Signature {
|
||||||
assert!(!inst.substs.needs_infer());
|
assert!(!inst.substs.needs_infer());
|
||||||
clif_sig_from_fn_abi(tcx, triple, &RevealAllLayoutCx(tcx).fn_abi_of_instance(inst, &[]))
|
clif_sig_from_fn_abi(
|
||||||
|
tcx,
|
||||||
|
triple,
|
||||||
|
&RevealAllLayoutCx(tcx).fn_abi_of_instance(inst, ty::List::empty()),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Instance must be monomorphized
|
/// Instance must be monomorphized
|
||||||
@ -350,14 +354,13 @@ pub(crate) fn codegen_terminator_call<'tcx>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
let extra_args = &args[fn_sig.inputs().len()..];
|
let extra_args = &args[fn_sig.inputs().len()..];
|
||||||
let extra_args = extra_args
|
let extra_args = fx
|
||||||
.iter()
|
.tcx
|
||||||
.map(|op_arg| fx.monomorphize(op_arg.ty(fx.mir, fx.tcx)))
|
.mk_type_list(extra_args.iter().map(|op_arg| fx.monomorphize(op_arg.ty(fx.mir, fx.tcx))));
|
||||||
.collect::<Vec<_>>();
|
|
||||||
let fn_abi = if let Some(instance) = instance {
|
let fn_abi = if let Some(instance) = instance {
|
||||||
RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(instance, &extra_args)
|
RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(instance, extra_args)
|
||||||
} else {
|
} else {
|
||||||
RevealAllLayoutCx(fx.tcx).fn_abi_of_fn_ptr(fn_ty.fn_sig(fx.tcx), &extra_args)
|
RevealAllLayoutCx(fx.tcx).fn_abi_of_fn_ptr(fn_ty.fn_sig(fx.tcx), extra_args)
|
||||||
};
|
};
|
||||||
|
|
||||||
let is_cold = instance
|
let is_cold = instance
|
||||||
@ -525,7 +528,8 @@ pub(crate) fn codegen_drop<'tcx>(
|
|||||||
def: ty::InstanceDef::Virtual(drop_instance.def_id(), 0),
|
def: ty::InstanceDef::Virtual(drop_instance.def_id(), 0),
|
||||||
substs: drop_instance.substs,
|
substs: drop_instance.substs,
|
||||||
};
|
};
|
||||||
let fn_abi = RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(virtual_drop, &[]);
|
let fn_abi =
|
||||||
|
RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(virtual_drop, ty::List::empty());
|
||||||
|
|
||||||
let sig = clif_sig_from_fn_abi(fx.tcx, fx.triple(), &fn_abi);
|
let sig = clif_sig_from_fn_abi(fx.tcx, fx.triple(), &fn_abi);
|
||||||
let sig = fx.bcx.import_signature(sig);
|
let sig = fx.bcx.import_signature(sig);
|
||||||
@ -534,7 +538,8 @@ pub(crate) fn codegen_drop<'tcx>(
|
|||||||
_ => {
|
_ => {
|
||||||
assert!(!matches!(drop_instance.def, InstanceDef::Virtual(_, _)));
|
assert!(!matches!(drop_instance.def, InstanceDef::Virtual(_, _)));
|
||||||
|
|
||||||
let fn_abi = RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(drop_instance, &[]);
|
let fn_abi =
|
||||||
|
RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(drop_instance, ty::List::empty());
|
||||||
|
|
||||||
let arg_value = drop_place.place_ref(
|
let arg_value = drop_place.place_ref(
|
||||||
fx,
|
fx,
|
||||||
|
@ -61,7 +61,7 @@ pub(crate) fn codegen_fn<'tcx>(
|
|||||||
instance,
|
instance,
|
||||||
symbol_name,
|
symbol_name,
|
||||||
mir,
|
mir,
|
||||||
fn_abi: Some(RevealAllLayoutCx(tcx).fn_abi_of_instance(instance, &[])),
|
fn_abi: Some(RevealAllLayoutCx(tcx).fn_abi_of_instance(instance, ty::List::empty())),
|
||||||
|
|
||||||
bcx,
|
bcx,
|
||||||
block_map,
|
block_map,
|
||||||
|
@ -276,7 +276,7 @@ fn handle_fn_abi_err(
|
|||||||
&self,
|
&self,
|
||||||
err: FnAbiError<'tcx>,
|
err: FnAbiError<'tcx>,
|
||||||
span: Span,
|
span: Span,
|
||||||
fn_abi_request: FnAbiRequest<'_, 'tcx>,
|
fn_abi_request: FnAbiRequest<'tcx>,
|
||||||
) -> ! {
|
) -> ! {
|
||||||
RevealAllLayoutCx(self.tcx).handle_fn_abi_err(err, span, fn_abi_request)
|
RevealAllLayoutCx(self.tcx).handle_fn_abi_err(err, span, fn_abi_request)
|
||||||
}
|
}
|
||||||
@ -402,7 +402,7 @@ fn handle_fn_abi_err(
|
|||||||
&self,
|
&self,
|
||||||
err: FnAbiError<'tcx>,
|
err: FnAbiError<'tcx>,
|
||||||
span: Span,
|
span: Span,
|
||||||
fn_abi_request: FnAbiRequest<'_, 'tcx>,
|
fn_abi_request: FnAbiRequest<'tcx>,
|
||||||
) -> ! {
|
) -> ! {
|
||||||
if let FnAbiError::Layout(LayoutError::SizeOverflow(_)) = err {
|
if let FnAbiError::Layout(LayoutError::SizeOverflow(_)) = err {
|
||||||
self.0.sess.span_fatal(span, &err.to_string())
|
self.0.sess.span_fatal(span, &err.to_string())
|
||||||
|
@ -80,7 +80,10 @@ pub(crate) fn new<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> Self {
|
|||||||
vec![
|
vec![
|
||||||
format!("symbol {}", tcx.symbol_name(instance).name),
|
format!("symbol {}", tcx.symbol_name(instance).name),
|
||||||
format!("instance {:?}", instance),
|
format!("instance {:?}", instance),
|
||||||
format!("abi {:?}", RevealAllLayoutCx(tcx).fn_abi_of_instance(instance, &[])),
|
format!(
|
||||||
|
"abi {:?}",
|
||||||
|
RevealAllLayoutCx(tcx).fn_abi_of_instance(instance, ty::List::empty())
|
||||||
|
),
|
||||||
String::new(),
|
String::new(),
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user