Merge remote-tracking branch 'origin/main' into roc-dev-inline-expects

This commit is contained in:
Folkert 2022-11-05 12:21:37 +01:00
commit 92cc120c7f
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
150 changed files with 3480 additions and 2605 deletions

View file

@ -126,7 +126,7 @@ impl<'ctx> Iterator for FunctionIterator<'ctx> {
}
}
#[derive(Default, Debug, Clone, PartialEq)]
#[derive(Default, Debug, Clone, PartialEq, Eq)]
pub struct Scope<'a, 'ctx> {
symbols: ImMap<Symbol, (Layout<'a>, BasicValueEnum<'ctx>)>,
pub top_level_thunks: ImMap<Symbol, (ProcLayout<'a>, FunctionValue<'ctx>)>,
@ -977,7 +977,7 @@ pub fn build_exp_literal<'a, 'ctx, 'env>(
_ => unreachable!("incorrect small_str_bytes"),
}
} else {
let ptr = define_global_str_literal_ptr(env, *str_literal);
let ptr = define_global_str_literal_ptr(env, str_literal);
let number_of_elements = env.ptr_int().const_int(str_literal.len() as u64, false);
let alloca =
@ -2727,14 +2727,7 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
let layout = *layout;
if layout.contains_refcounted(env.layout_interner) {
increment_refcount_layout(
env,
parent,
layout_ids,
*inc_amount,
value,
&layout,
);
increment_refcount_layout(env, layout_ids, *inc_amount, value, &layout);
}
build_exp_stmt(env, layout_ids, func_spec_solutions, scope, parent, cont)
@ -2743,7 +2736,7 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
let (value, layout) = load_symbol_and_layout(scope, symbol);
if layout.contains_refcounted(env.layout_interner) {
decrement_refcount_layout(env, parent, layout_ids, value, layout);
decrement_refcount_layout(env, layout_ids, value, layout);
}
build_exp_stmt(env, layout_ids, func_spec_solutions, scope, parent, cont)
@ -3859,12 +3852,9 @@ fn expose_function_to_host_help_c_abi_v2<'a, 'ctx, 'env>(
arg_type.into_pointer_type().get_element_type(),
);
// C return pointer goes at the beginning of params, and we must skip it if it exists.
let param_index = (i
+ (if matches!(cc_return, CCReturn::ByPointer) {
1
} else {
0
})) as u32;
let returns_pointer = matches!(cc_return, CCReturn::ByPointer);
let param_index = i as u32 + returns_pointer as u32;
c_function.add_attribute(AttributeLoc::Param(param_index), byval);
c_function.add_attribute(AttributeLoc::Param(param_index), nonnull);
}
@ -4568,7 +4558,7 @@ fn build_procedures_help<'a, 'ctx, 'env>(
fn_val.print_to_stderr();
if let Some(app_ll_file) = debug_output_file {
env.module.print_to_file(&app_ll_file).unwrap();
env.module.print_to_file(app_ll_file).unwrap();
panic!(
r"😱 LLVM errors when defining function {:?}; I wrote the full LLVM IR to {:?}",
@ -6223,14 +6213,7 @@ fn run_low_level<'a, 'ctx, 'env>(
let element_layout = list_element_layout!(list_layout);
list_get_unsafe(
env,
layout_ids,
parent,
element_layout,
elem_index,
wrapper_struct,
)
list_get_unsafe(env, layout_ids, element_layout, elem_index, wrapper_struct)
}
ListReplaceUnsafe => {
let list = load_symbol(scope, &args[0]);