From 447df1f0f7eddb74f5569df89d6ed387da709c83 Mon Sep 17 00:00:00 2001 From: Folkert Date: Tue, 2 Mar 2021 23:02:41 +0100 Subject: [PATCH] only reuse call-by-pointer wrapper if same layout --- compiler/mono/src/ir.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/mono/src/ir.rs b/compiler/mono/src/ir.rs index 36dee9b537..27d8c7a137 100644 --- a/compiler/mono/src/ir.rs +++ b/compiler/mono/src/ir.rs @@ -5736,7 +5736,9 @@ fn call_by_pointer<'a>( Layout::FunctionPointer(arg_layouts, ret_layout) if !is_thunk => { if arg_layouts.iter().any(|l| l.contains_refcounted()) { if let Some(wrapper) = procs.call_by_pointer_wrappers.get(&symbol) { - return Expr::FunctionPointer(*wrapper, layout); + if procs.specialized.contains_key(&(*wrapper, layout.clone())) { + return Expr::FunctionPointer(*wrapper, layout); + } } let name = env.unique_symbol(); @@ -5796,7 +5798,9 @@ fn call_by_pointer<'a>( Layout::FunctionPointer(arg_layouts, ret_layout) => { if arg_layouts.iter().any(|l| l.contains_refcounted()) { if let Some(wrapper) = procs.call_by_pointer_wrappers.get(&symbol) { - return Expr::FunctionPointer(*wrapper, layout); + if procs.specialized.contains_key(&(*wrapper, layout.clone())) { + return Expr::FunctionPointer(*wrapper, layout); + } } let name = env.unique_symbol();