mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
explicitly store and pass layout of a function passed to lowlevel
This commit is contained in:
parent
357f93a2ee
commit
3739f41cac
3 changed files with 103 additions and 87 deletions
|
@ -7691,26 +7691,16 @@ where
|
|||
Layout::Struct(_) => {
|
||||
let function_symbol = lambda_set.set[0].0;
|
||||
|
||||
let bound = env.unique_symbol();
|
||||
|
||||
// build the call
|
||||
let stmt = Stmt::Let(
|
||||
Stmt::Let(
|
||||
assigned,
|
||||
Expr::Call(to_lowlevel_call(
|
||||
bound,
|
||||
function_symbol,
|
||||
closure_data_symbol,
|
||||
function_layout,
|
||||
)),
|
||||
return_layout,
|
||||
env.arena.alloc(hole),
|
||||
);
|
||||
|
||||
// fix the layout; needs top-level signature
|
||||
Stmt::Let(
|
||||
bound,
|
||||
Expr::FunctionPointer(function_symbol, function_layout),
|
||||
function_layout,
|
||||
env.arena.alloc(stmt),
|
||||
)
|
||||
}
|
||||
Layout::Builtin(Builtin::Int1) => {
|
||||
|
@ -7775,13 +7765,11 @@ where
|
|||
|
||||
let hole = Stmt::Jump(join_point_id, env.arena.alloc([assigned]));
|
||||
|
||||
let bound = env.unique_symbol();
|
||||
|
||||
// build the call
|
||||
let stmt = Stmt::Let(
|
||||
assigned,
|
||||
Expr::Call(to_lowlevel_call(
|
||||
bound,
|
||||
*function_symbol,
|
||||
closure_data_symbol,
|
||||
function_layout,
|
||||
)),
|
||||
|
@ -7789,13 +7777,6 @@ where
|
|||
env.arena.alloc(hole),
|
||||
);
|
||||
|
||||
let stmt = Stmt::Let(
|
||||
bound,
|
||||
Expr::FunctionPointer(*function_symbol, function_layout),
|
||||
function_layout,
|
||||
env.arena.alloc(stmt),
|
||||
);
|
||||
|
||||
branches.push((i as u64, BranchInfo::None, stmt));
|
||||
}
|
||||
|
||||
|
@ -7844,25 +7825,16 @@ where
|
|||
|
||||
let hole = Stmt::Jump(join_point_id, env.arena.alloc([assigned]));
|
||||
|
||||
let bound = env.unique_symbol();
|
||||
|
||||
// build the call
|
||||
let stmt = Stmt::Let(
|
||||
Stmt::Let(
|
||||
assigned,
|
||||
Expr::Call(to_lowlevel_call(
|
||||
bound,
|
||||
function_symbol,
|
||||
closure_data_symbol,
|
||||
function_layout,
|
||||
)),
|
||||
return_layout,
|
||||
env.arena.alloc(hole),
|
||||
);
|
||||
|
||||
Stmt::Let(
|
||||
assigned,
|
||||
Expr::FunctionPointer(function_symbol, function_layout),
|
||||
function_layout,
|
||||
env.arena.alloc(stmt),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -8328,24 +8300,15 @@ where
|
|||
|
||||
let hole = Stmt::Jump(join_point_id, env.arena.alloc([result_symbol]));
|
||||
|
||||
let bound = env.unique_symbol();
|
||||
|
||||
// build the call
|
||||
let stmt = Stmt::Let(
|
||||
Stmt::Let(
|
||||
result_symbol,
|
||||
Expr::Call(to_lowlevel_call(
|
||||
bound,
|
||||
function_symbol,
|
||||
closure_data_symbol,
|
||||
function_layout,
|
||||
)),
|
||||
return_layout,
|
||||
env.arena.alloc(hole),
|
||||
);
|
||||
|
||||
Stmt::Let(
|
||||
bound,
|
||||
Expr::FunctionPointer(function_symbol, function_layout),
|
||||
function_layout,
|
||||
env.arena.alloc(stmt),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue