mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
more cleanup
This commit is contained in:
parent
2793c90272
commit
e31f5d4fa0
1 changed files with 2 additions and 78 deletions
|
@ -272,7 +272,7 @@ fn build_transform_caller_help<'a, 'ctx, 'env>(
|
||||||
|
|
||||||
match closure_data_layout {
|
match closure_data_layout {
|
||||||
Layout::Struct(&[]) => {
|
Layout::Struct(&[]) => {
|
||||||
// do nothing
|
// nothing to add
|
||||||
}
|
}
|
||||||
other => {
|
other => {
|
||||||
let closure_type = basic_type_from_layout(env, &other).ptr_type(AddressSpace::Generic);
|
let closure_type = basic_type_from_layout(env, &other).ptr_type(AddressSpace::Generic);
|
||||||
|
@ -288,55 +288,6 @@ fn build_transform_caller_help<'a, 'ctx, 'env>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
match closure_data_layout {
|
|
||||||
Layout::Closure(_, lambda_set, _) => {
|
|
||||||
if let Layout::Struct(&[]) = lambda_set.runtime_representation() {
|
|
||||||
// do nothing
|
|
||||||
} else {
|
|
||||||
let closure_type =
|
|
||||||
basic_type_from_layout(env, &lambda_set.runtime_representation())
|
|
||||||
.ptr_type(AddressSpace::Generic);
|
|
||||||
|
|
||||||
let closure_cast = env
|
|
||||||
.builder
|
|
||||||
.build_bitcast(closure_ptr, closure_type, "load_opaque")
|
|
||||||
.into_pointer_value();
|
|
||||||
|
|
||||||
let closure_data = env.builder.build_load(closure_cast, "load_opaque");
|
|
||||||
|
|
||||||
arguments_cast.push(closure_data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Layout::Struct([Layout::Closure(_, lambda_set, _)]) => {
|
|
||||||
// a case required for Set.walk; may be able to remove when we can define builtins in
|
|
||||||
// terms of other builtins in the right way (using their function symbols instead of
|
|
||||||
// hacking with lowlevel ops).
|
|
||||||
let closure_type = basic_type_from_layout(
|
|
||||||
env,
|
|
||||||
&Layout::Struct(&[lambda_set.runtime_representation()]),
|
|
||||||
)
|
|
||||||
.ptr_type(AddressSpace::Generic);
|
|
||||||
|
|
||||||
let closure_cast = env
|
|
||||||
.builder
|
|
||||||
.build_bitcast(closure_ptr, closure_type, "load_opaque")
|
|
||||||
.into_pointer_value();
|
|
||||||
|
|
||||||
let closure_data = env.builder.build_load(closure_cast, "load_opaque");
|
|
||||||
|
|
||||||
arguments_cast.push(closure_data);
|
|
||||||
}
|
|
||||||
Layout::Struct([]) => {
|
|
||||||
// do nothing, should try to remove this case later
|
|
||||||
}
|
|
||||||
Layout::Struct(_) => {
|
|
||||||
// do nothing, should try to remove this case later
|
|
||||||
}
|
|
||||||
other => unreachable!("layout is not valid for a closure: {:?}", other),
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
let call = {
|
let call = {
|
||||||
env.builder
|
env.builder
|
||||||
.build_call(roc_function, arguments_cast.as_slice(), "tmp")
|
.build_call(roc_function, arguments_cast.as_slice(), "tmp")
|
||||||
|
@ -644,39 +595,12 @@ pub fn build_compare_wrapper<'a, 'ctx, 'env>(
|
||||||
|
|
||||||
let default = [value1, value2];
|
let default = [value1, value2];
|
||||||
|
|
||||||
/*
|
|
||||||
let arguments_cast = match closure_data_layout {
|
|
||||||
Layout::Closure(_, lambda_set, _) => {
|
|
||||||
if let Layout::Struct(&[]) = lambda_set.runtime_representation() {
|
|
||||||
&default
|
|
||||||
} else {
|
|
||||||
let closure_type =
|
|
||||||
basic_type_from_layout(env, &lambda_set.runtime_representation())
|
|
||||||
.ptr_type(AddressSpace::Generic);
|
|
||||||
|
|
||||||
let closure_cast = env
|
|
||||||
.builder
|
|
||||||
.build_bitcast(closure_ptr, closure_type, "load_opaque")
|
|
||||||
.into_pointer_value();
|
|
||||||
|
|
||||||
let closure_data = env.builder.build_load(closure_cast, "load_opaque");
|
|
||||||
|
|
||||||
env.arena.alloc([value1, value2, closure_data]) as &[_]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Layout::Struct([]) => &default,
|
|
||||||
other => unreachable!("layout is not valid for a closure: {:?}", other),
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
let arguments_cast = match closure_data_layout {
|
let arguments_cast = match closure_data_layout {
|
||||||
Layout::Struct(&[]) => {
|
Layout::Struct(&[]) => {
|
||||||
// do nothing
|
// nothing to add
|
||||||
&default
|
&default
|
||||||
}
|
}
|
||||||
other => {
|
other => {
|
||||||
//
|
|
||||||
|
|
||||||
let closure_type =
|
let closure_type =
|
||||||
basic_type_from_layout(env, &other).ptr_type(AddressSpace::Generic);
|
basic_type_from_layout(env, &other).ptr_type(AddressSpace::Generic);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue