mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
closure_env_layout
This commit is contained in:
parent
b54033a2f5
commit
cc98237a0a
6 changed files with 57 additions and 45 deletions
|
@ -830,9 +830,10 @@ pub fn build_exp_call<'a, 'ctx, 'env>(
|
|||
|
||||
CallType::HigherOrderLowLevel {
|
||||
op,
|
||||
closure_layout,
|
||||
function_owns_closure_data,
|
||||
specialization_id,
|
||||
arg_layouts,
|
||||
ret_layout,
|
||||
..
|
||||
} => {
|
||||
let bytes = specialization_id.to_bytes();
|
||||
|
@ -846,8 +847,9 @@ pub fn build_exp_call<'a, 'ctx, 'env>(
|
|||
scope,
|
||||
layout,
|
||||
*op,
|
||||
*closure_layout,
|
||||
func_spec,
|
||||
arg_layouts,
|
||||
ret_layout,
|
||||
*function_owns_closure_data,
|
||||
arguments,
|
||||
)
|
||||
|
@ -3815,8 +3817,9 @@ fn run_higher_order_low_level<'a, 'ctx, 'env>(
|
|||
scope: &Scope<'a, 'ctx>,
|
||||
return_layout: &Layout<'a>,
|
||||
op: LowLevel,
|
||||
function_layout: Layout<'a>,
|
||||
func_spec: FuncSpec,
|
||||
argument_layouts: &[Layout<'a>],
|
||||
result_layout: &Layout<'a>,
|
||||
function_owns_closure_data: bool,
|
||||
args: &[Symbol],
|
||||
) -> BasicValueEnum<'ctx> {
|
||||
|
@ -3828,6 +3831,7 @@ fn run_higher_order_low_level<'a, 'ctx, 'env>(
|
|||
macro_rules! passed_function_at_index {
|
||||
($index:expr) => {{
|
||||
let function_symbol = args[$index];
|
||||
let function_layout = Layout::FunctionPointer(argument_layouts, return_layout);
|
||||
|
||||
function_value_by_func_spec(env, func_spec, function_symbol, function_layout)
|
||||
}};
|
||||
|
@ -4095,7 +4099,7 @@ fn run_higher_order_low_level<'a, 'ctx, 'env>(
|
|||
env,
|
||||
layout_ids,
|
||||
roc_function_call,
|
||||
&function_layout,
|
||||
result_layout,
|
||||
list,
|
||||
before_layout,
|
||||
after_layout,
|
||||
|
@ -4139,7 +4143,7 @@ fn run_higher_order_low_level<'a, 'ctx, 'env>(
|
|||
env,
|
||||
layout_ids,
|
||||
roc_function_call,
|
||||
&function_layout,
|
||||
result_layout,
|
||||
list,
|
||||
before_layout,
|
||||
after_layout,
|
||||
|
|
|
@ -601,18 +601,12 @@ pub fn list_keep_oks<'a, 'ctx, 'env>(
|
|||
env: &Env<'a, 'ctx, 'env>,
|
||||
layout_ids: &mut LayoutIds<'a>,
|
||||
roc_function_call: RocFunctionCall<'ctx>,
|
||||
function_layout: &Layout<'a>,
|
||||
// Layout of the `Result after *`
|
||||
result_layout: &Layout<'a>,
|
||||
list: BasicValueEnum<'ctx>,
|
||||
before_layout: &Layout<'a>,
|
||||
after_layout: &Layout<'a>,
|
||||
) -> BasicValueEnum<'ctx> {
|
||||
// Layout of the `Result after *`
|
||||
let result_layout = match function_layout {
|
||||
Layout::FunctionPointer(_, ret) => ret,
|
||||
Layout::Closure(_, _, ret) => ret,
|
||||
_ => unreachable!("not a callable layout"),
|
||||
};
|
||||
|
||||
let dec_result_fn = build_dec_wrapper(env, layout_ids, result_layout);
|
||||
|
||||
call_bitcode_fn(
|
||||
|
@ -638,18 +632,12 @@ pub fn list_keep_errs<'a, 'ctx, 'env>(
|
|||
env: &Env<'a, 'ctx, 'env>,
|
||||
layout_ids: &mut LayoutIds<'a>,
|
||||
roc_function_call: RocFunctionCall<'ctx>,
|
||||
function_layout: &Layout<'a>,
|
||||
// Layout of the `Result * err`
|
||||
result_layout: &Layout<'a>,
|
||||
list: BasicValueEnum<'ctx>,
|
||||
before_layout: &Layout<'a>,
|
||||
after_layout: &Layout<'a>,
|
||||
) -> BasicValueEnum<'ctx> {
|
||||
// Layout of the `Result after *`
|
||||
let result_layout = match function_layout {
|
||||
Layout::FunctionPointer(_, ret) => ret,
|
||||
Layout::Closure(_, _, ret) => ret,
|
||||
_ => unreachable!("not a callable layout"),
|
||||
};
|
||||
|
||||
let dec_result_fn = build_dec_wrapper(env, layout_ids, result_layout);
|
||||
|
||||
call_bitcode_fn(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue