mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
only reuse call-by-pointer wrapper if same layout
This commit is contained in:
parent
24fcafa1c4
commit
447df1f0f7
1 changed files with 6 additions and 2 deletions
|
@ -5736,8 +5736,10 @@ fn call_by_pointer<'a>(
|
||||||
Layout::FunctionPointer(arg_layouts, ret_layout) if !is_thunk => {
|
Layout::FunctionPointer(arg_layouts, ret_layout) if !is_thunk => {
|
||||||
if arg_layouts.iter().any(|l| l.contains_refcounted()) {
|
if arg_layouts.iter().any(|l| l.contains_refcounted()) {
|
||||||
if let Some(wrapper) = procs.call_by_pointer_wrappers.get(&symbol) {
|
if let Some(wrapper) = procs.call_by_pointer_wrappers.get(&symbol) {
|
||||||
|
if procs.specialized.contains_key(&(*wrapper, layout.clone())) {
|
||||||
return Expr::FunctionPointer(*wrapper, layout);
|
return Expr::FunctionPointer(*wrapper, layout);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let name = env.unique_symbol();
|
let name = env.unique_symbol();
|
||||||
let mut args = Vec::with_capacity_in(arg_layouts.len(), env.arena);
|
let mut args = Vec::with_capacity_in(arg_layouts.len(), env.arena);
|
||||||
|
@ -5796,8 +5798,10 @@ fn call_by_pointer<'a>(
|
||||||
Layout::FunctionPointer(arg_layouts, ret_layout) => {
|
Layout::FunctionPointer(arg_layouts, ret_layout) => {
|
||||||
if arg_layouts.iter().any(|l| l.contains_refcounted()) {
|
if arg_layouts.iter().any(|l| l.contains_refcounted()) {
|
||||||
if let Some(wrapper) = procs.call_by_pointer_wrappers.get(&symbol) {
|
if let Some(wrapper) = procs.call_by_pointer_wrappers.get(&symbol) {
|
||||||
|
if procs.specialized.contains_key(&(*wrapper, layout.clone())) {
|
||||||
return Expr::FunctionPointer(*wrapper, layout);
|
return Expr::FunctionPointer(*wrapper, layout);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let name = env.unique_symbol();
|
let name = env.unique_symbol();
|
||||||
let mut args = Vec::with_capacity_in(arg_layouts.len(), env.arena);
|
let mut args = Vec::with_capacity_in(arg_layouts.len(), env.arena);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue