diff --git a/Cargo.lock b/Cargo.lock index 256cbe02628..904d6d5066b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3669,6 +3669,7 @@ dependencies = [ name = "roc_mono" version = "0.0.1" dependencies = [ + "arrayvec 0.7.2", "bitvec", "bumpalo", "hashbrown 0.13.2", diff --git a/README.md b/README.md index 1887ea37ec7..d701a872935 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Roc is not ready for a 0.1 release yet, but we do have: - [**installation** guide](https://github.com/roc-lang/roc/tree/main/getting_started) - [**tutorial**](https://roc-lang.org/tutorial) -- [**docs** for the standard library](https://www.roc-lang.org/builtins/Str) +- [**docs** for the standard library](https://www.roc-lang.org/builtins) - [**examples**](https://github.com/roc-lang/examples/tree/main/examples) - [frequently asked questions](https://github.com/roc-lang/roc/blob/main/FAQ.md) - [Group chat](https://roc.zulipchat.com) for help, questions and discussions diff --git a/crates/cli_testing_examples/benchmarks/CFold.roc b/crates/cli_testing_examples/benchmarks/CFold.roc index 8fbb087e337..e4b1e2423dd 100644 --- a/crates/cli_testing_examples/benchmarks/CFold.roc +++ b/crates/cli_testing_examples/benchmarks/CFold.roc @@ -21,7 +21,7 @@ main = |> Task.putLine Err GetIntError -> - Task.putLine "Error: Failed to get Integer from stdin." + Task.putLine "Error: Failed to get Integer from stdin." Expr : [ Add Expr Expr, @@ -100,35 +100,27 @@ constFolding = \e -> x1 = constFolding e1 x2 = constFolding e2 - when Pair x1 x2 is - Pair (Val a) (Val b) -> - Val (a + b) + when x1 is + Val a -> + when x2 is + Val b -> Val (a + b) + Add (Val b) x | Add x (Val b) -> Add (Val (a + b)) x + _ -> Add x1 x2 - Pair (Val a) (Add (Val b) x) -> - Add (Val (a + b)) x - - Pair (Val a) (Add x (Val b)) -> - Add (Val (a + b)) x - - Pair y1 y2 -> - Add y1 y2 + _ -> Add x1 x2 Mul e1 e2 -> x1 = constFolding e1 x2 = constFolding e2 - when Pair x1 x2 is - Pair (Val a) (Val b) -> - Val (a * b) - - Pair (Val a) (Mul (Val b) x) -> - Mul (Val (a * b)) x - - Pair (Val a) (Mul x (Val b)) -> - Mul (Val (a * b)) x + when x1 is + Val a -> + when x2 is + Val b -> Val (a * b) + Mul (Val b) x | Mul x (Val b) -> Mul (Val (a * b)) x + _ -> Mul x1 x2 - Pair y1 y2 -> - Add y1 y2 + _ -> Mul x1 x2 _ -> e diff --git a/crates/cli_testing_examples/benchmarks/Deriv.roc b/crates/cli_testing_examples/benchmarks/Deriv.roc index 5ad3f3b9d0c..974c1ada668 100644 --- a/crates/cli_testing_examples/benchmarks/Deriv.roc +++ b/crates/cli_testing_examples/benchmarks/Deriv.roc @@ -23,7 +23,6 @@ main = Err GetIntError -> Task.putLine "Error: Failed to get Integer from stdin." - nest : (I64, Expr -> IO Expr), I64, Expr -> IO Expr nest = \f, n, e -> Task.loop { s: n, f, m: n, x: e } nestHelp diff --git a/crates/cli_testing_examples/benchmarks/NQueens.roc b/crates/cli_testing_examples/benchmarks/NQueens.roc index e1a94144282..15593e37216 100644 --- a/crates/cli_testing_examples/benchmarks/NQueens.roc +++ b/crates/cli_testing_examples/benchmarks/NQueens.roc @@ -10,8 +10,8 @@ main = when inputResult is Ok n -> queens n # original koka 13 - |> Num.toStr - |> Task.putLine + |> Num.toStr + |> Task.putLine Err GetIntError -> Task.putLine "Error: Failed to get Integer from stdin." @@ -21,7 +21,8 @@ ConsList a : [Nil, Cons a (ConsList a)] queens = \n -> length (findSolutions n n) findSolutions = \n, k -> - if k <= 0 then # should we use U64 as input type here instead? + if k <= 0 then + # should we use U64 as input type here instead? Cons Nil Nil else extend n Nil (findSolutions n (k - 1)) @@ -40,14 +41,15 @@ appendSafe = \k, soln, solns -> else appendSafe (k - 1) soln solns - safe : I64, I64, ConsList I64 -> Bool safe = \queen, diagonal, xs -> when xs is Nil -> Bool.true Cons q t -> - queen != q && queen != q + diagonal && queen != q - diagonal && safe queen (diagonal + 1) t - + if queen != q && queen != q + diagonal && queen != q - diagonal then + safe queen (diagonal + 1) t + else + Bool.false length : ConsList a -> I64 length = \xs -> diff --git a/crates/cli_testing_examples/benchmarks/QuicksortApp.roc b/crates/cli_testing_examples/benchmarks/QuicksortApp.roc index cc38026216c..67766bc9820 100644 --- a/crates/cli_testing_examples/benchmarks/QuicksortApp.roc +++ b/crates/cli_testing_examples/benchmarks/QuicksortApp.roc @@ -23,7 +23,6 @@ main = Err GetIntError -> Task.putLine "Error: Failed to get Integer from stdin." - sort : List I64 -> List I64 sort = \list -> diff --git a/crates/cli_testing_examples/benchmarks/RBTreeCk.roc b/crates/cli_testing_examples/benchmarks/RBTreeCk.roc index 254be6d0ebf..5c685b195e6 100644 --- a/crates/cli_testing_examples/benchmarks/RBTreeCk.roc +++ b/crates/cli_testing_examples/benchmarks/RBTreeCk.roc @@ -93,9 +93,15 @@ ins = \tree, kx, vx -> Node Black a ky vy b -> if lt kx ky then - (if isRed a then balance1 (Node Black Leaf ky vy b) (ins a kx vx) else Node Black (ins a kx vx) ky vy b) + if isRed a then + balance1 (Node Black Leaf ky vy b) (ins a kx vx) + else + Node Black (ins a kx vx) ky vy b else if lt ky kx then - (if isRed b then balance2 (Node Black a ky vy Leaf) (ins b kx vx) else Node Black a ky vy (ins b kx vx)) + if isRed b then + balance2 (Node Black a ky vy Leaf) (ins b kx vx) + else + Node Black a ky vy (ins b kx vx) else Node Black a kx vx b diff --git a/crates/cli_testing_examples/benchmarks/RBTreeDel.roc b/crates/cli_testing_examples/benchmarks/RBTreeDel.roc index 37f0523ecac..7f5e940b73d 100644 --- a/crates/cli_testing_examples/benchmarks/RBTreeDel.roc +++ b/crates/cli_testing_examples/benchmarks/RBTreeDel.roc @@ -26,7 +26,6 @@ main = Err GetIntError -> Task.putLine "Error: Failed to get Integer from stdin." - boom : Str -> a boom = \_ -> boom "" diff --git a/crates/compiler/alias_analysis/src/lib.rs b/crates/compiler/alias_analysis/src/lib.rs index 855b54f86e0..27a3be99478 100644 --- a/crates/compiler/alias_analysis/src/lib.rs +++ b/crates/compiler/alias_analysis/src/lib.rs @@ -1422,6 +1422,38 @@ fn expr_spec<'a>( builder.add_get_tuple_field(block, variant_id, index) } }, + UnionFieldPtrAtIndex { + index, + tag_id, + structure, + union_layout, + } => { + let index = (*index) as u32; + let tag_value_id = env.symbols[structure]; + + let type_name_bytes = recursive_tag_union_name_bytes(union_layout).as_bytes(); + let type_name = TypeName(&type_name_bytes); + + // unwrap the named wrapper + let union_id = builder.add_unwrap_named(block, MOD_APP, type_name, tag_value_id)?; + + // now we have a tuple (cell, union { ... }); decompose + let heap_cell = builder.add_get_tuple_field(block, union_id, TAG_CELL_INDEX)?; + let union_data = builder.add_get_tuple_field(block, union_id, TAG_DATA_INDEX)?; + + // we're reading from this value, so touch the heap cell + builder.add_touch(block, heap_cell)?; + + // next, unwrap the union at the tag id that we've got + let variant_id = builder.add_unwrap_union(block, union_data, *tag_id as u32)?; + + let value = builder.add_get_tuple_field(block, variant_id, index)?; + + // construct the box. Here the heap_cell of the tag is re-used, I'm hoping that that + // conveys to morphic that we're borrowing into the existing tag?! + builder.add_make_tuple(block, &[heap_cell, value]) + } + StructAtIndex { index, structure, .. } => { @@ -1589,13 +1621,14 @@ fn layout_spec_help<'a>( } } - Boxed(inner_layout) => { + Ptr(inner_layout) | Boxed(inner_layout) => { let inner_type = layout_spec_help(env, builder, interner, interner.get_repr(inner_layout))?; let cell_type = builder.add_heap_cell_type(); builder.add_tuple_type(&[cell_type, inner_type]) } + // TODO(recursive-layouts): update once we have recursive pointer loops RecursivePointer(union_layout) => match interner.get_repr(union_layout) { LayoutRepr::Union(union_layout) => { diff --git a/crates/compiler/can/src/builtins.rs b/crates/compiler/can/src/builtins.rs index 9f05e61ddfe..656f9cd1b42 100644 --- a/crates/compiler/can/src/builtins.rs +++ b/crates/compiler/can/src/builtins.rs @@ -85,7 +85,9 @@ macro_rules! map_symbol_to_lowlevel_and_arity { // these are used internally and not tied to a symbol LowLevel::Hash => unimplemented!(), LowLevel::PtrCast => unimplemented!(), - LowLevel::PtrWrite => unimplemented!(), + LowLevel::PtrStore => unimplemented!(), + LowLevel::PtrLoad => unimplemented!(), + LowLevel::Alloca => unimplemented!(), LowLevel::RefCountIncRcPtr => unimplemented!(), LowLevel::RefCountDecRcPtr=> unimplemented!(), LowLevel::RefCountIncDataPtr => unimplemented!(), diff --git a/crates/compiler/collections/src/vec_set.rs b/crates/compiler/collections/src/vec_set.rs index 52be9862497..2a19bf2b9c7 100644 --- a/crates/compiler/collections/src/vec_set.rs +++ b/crates/compiler/collections/src/vec_set.rs @@ -34,6 +34,12 @@ impl VecSet { self.elements.is_empty() } + pub fn singleton(value: T) -> Self { + Self { + elements: vec![value], + } + } + pub fn swap_remove(&mut self, index: usize) -> T { self.elements.swap_remove(index) } diff --git a/crates/compiler/debug_flags/src/lib.rs b/crates/compiler/debug_flags/src/lib.rs index 3852100c710..ede77bd317a 100644 --- a/crates/compiler/debug_flags/src/lib.rs +++ b/crates/compiler/debug_flags/src/lib.rs @@ -135,6 +135,10 @@ flags! { /// instructions. ROC_PRINT_IR_AFTER_REFCOUNT + /// Writes a pretty-printed mono IR to stderr after the tail recursion (modulo cons) + /// has been applied. + ROC_PRINT_IR_AFTER_TRMC + /// Writes a pretty-printed mono IR to stderr after performing dropspecialization. /// Which inlines drop functions to remove pairs of alloc/dealloc instructions of its children. ROC_PRINT_IR_AFTER_DROP_SPECIALIZATION diff --git a/crates/compiler/gen_dev/src/generic64/mod.rs b/crates/compiler/gen_dev/src/generic64/mod.rs index 30a7078ee59..90804dbc0f8 100644 --- a/crates/compiler/gen_dev/src/generic64/mod.rs +++ b/crates/compiler/gen_dev/src/generic64/mod.rs @@ -2791,14 +2791,7 @@ impl< .storage_manager .load_to_general_reg(&mut self.buf, structure); - let mask_symbol = self.debug_symbol("tag_id_mask"); - let mask_reg = self - .storage_manager - .claim_general_reg(&mut self.buf, &mask_symbol); - ASM::mov_reg64_imm64(&mut self.buf, mask_reg, (!0b111) as _); - - // mask out the tag id bits - ASM::and_reg64_reg64_reg64(&mut self.buf, ptr_reg, ptr_reg, mask_reg); + let (mask_symbol, mask_reg) = self.clear_tag_id(ptr_reg); let mut offset = 0; for field in &other_fields[..index as usize] { @@ -2809,11 +2802,13 @@ impl< &mut self.buf, &mut self.storage_manager, self.layout_interner, - ptr_reg, + mask_reg, offset as i32, element_layout, *sym, ); + + self.free_symbol(&mask_symbol) } UnionLayout::Recursive(tag_layouts) => { let other_fields = tag_layouts[tag_id as usize]; @@ -2824,15 +2819,13 @@ impl< .load_to_general_reg(&mut self.buf, structure); // mask out the tag id bits - if !union_layout.stores_tag_id_as_data(self.storage_manager.target_info) { - let mask_symbol = self.debug_symbol("tag_id_mask"); - let mask_reg = self - .storage_manager - .claim_general_reg(&mut self.buf, &mask_symbol); - ASM::mov_reg64_imm64(&mut self.buf, mask_reg, (!0b111) as _); - - ASM::and_reg64_reg64_reg64(&mut self.buf, ptr_reg, ptr_reg, mask_reg); - } + let (unmasked_symbol, unmasked_reg) = + if union_layout.stores_tag_id_as_data(self.storage_manager.target_info) { + (None, ptr_reg) + } else { + let (mask_symbol, mask_reg) = self.clear_tag_id(ptr_reg); + (Some(mask_symbol), mask_reg) + }; let mut offset = 0; for field in &other_fields[..index as usize] { @@ -2843,16 +2836,113 @@ impl< &mut self.buf, &mut self.storage_manager, self.layout_interner, - ptr_reg, + unmasked_reg, offset as i32, element_layout, *sym, ); + + if let Some(unmasked_symbol) = unmasked_symbol { + self.free_symbol(&unmasked_symbol); + } + } + } + } + + fn load_union_field_ptr_at_index( + &mut self, + sym: &Symbol, + structure: &Symbol, + tag_id: TagIdIntType, + index: u64, + union_layout: &UnionLayout<'a>, + ) { + let ptr_reg = self + .storage_manager + .load_to_general_reg(&mut self.buf, structure); + + let sym_reg = self.storage_manager.claim_general_reg(&mut self.buf, sym); + + match union_layout { + UnionLayout::NonRecursive(_) => { + unreachable!("operation not supported") + } + UnionLayout::NonNullableUnwrapped(field_layouts) => { + let mut offset = 0; + for field in &field_layouts[..index as usize] { + offset += self.layout_interner.stack_size(*field); + } + + ASM::add_reg64_reg64_imm32(&mut self.buf, sym_reg, ptr_reg, offset as i32); + } + UnionLayout::NullableUnwrapped { + nullable_id, + other_fields, + } => { + debug_assert_ne!(tag_id, *nullable_id as TagIdIntType); + + let mut offset = 0; + for field in &other_fields[..index as usize] { + offset += self.layout_interner.stack_size(*field); + } + + ASM::add_reg64_reg64_imm32(&mut self.buf, sym_reg, ptr_reg, offset as i32); + } + + UnionLayout::NullableWrapped { + nullable_id, + other_tags, + } => { + debug_assert_ne!(tag_id, *nullable_id as TagIdIntType); + + let other_fields = if tag_id < *nullable_id { + other_tags[tag_id as usize] + } else { + other_tags[tag_id as usize - 1] + }; + + let (mask_symbol, mask_reg) = self.clear_tag_id(ptr_reg); + + let mut offset = 0; + for field in &other_fields[..index as usize] { + offset += self.layout_interner.stack_size(*field); + } + + ASM::add_reg64_reg64_imm32(&mut self.buf, sym_reg, mask_reg, offset as i32); + + self.free_symbol(&mask_symbol); + } + UnionLayout::Recursive(tag_layouts) => { + let other_fields = tag_layouts[tag_id as usize]; + + let ptr_reg = self + .storage_manager + .load_to_general_reg(&mut self.buf, structure); + + // mask out the tag id bits + let (unmasked_symbol, unmasked_reg) = + if union_layout.stores_tag_id_as_data(self.storage_manager.target_info) { + (None, ptr_reg) + } else { + let (mask_symbol, mask_reg) = self.clear_tag_id(ptr_reg); + (Some(mask_symbol), mask_reg) + }; + + let mut offset = 0; + for field in &other_fields[..index as usize] { + offset += self.layout_interner.stack_size(*field); + } + + ASM::add_reg64_reg64_imm32(&mut self.buf, sym_reg, unmasked_reg, offset as i32); + + if let Some(unmasked_symbol) = unmasked_symbol { + self.free_symbol(&unmasked_symbol); + } } } } - fn build_ptr_write( + fn build_ptr_store( &mut self, sym: Symbol, ptr: Symbol, @@ -2888,6 +2978,46 @@ impl< ASM::mov_base32_reg64(&mut self.buf, base_offset, ptr_reg); } + fn build_ptr_load(&mut self, sym: Symbol, ptr: Symbol, element_layout: InLayout<'a>) { + let ptr_reg = self + .storage_manager + .load_to_general_reg(&mut self.buf, &ptr); + + let offset = 0; + + Self::ptr_read( + &mut self.buf, + &mut self.storage_manager, + self.layout_interner, + ptr_reg, + offset, + element_layout, + sym, + ); + } + + fn build_ptr_to_stack_value( + &mut self, + sym: Symbol, + value: Symbol, + element_layout: InLayout<'a>, + ) { + // 1. acquire some stack space + let element_width = self.interner().stack_size(element_layout); + let allocation = self.debug_symbol("stack_allocation"); + let ptr = self.debug_symbol("ptr"); + let base_offset = self + .storage_manager + .claim_stack_area(&allocation, element_width); + + let ptr_reg = self.storage_manager.claim_general_reg(&mut self.buf, &ptr); + + ASM::mov_reg64_reg64(&mut self.buf, ptr_reg, CC::BASE_PTR_REG); + ASM::add_reg64_reg64_imm32(&mut self.buf, ptr_reg, ptr_reg, base_offset); + + self.build_ptr_store(sym, ptr, value, element_layout); + } + fn expr_box( &mut self, sym: Symbol, @@ -2920,27 +3050,13 @@ impl< self.free_symbol(&element_width_symbol); self.free_symbol(&element_alignment_symbol); - self.build_ptr_write(sym, allocation, value, element_layout); + self.build_ptr_store(sym, allocation, value, element_layout); self.free_symbol(&allocation); } fn expr_unbox(&mut self, dst: Symbol, ptr: Symbol, element_layout: InLayout<'a>) { - let ptr_reg = self - .storage_manager - .load_to_general_reg(&mut self.buf, &ptr); - - let offset = 0; - - Self::ptr_read( - &mut self.buf, - &mut self.storage_manager, - self.layout_interner, - ptr_reg, - offset, - element_layout, - dst, - ); + self.build_ptr_load(dst, ptr, element_layout) } fn get_tag_id(&mut self, sym: &Symbol, structure: &Symbol, union_layout: &UnionLayout<'a>) { @@ -3850,6 +3966,19 @@ impl< CC: CallConv, > Backend64Bit<'a, 'r, GeneralReg, FloatReg, ASM, CC> { + fn clear_tag_id(&mut self, ptr_reg: GeneralReg) -> (Symbol, GeneralReg) { + let unmasked_symbol = self.debug_symbol("unmasked"); + let unmasked_reg = self + .storage_manager + .claim_general_reg(&mut self.buf, &unmasked_symbol); + + ASM::mov_reg64_imm64(&mut self.buf, unmasked_reg, (!0b111) as _); + + ASM::and_reg64_reg64_reg64(&mut self.buf, unmasked_reg, ptr_reg, unmasked_reg); + + (unmasked_symbol, unmasked_reg) + } + fn compare( &mut self, op: CompareOperation, @@ -4385,6 +4514,7 @@ macro_rules! single_register_layouts { macro_rules! pointer_layouts { () => { LayoutRepr::Boxed(_) + | LayoutRepr::Ptr(_) | LayoutRepr::RecursivePointer(_) | LayoutRepr::Union( UnionLayout::Recursive(_) diff --git a/crates/compiler/gen_dev/src/generic64/storage.rs b/crates/compiler/gen_dev/src/generic64/storage.rs index a1581c7c037..318f9dc0f65 100644 --- a/crates/compiler/gen_dev/src/generic64/storage.rs +++ b/crates/compiler/gen_dev/src/generic64/storage.rs @@ -826,7 +826,7 @@ impl< self.copy_to_stack_offset(buf, size, from_offset, to_offset) } - LayoutRepr::RecursivePointer(_) | LayoutRepr::Boxed(_) | LayoutRepr::Union(_) => { + pointer_layouts!() => { // like a 64-bit integer debug_assert_eq!(to_offset % 8, 0); let reg = self.load_to_general_reg(buf, sym); diff --git a/crates/compiler/gen_dev/src/lib.rs b/crates/compiler/gen_dev/src/lib.rs index 648ab8247c3..25bd620e95e 100644 --- a/crates/compiler/gen_dev/src/lib.rs +++ b/crates/compiler/gen_dev/src/lib.rs @@ -163,6 +163,9 @@ impl<'a> LastSeenMap<'a> { Expr::UnionAtIndex { structure, .. } => { self.set_last_seen(*structure, stmt); } + Expr::UnionFieldPtrAtIndex { structure, .. } => { + self.set_last_seen(*structure, stmt); + } Expr::Array { elems, .. } => { for elem in *elems { if let ListLiteralElement::Symbol(sym) = elem { @@ -794,6 +797,14 @@ trait Backend<'a> { } => { self.load_union_at_index(sym, structure, *tag_id, *index, union_layout); } + Expr::UnionFieldPtrAtIndex { + structure, + tag_id, + union_layout, + index, + } => { + self.load_union_field_ptr_at_index(sym, structure, *tag_id, *index, union_layout); + } Expr::GetTagId { structure, union_layout, @@ -1581,14 +1592,23 @@ trait Backend<'a> { self.build_ptr_cast(sym, &args[0]) } - LowLevel::PtrWrite => { - let element_layout = match self.interner().get_repr(*ret_layout) { - LayoutRepr::Boxed(boxed) => boxed, + LowLevel::PtrStore => { + let element_layout = match self.interner().get_repr(arg_layouts[0]) { + LayoutRepr::Ptr(inner) => inner, + LayoutRepr::Boxed(inner) => inner, _ => unreachable!("cannot write to {:?}", self.interner().dbg(*ret_layout)), }; - self.build_ptr_write(*sym, args[0], args[1], element_layout); + self.build_ptr_store(*sym, args[0], args[1], element_layout); + } + LowLevel::PtrLoad => { + self.build_ptr_load(*sym, args[0], *ret_layout); + } + + LowLevel::Alloca => { + self.build_ptr_to_stack_value(*sym, args[0], arg_layouts[0]); } + LowLevel::RefCountDecRcPtr => self.build_fn_call( sym, bitcode::UTILS_DECREF_RC_PTR.to_string(), @@ -2217,7 +2237,7 @@ trait Backend<'a> { /// build_refcount_getptr loads the pointer to the reference count of src into dst. fn build_ptr_cast(&mut self, dst: &Symbol, src: &Symbol); - fn build_ptr_write( + fn build_ptr_store( &mut self, sym: Symbol, ptr: Symbol, @@ -2225,6 +2245,15 @@ trait Backend<'a> { element_layout: InLayout<'a>, ); + fn build_ptr_load(&mut self, sym: Symbol, ptr: Symbol, element_layout: InLayout<'a>); + + fn build_ptr_to_stack_value( + &mut self, + sym: Symbol, + value: Symbol, + element_layout: InLayout<'a>, + ); + /// literal_map gets the map from symbol to literal and layout, used for lazy loading and literal folding. fn literal_map(&mut self) -> &mut MutMap, *const InLayout<'a>)>; @@ -2302,6 +2331,16 @@ trait Backend<'a> { union_layout: &UnionLayout<'a>, ); + /// load_union_at_index loads into `sym` the value at `index` for `tag_id`. + fn load_union_field_ptr_at_index( + &mut self, + sym: &Symbol, + structure: &Symbol, + tag_id: TagIdIntType, + index: u64, + union_layout: &UnionLayout<'a>, + ); + /// get_tag_id loads the tag id from a the union. fn get_tag_id(&mut self, sym: &Symbol, structure: &Symbol, union_layout: &UnionLayout<'a>); diff --git a/crates/compiler/gen_dev/src/object_builder.rs b/crates/compiler/gen_dev/src/object_builder.rs index a7eba25d9ff..a5f44c61da3 100644 --- a/crates/compiler/gen_dev/src/object_builder.rs +++ b/crates/compiler/gen_dev/src/object_builder.rs @@ -485,7 +485,7 @@ fn build_exposed_generic_proc<'a, B: Backend<'a>>(backend: &mut B, proc: &Proc<' let box_write = Call { call_type: roc_mono::ir::CallType::LowLevel { - op: roc_module::low_level::LowLevel::PtrWrite, + op: roc_module::low_level::LowLevel::PtrStore, update_mode: UpdateModeId::BACKEND_DUMMY, }, arguments: arena.alloc([arg_generic, s1]), diff --git a/crates/compiler/gen_llvm/src/llvm/align.rs b/crates/compiler/gen_llvm/src/llvm/align.rs index d26b83ad5e0..8209feb06c1 100644 --- a/crates/compiler/gen_llvm/src/llvm/align.rs +++ b/crates/compiler/gen_llvm/src/llvm/align.rs @@ -120,7 +120,7 @@ impl<'a> LlvmAlignment<'a> for LayoutRepr<'a> { .llvm_alignment_bytes(interner), Builtin(builtin) => builtin.llvm_alignment_bytes(interner), RecursivePointer(_) => interner.target_info().ptr_width() as u32, - Boxed(_) => interner.target_info().ptr_width() as u32, + Ptr(_) | Boxed(_) => interner.target_info().ptr_width() as u32, } } } diff --git a/crates/compiler/gen_llvm/src/llvm/build.rs b/crates/compiler/gen_llvm/src/llvm/build.rs index c400bcce26a..38a06b4dac7 100644 --- a/crates/compiler/gen_llvm/src/llvm/build.rs +++ b/crates/compiler/gen_llvm/src/llvm/build.rs @@ -23,7 +23,7 @@ use inkwell::passes::{PassManager, PassManagerBuilder}; use inkwell::types::{ AnyType, BasicMetadataTypeEnum, BasicType, BasicTypeEnum, FunctionType, IntType, StructType, }; -use inkwell::values::BasicValueEnum::{self}; +use inkwell::values::BasicValueEnum; use inkwell::values::{ BasicMetadataValueEnum, CallSiteValue, FunctionValue, InstructionValue, IntValue, PointerValue, StructValue, @@ -1165,7 +1165,12 @@ pub(crate) fn build_exp_expr<'a, 'ctx>( env.builder.position_at_end(check_if_null); env.builder.build_conditional_branch( - env.builder.build_is_null(tag_ptr, "is_tag_null"), + // have llvm optimizations clean this up + if layout_interner.is_nullable(layout) { + env.builder.build_is_null(tag_ptr, "is_tag_null") + } else { + env.context.bool_type().const_int(false as _, false) + }, cont_block, check_if_unique, ); @@ -1246,7 +1251,12 @@ pub(crate) fn build_exp_expr<'a, 'ctx>( env.builder.position_at_end(check_if_null); env.builder.build_conditional_branch( - env.builder.build_is_null(tag_ptr, "is_tag_null"), + // have llvm optimizations clean this up + if layout_interner.is_nullable(layout) { + env.builder.build_is_null(tag_ptr, "is_tag_null") + } else { + env.context.bool_type().const_int(false as _, false) + }, cont_block, check_if_unique, ); @@ -1379,12 +1389,13 @@ pub(crate) fn build_exp_expr<'a, 'ctx>( layout_interner.get_repr(layout), ); - lookup_at_index_ptr2( + lookup_at_index_ptr( env, layout_interner, field_layouts, *index as usize, ptr, + None, target_loaded_type, ) } @@ -1404,7 +1415,7 @@ pub(crate) fn build_exp_expr<'a, 'ctx>( field_layouts, *index as usize, argument.into_pointer_value(), - struct_type.into_struct_type(), + Some(struct_type.into_struct_type()), target_loaded_type, ) } @@ -1430,12 +1441,13 @@ pub(crate) fn build_exp_expr<'a, 'ctx>( layout_interner.get_repr(layout), ); - lookup_at_index_ptr2( + lookup_at_index_ptr( env, layout_interner, field_layouts, *index as usize, ptr, + None, target_loaded_type, ) } @@ -1463,13 +1475,116 @@ pub(crate) fn build_exp_expr<'a, 'ctx>( // the tag id is not stored *index as usize, argument.into_pointer_value(), - struct_type.into_struct_type(), + Some(struct_type.into_struct_type()), target_loaded_type, ) } } } + UnionFieldPtrAtIndex { + tag_id, + structure, + index, + union_layout, + } => { + // cast the argument bytes into the desired shape for this tag + let argument = scope.load_symbol(structure); + let ret_repr = layout_interner.get_repr(layout); + + let pointer_value = match union_layout { + UnionLayout::NonRecursive(_) => unreachable!(), + UnionLayout::Recursive(tag_layouts) => { + debug_assert!(argument.is_pointer_value()); + + let field_layouts = tag_layouts[*tag_id as usize]; + + let ptr = tag_pointer_clear_tag_id(env, argument.into_pointer_value()); + let target_loaded_type = basic_type_from_layout(env, layout_interner, ret_repr); + + union_field_ptr_at_index( + env, + layout_interner, + field_layouts, + None, + *index as usize, + ptr, + target_loaded_type, + ) + } + UnionLayout::NonNullableUnwrapped(field_layouts) => { + let struct_layout = LayoutRepr::struct_(field_layouts); + + let struct_type = basic_type_from_layout(env, layout_interner, struct_layout); + let target_loaded_type = basic_type_from_layout(env, layout_interner, ret_repr); + + union_field_ptr_at_index( + env, + layout_interner, + field_layouts, + Some(struct_type.into_struct_type()), + *index as usize, + argument.into_pointer_value(), + target_loaded_type, + ) + } + UnionLayout::NullableWrapped { + nullable_id, + other_tags, + } => { + debug_assert!(argument.is_pointer_value()); + debug_assert_ne!(*tag_id, *nullable_id); + + let tag_index = if *tag_id < *nullable_id { + *tag_id + } else { + tag_id - 1 + }; + + let field_layouts = other_tags[tag_index as usize]; + + let ptr = tag_pointer_clear_tag_id(env, argument.into_pointer_value()); + let target_loaded_type = basic_type_from_layout(env, layout_interner, ret_repr); + + union_field_ptr_at_index( + env, + layout_interner, + field_layouts, + None, + *index as usize, + ptr, + target_loaded_type, + ) + } + UnionLayout::NullableUnwrapped { + nullable_id, + other_fields, + } => { + debug_assert!(argument.is_pointer_value()); + debug_assert_ne!(*tag_id != 0, *nullable_id); + + let field_layouts = other_fields; + let struct_layout = LayoutRepr::struct_(field_layouts); + + let struct_type = basic_type_from_layout(env, layout_interner, struct_layout); + let target_loaded_type = basic_type_from_layout(env, layout_interner, ret_repr); + + union_field_ptr_at_index( + env, + layout_interner, + field_layouts, + Some(struct_type.into_struct_type()), + // the tag id is not stored + *index as usize, + argument.into_pointer_value(), + target_loaded_type, + ) + } + }; + + pointer_value.into() + } + GetTagId { structure, union_layout, @@ -1816,15 +1931,22 @@ fn tag_pointer_set_tag_id<'ctx>( // we only have 3 bits, so can encode only 0..7 (or on 32-bit targets, 2 bits to encode 0..3) debug_assert!((tag_id as u32) < env.target_info.ptr_width() as u32); - let ptr_int = env.ptr_int(); + let tag_id_intval = env.ptr_int().const_int(tag_id as u64, false); - let as_int = env.builder.build_ptr_to_int(pointer, ptr_int, "to_int"); + let cast_pointer = env.builder.build_pointer_cast( + pointer, + env.context.i8_type().ptr_type(AddressSpace::default()), + "cast_to_i8_ptr", + ); - let tag_id_intval = ptr_int.const_int(tag_id as u64, false); - let combined = env.builder.build_or(as_int, tag_id_intval, "store_tag_id"); + // NOTE: assumes the lower bits of `cast_pointer` are all 0 + let indexed_pointer = unsafe { + env.builder + .build_in_bounds_gep(cast_pointer, &[tag_id_intval], "indexed_pointer") + }; env.builder - .build_int_to_ptr(combined, pointer.get_type(), "to_ptr") + .build_pointer_cast(indexed_pointer, pointer.get_type(), "cast_from_i8_ptr") } pub fn tag_pointer_tag_id_bits_and_mask(target_info: TargetInfo) -> (u64, u64) { @@ -1854,22 +1976,28 @@ pub fn tag_pointer_clear_tag_id<'ctx>( env: &Env<'_, 'ctx, '_>, pointer: PointerValue<'ctx>, ) -> PointerValue<'ctx> { - let ptr_int = env.ptr_int(); + let (_, tag_id_bits_mask) = tag_pointer_tag_id_bits_and_mask(env.target_info); - let (tag_id_bits_mask, _) = tag_pointer_tag_id_bits_and_mask(env.target_info); + let as_int = env + .builder + .build_ptr_to_int(pointer, env.ptr_int(), "to_int"); - let as_int = env.builder.build_ptr_to_int(pointer, ptr_int, "to_int"); + let mask = env.ptr_int().const_int(tag_id_bits_mask, false); - let mask = { - let a = env.ptr_int().const_all_ones(); - let tag_id_bits = env.ptr_int().const_int(tag_id_bits_mask, false); - env.builder.build_left_shift(a, tag_id_bits, "make_mask") - }; + let current_tag_id = env.builder.build_and(as_int, mask, "masked"); + + let index = env.builder.build_int_neg(current_tag_id, "index"); - let masked = env.builder.build_and(as_int, mask, "masked"); + let cast_pointer = env.builder.build_pointer_cast( + pointer, + env.context.i8_type().ptr_type(AddressSpace::default()), + "cast_to_i8_ptr", + ); + + let indexed_pointer = unsafe { env.builder.build_gep(cast_pointer, &[index], "new_ptr") }; env.builder - .build_int_to_ptr(masked, pointer.get_type(), "to_ptr") + .build_pointer_cast(indexed_pointer, pointer.get_type(), "cast_from_i8_ptr") } fn allocate_tag<'a, 'ctx>( @@ -2025,21 +2153,18 @@ fn lookup_at_index_ptr<'a, 'ctx>( field_layouts: &[InLayout<'a>], index: usize, value: PointerValue<'ctx>, - struct_type: StructType<'ctx>, + struct_type: Option>, target_loaded_type: BasicTypeEnum<'ctx>, ) -> BasicValueEnum<'ctx> { - let builder = env.builder; - - let ptr = env.builder.build_pointer_cast( + let elem_ptr = union_field_ptr_at_index_help( + env, + layout_interner, + field_layouts, + struct_type, + index, value, - struct_type.ptr_type(AddressSpace::default()), - "cast_lookup_at_index_ptr", ); - let elem_ptr = builder - .new_build_struct_gep(struct_type, ptr, index as u32, "at_index_struct_gep") - .unwrap(); - let field_layout = field_layouts[index]; let result = load_roc_value( env, @@ -2054,19 +2179,23 @@ fn lookup_at_index_ptr<'a, 'ctx>( cast_if_necessary_for_opaque_recursive_pointers(env.builder, result, target_loaded_type) } -fn lookup_at_index_ptr2<'a, 'ctx>( +fn union_field_ptr_at_index_help<'a, 'ctx>( env: &Env<'a, 'ctx, '_>, layout_interner: &STLayoutInterner<'a>, field_layouts: &'a [InLayout<'a>], + opt_struct_type: Option>, index: usize, value: PointerValue<'ctx>, - target_loaded_type: BasicTypeEnum<'ctx>, -) -> BasicValueEnum<'ctx> { +) -> PointerValue<'ctx> { let builder = env.builder; - let struct_layout = LayoutRepr::struct_(field_layouts); - let struct_type = - basic_type_from_layout(env, layout_interner, struct_layout).into_struct_type(); + let struct_type = match opt_struct_type { + Some(st) => st, + None => { + let struct_layout = LayoutRepr::struct_(field_layouts); + basic_type_from_layout(env, layout_interner, struct_layout).into_struct_type() + } + }; let data_ptr = env.builder.build_pointer_cast( value, @@ -2074,27 +2203,40 @@ fn lookup_at_index_ptr2<'a, 'ctx>( "cast_lookup_at_index_ptr", ); - let elem_ptr = builder + builder .new_build_struct_gep( struct_type, data_ptr, index as u32, "at_index_struct_gep_data", ) - .unwrap(); + .unwrap() +} - let field_layout = field_layouts[index]; - let result = load_roc_value( +fn union_field_ptr_at_index<'a, 'ctx>( + env: &Env<'a, 'ctx, '_>, + layout_interner: &STLayoutInterner<'a>, + field_layouts: &'a [InLayout<'a>], + opt_struct_type: Option>, + index: usize, + value: PointerValue<'ctx>, + target_loaded_type: BasicTypeEnum<'ctx>, +) -> PointerValue<'ctx> { + let result = union_field_ptr_at_index_help( env, layout_interner, - layout_interner.get_repr(field_layout), - elem_ptr, - "load_at_index_ptr", + field_layouts, + opt_struct_type, + index, + value, ); // A recursive pointer in the loaded structure is stored as a `i64*`, but the loaded layout // might want a more precise structure. As such, cast it to the refined type if needed. - cast_if_necessary_for_opaque_recursive_pointers(env.builder, result, target_loaded_type) + let from_value: BasicValueEnum = result.into(); + let to_type: BasicTypeEnum = target_loaded_type; + cast_if_necessary_for_opaque_recursive_pointers(env.builder, from_value, to_type) + .into_pointer_value() } pub fn reserve_with_refcount<'a, 'ctx>( @@ -3071,7 +3213,7 @@ pub fn cast_if_necessary_for_opaque_recursive_pointers<'ctx>( to_type: BasicTypeEnum<'ctx>, ) -> BasicValueEnum<'ctx> { if from_value.get_type() != to_type - // Only perform the cast if the target types are transumatble. + // Only perform the cast if the target types are transmutable. && equivalent_type_constructors(&from_value.get_type(), &to_type) { complex_bitcast( diff --git a/crates/compiler/gen_llvm/src/llvm/compare.rs b/crates/compiler/gen_llvm/src/llvm/compare.rs index 3f0cb0b4764..02dcbea26bf 100644 --- a/crates/compiler/gen_llvm/src/llvm/compare.rs +++ b/crates/compiler/gen_llvm/src/llvm/compare.rs @@ -144,14 +144,8 @@ fn build_eq<'a, 'ctx>( lhs_val: BasicValueEnum<'ctx>, rhs_val: BasicValueEnum<'ctx>, lhs_layout: LayoutRepr<'a>, - rhs_layout: LayoutRepr<'a>, + _rhs_layout: LayoutRepr<'a>, ) -> BasicValueEnum<'ctx> { - debug_assert_eq!( - lhs_layout, rhs_layout, - "Equality of different layouts; did you have a type mismatch?\n{:?} == {:?}", - lhs_layout, rhs_layout - ); - match lhs_layout { LayoutRepr::Builtin(builtin) => build_eq_builtin( env, @@ -185,7 +179,7 @@ fn build_eq<'a, 'ctx>( rhs_val, ), - LayoutRepr::Boxed(inner_layout) => build_box_eq( + LayoutRepr::Ptr(inner_layout) | LayoutRepr::Boxed(inner_layout) => build_box_eq( env, layout_interner, layout_ids, @@ -385,7 +379,7 @@ fn build_neq<'a, 'ctx>( result.into() } - LayoutRepr::Boxed(inner_layout) => { + LayoutRepr::Ptr(inner_layout) | LayoutRepr::Boxed(inner_layout) => { let is_equal = build_box_eq( env, layout_interner, diff --git a/crates/compiler/gen_llvm/src/llvm/convert.rs b/crates/compiler/gen_llvm/src/llvm/convert.rs index 4cec102a7c1..65b9a1a1c95 100644 --- a/crates/compiler/gen_llvm/src/llvm/convert.rs +++ b/crates/compiler/gen_llvm/src/llvm/convert.rs @@ -30,7 +30,8 @@ pub fn basic_type_from_layout<'a, 'ctx, 'env>( layout_interner, layout_interner.get_repr(lambda_set.runtime_representation()), ), - Boxed(inner_layout) => { + + Ptr(inner_layout) | Boxed(inner_layout) => { let inner_type = basic_type_from_layout( env, layout_interner, @@ -40,6 +41,7 @@ pub fn basic_type_from_layout<'a, 'ctx, 'env>( inner_type.ptr_type(AddressSpace::default()).into() } Union(union_layout) => basic_type_from_union_layout(env, layout_interner, &union_layout), + RecursivePointer(_) => env .context .i64_type() diff --git a/crates/compiler/gen_llvm/src/llvm/expect.rs b/crates/compiler/gen_llvm/src/llvm/expect.rs index 92057f21a19..3bf0fa3960e 100644 --- a/crates/compiler/gen_llvm/src/llvm/expect.rs +++ b/crates/compiler/gen_llvm/src/llvm/expect.rs @@ -390,6 +390,10 @@ fn build_clone<'a, 'ctx>( ) } + LayoutRepr::Ptr(_) => { + unreachable!("for internal use only") + } + LayoutRepr::RecursivePointer(rec_layout) => { let layout = rec_layout; diff --git a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs index ba2a60b81f4..63a9a15e740 100644 --- a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs +++ b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs @@ -1,4 +1,6 @@ use inkwell::{ + attributes::{Attribute, AttributeLoc}, + module::Linkage, types::{BasicType, IntType}, values::{ BasicValue, BasicValueEnum, FloatValue, FunctionValue, InstructionOpcode, IntValue, @@ -28,8 +30,8 @@ use crate::llvm::{ }, build::{ cast_basic_basic, complex_bitcast_check_size, create_entry_block_alloca, - function_value_by_func_spec, load_roc_value, roc_function_call, tag_pointer_clear_tag_id, - BuilderExt, RocReturn, + entry_block_alloca_zerofill, function_value_by_func_spec, load_roc_value, + roc_function_call, tag_pointer_clear_tag_id, BuilderExt, RocReturn, }, build_list::{ list_append_unsafe, list_concat, list_drop_at, list_get_unsafe, list_len, list_map, @@ -56,7 +58,7 @@ use crate::llvm::{ use super::{build::Env, convert::zig_dec_type}; use super::{ - build::{throw_internal_exception, use_roc_value}, + build::{throw_internal_exception, use_roc_value, FAST_CALL_CONV}, convert::zig_with_overflow_roc_dec, scope::Scope, }; @@ -1304,8 +1306,36 @@ pub(crate) fn run_low_level<'a, 'ctx>( .into() } - PtrWrite | RefCountIncRcPtr | RefCountDecRcPtr | RefCountIncDataPtr - | RefCountDecDataPtr => { + PtrStore => { + arguments!(ptr, value); + + env.builder.build_store(ptr.into_pointer_value(), value); + + // ptr + env.context.struct_type(&[], false).const_zero().into() + } + + PtrLoad => { + arguments!(ptr); + + let ret_repr = layout_interner.get_repr(layout); + let element_type = basic_type_from_layout(env, layout_interner, ret_repr); + + env.builder + .new_build_load(element_type, ptr.into_pointer_value(), "ptr_load") + } + + Alloca => { + arguments!(initial_value); + + let ptr = entry_block_alloca_zerofill(env, initial_value.get_type(), "stack_value"); + + env.builder.build_store(ptr, initial_value); + + ptr.into() + } + + RefCountIncRcPtr | RefCountDecRcPtr | RefCountIncDataPtr | RefCountDecDataPtr => { unreachable!("Not used in LLVM backend: {:?}", op); } @@ -1788,7 +1818,7 @@ fn throw_on_overflow<'ctx>( bd.position_at_end(throw_block); - throw_internal_exception(env, parent, message); + throw_because_overflow(env, message); bd.position_at_end(then_block); @@ -1796,6 +1826,60 @@ fn throw_on_overflow<'ctx>( .unwrap() } +fn throw_because_overflow<'ctx>(env: &Env<'_, 'ctx, '_>, message: &str) { + let block = env.builder.get_insert_block().expect("to be in a function"); + let di_location = env.builder.get_current_debug_location().unwrap(); + + let function_name = "throw_on_overflow"; + let function = match env.module.get_function(function_name) { + Some(function_value) => function_value, + None => { + let function_type = env.context.void_type().fn_type(&[], false); + let function_value = + env.module + .add_function(function_name, function_type, Some(Linkage::Internal)); + + function_value.set_call_conventions(FAST_CALL_CONV); + + // prevent inlining of this function + let kind_id = Attribute::get_named_enum_kind_id("noinline"); + debug_assert!(kind_id > 0); + let enum_attr = env.context.create_enum_attribute(kind_id, 1); + function_value.add_attribute(AttributeLoc::Function, enum_attr); + + // calling this function is unlikely + let kind_id = Attribute::get_named_enum_kind_id("cold"); + debug_assert!(kind_id > 0); + let enum_attr = env.context.create_enum_attribute(kind_id, 1); + function_value.add_attribute(AttributeLoc::Function, enum_attr); + + // this function never returns + let kind_id = Attribute::get_named_enum_kind_id("noreturn"); + debug_assert!(kind_id > 0); + let enum_attr = env.context.create_enum_attribute(kind_id, 1); + function_value.add_attribute(AttributeLoc::Function, enum_attr); + + // Add a basic block for the entry point + let entry = env.context.append_basic_block(function_value, "entry"); + + env.builder.position_at_end(entry); + + // ends in unreachable, so no return is needed + throw_internal_exception(env, function_value, message); + + function_value + } + }; + + env.builder.position_at_end(block); + env.builder.set_current_debug_location(di_location); + + let call = env.builder.build_call(function, &[], "overflow"); + call.set_call_convention(FAST_CALL_CONV); + + env.builder.build_unreachable(); +} + fn dec_split_into_words<'ctx>( env: &Env<'_, 'ctx, '_>, value: IntValue<'ctx>, diff --git a/crates/compiler/gen_llvm/src/llvm/refcounting.rs b/crates/compiler/gen_llvm/src/llvm/refcounting.rs index 5235bcf872b..06f9e73bf1e 100644 --- a/crates/compiler/gen_llvm/src/llvm/refcounting.rs +++ b/crates/compiler/gen_llvm/src/llvm/refcounting.rs @@ -537,6 +537,12 @@ fn modify_refcount_layout_build_function<'a, 'ctx>( Some(function) } + Ptr(_inner) => { + debug_assert_eq!(true, false); + + None + } + Union(variant) => { use UnionLayout::*; diff --git a/crates/compiler/gen_wasm/src/backend.rs b/crates/compiler/gen_wasm/src/backend.rs index 0476c9d19a4..b333a73999e 100644 --- a/crates/compiler/gen_wasm/src/backend.rs +++ b/crates/compiler/gen_wasm/src/backend.rs @@ -1079,6 +1079,20 @@ impl<'a, 'r> WasmBackend<'a, 'r> { index, } => self.expr_union_at_index(*structure, *tag_id, union_layout, *index, sym), + Expr::UnionFieldPtrAtIndex { + structure, + tag_id, + union_layout, + index, + } => self.expr_union_field_ptr_at_index( + *structure, + *tag_id, + union_layout, + *index, + sym, + storage, + ), + Expr::ExprBox { symbol: arg_sym } => self.expr_box(sym, *arg_sym, layout, storage), Expr::ExprUnbox { symbol: arg_sym } => self.expr_unbox(sym, *arg_sym), @@ -1871,11 +1885,92 @@ impl<'a, 'r> WasmBackend<'a, 'r> { ); } + fn expr_union_field_ptr_at_index( + &mut self, + structure: Symbol, + tag_id: TagIdIntType, + union_layout: &UnionLayout<'a>, + index: u64, + symbol: Symbol, + storage: &StoredValue, + ) { + use UnionLayout::*; + + debug_assert!(!union_layout.tag_is_null(tag_id)); + + let tag_index = tag_id as usize; + let field_layouts = match union_layout { + NonRecursive(tags) => tags[tag_index], + Recursive(tags) => tags[tag_index], + NonNullableUnwrapped(layouts) => *layouts, + NullableWrapped { + other_tags, + nullable_id, + } => { + let index = if tag_index > *nullable_id as usize { + tag_index - 1 + } else { + tag_index + }; + other_tags[index] + } + NullableUnwrapped { other_fields, .. } => *other_fields, + }; + + let field_offset: u32 = field_layouts + .iter() + .take(index as usize) + .map(|field_layout| self.layout_interner.stack_size(*field_layout)) + .sum(); + + // Get pointer and offset to the tag's data + let structure_storage = self.storage.get(&structure).to_owned(); + let stored_with_local = self.storage.ensure_value_has_local( + &mut self.code_builder, + structure, + structure_storage, + ); + let (tag_local_id, tag_offset) = match stored_with_local { + StoredValue::StackMemory { location, .. } => { + location.local_and_offset(self.storage.stack_frame_pointer) + } + StoredValue::Local { local_id, .. } => (local_id, 0), + StoredValue::VirtualMachineStack { .. } => { + internal_error!("{:?} should have a local variable", structure) + } + }; + + let stores_tag_id_in_pointer = union_layout.stores_tag_id_in_pointer(TARGET_INFO); + + let from_offset = tag_offset + field_offset; + + self.code_builder.get_local(tag_local_id); + + if stores_tag_id_in_pointer { + self.code_builder.i32_const(-4); // 11111111...1100 + self.code_builder.i32_and(); + } + + self.code_builder.i32_const(from_offset as _); + self.code_builder.i32_add(); + + let symbol_local = match self.storage.ensure_value_has_local( + &mut self.code_builder, + symbol, + storage.clone(), + ) { + StoredValue::Local { local_id, .. } => local_id, + _ => internal_error!("A heap pointer will always be an i32"), + }; + + self.code_builder.set_local(symbol_local); + } + /******************************************************************* * Box *******************************************************************/ - fn expr_box( + pub fn expr_box( &mut self, ret_sym: Symbol, arg_sym: Symbol, @@ -1908,7 +2003,7 @@ impl<'a, 'r> WasmBackend<'a, 'r> { .copy_value_to_memory(&mut self.code_builder, ptr_local_id, 0, arg_sym); } - fn expr_unbox(&mut self, ret_sym: Symbol, arg_sym: Symbol) { + pub(crate) fn expr_unbox(&mut self, ret_sym: Symbol, arg_sym: Symbol) { let (from_addr_val, from_offset) = match self.storage.get(&arg_sym) { StoredValue::VirtualMachineStack { .. } => { self.storage diff --git a/crates/compiler/gen_wasm/src/layout.rs b/crates/compiler/gen_wasm/src/layout.rs index 93e3b202b61..853d951e0d6 100644 --- a/crates/compiler/gen_wasm/src/layout.rs +++ b/crates/compiler/gen_wasm/src/layout.rs @@ -98,6 +98,7 @@ impl WasmLayout { | NullableUnwrapped { .. }, ) | LayoutRepr::Boxed(_) + | LayoutRepr::Ptr(_) | LayoutRepr::RecursivePointer(_) => Self::Primitive(PTR_TYPE, PTR_SIZE), } } diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index d7dd1f3a322..f87807a6da6 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -1960,7 +1960,61 @@ impl<'a> LowLevelCall<'a> { backend.storage.load_symbols(code_builder, self.arguments); } - PtrWrite => todo!("{:?}", self.lowlevel), + PtrStore => { + // PtrStore : Ptr a, a -> {} + let ptr = self.arguments[0]; + let value = self.arguments[1]; + + let (ptr_local_id, offset) = match backend.storage.get(&ptr) { + StoredValue::Local { local_id, .. } => (*local_id, 0), + _ => internal_error!("A pointer will always be an i32"), + }; + + // copy the argument to the pointer address + backend.storage.copy_value_to_memory( + &mut backend.code_builder, + ptr_local_id, + offset, + value, + ); + } + PtrLoad => backend.expr_unbox(self.ret_symbol, self.arguments[0]), + Alloca => { + // Alloca : a -> Ptr a + let arg = self.arguments[0]; + let arg_layout = backend.storage.symbol_layouts.get(&arg).unwrap(); + + let (size, alignment_bytes) = backend + .layout_interner + .stack_size_and_alignment(*arg_layout); + + let (frame_ptr, offset) = backend + .storage + .allocate_anonymous_stack_memory(size, alignment_bytes); + + // write the default value into the stack memory + backend.storage.copy_value_to_memory( + &mut backend.code_builder, + frame_ptr, + offset, + arg, + ); + + // create a local variable for the pointer + let ptr_local_id = match backend.storage.ensure_value_has_local( + &mut backend.code_builder, + self.ret_symbol, + self.ret_storage.clone(), + ) { + StoredValue::Local { local_id, .. } => local_id, + _ => internal_error!("A pointer will always be an i32"), + }; + + backend.code_builder.get_local(frame_ptr); + backend.code_builder.i32_const(offset as i32); + backend.code_builder.i32_add(); + backend.code_builder.set_local(ptr_local_id); + } Hash => todo!("{:?}", self.lowlevel), @@ -2030,7 +2084,8 @@ impl<'a> LowLevelCall<'a> { | LayoutRepr::Struct { .. } | LayoutRepr::Union(_) | LayoutRepr::LambdaSet(_) - | LayoutRepr::Boxed(_) => { + | LayoutRepr::Boxed(_) + | LayoutRepr::Ptr(_) => { // Don't want Zig calling convention here, we're calling internal Roc functions backend .storage diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs index 532802d9d91..9821a6c8831 100644 --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -20,7 +20,8 @@ use roc_debug_flags::dbg_do; #[cfg(debug_assertions)] use roc_debug_flags::{ ROC_CHECK_MONO_IR, ROC_PRINT_IR_AFTER_DROP_SPECIALIZATION, ROC_PRINT_IR_AFTER_REFCOUNT, - ROC_PRINT_IR_AFTER_RESET_REUSE, ROC_PRINT_IR_AFTER_SPECIALIZATION, ROC_PRINT_LOAD_LOG, + ROC_PRINT_IR_AFTER_RESET_REUSE, ROC_PRINT_IR_AFTER_SPECIALIZATION, ROC_PRINT_IR_AFTER_TRMC, + ROC_PRINT_LOAD_LOG, }; use roc_derive::SharedDerivedModule; use roc_error_macros::internal_error; @@ -3104,6 +3105,16 @@ fn update<'a>( let ident_ids = state.constrained_ident_ids.get_mut(&module_id).unwrap(); + roc_mono::tail_recursion::apply_trmc( + arena, + &mut layout_interner, + module_id, + ident_ids, + &mut state.procedures, + ); + + debug_print_ir!(state, &layout_interner, ROC_PRINT_IR_AFTER_TRMC); + inc_dec::insert_inc_dec_operations( arena, &layout_interner, @@ -5832,7 +5843,7 @@ fn make_specializations<'a>( ); let external_specializations_requested = procs.externals_we_need.clone(); - let (procedures, restored_procs_base) = procs.get_specialized_procs_without_rc(&mut mono_env); + let (procedures, restored_procs_base) = procs.get_specialized_procs_without_rc(); // Turn `Bytes.Decode.IdentId(238)` into `Bytes.Decode.238`, we rely on this in mono tests mono_env.home.register_debug_idents(mono_env.ident_ids); diff --git a/crates/compiler/module/src/low_level.rs b/crates/compiler/module/src/low_level.rs index 32e8e162dc9..bbb30d075cd 100644 --- a/crates/compiler/module/src/low_level.rs +++ b/crates/compiler/module/src/low_level.rs @@ -118,7 +118,9 @@ pub enum LowLevel { Not, Hash, PtrCast, - PtrWrite, + PtrStore, + PtrLoad, + Alloca, RefCountIncRcPtr, RefCountDecRcPtr, RefCountIncDataPtr, @@ -228,7 +230,9 @@ macro_rules! map_symbol_to_lowlevel { // these are used internally and not tied to a symbol LowLevel::Hash => unimplemented!(), LowLevel::PtrCast => unimplemented!(), - LowLevel::PtrWrite => unimplemented!(), + LowLevel::PtrStore => unimplemented!(), + LowLevel::PtrLoad => unimplemented!(), + LowLevel::Alloca => unimplemented!(), LowLevel::RefCountIncRcPtr => unimplemented!(), LowLevel::RefCountDecRcPtr=> unimplemented!(), LowLevel::RefCountIncDataPtr => unimplemented!(), diff --git a/crates/compiler/mono/Cargo.toml b/crates/compiler/mono/Cargo.toml index 44887a5b8f6..2fd6db34d93 100644 --- a/crates/compiler/mono/Cargo.toml +++ b/crates/compiler/mono/Cargo.toml @@ -27,6 +27,7 @@ roc_types = { path = "../types" } ven_pretty = { path = "../../vendor/pretty" } bitvec.workspace = true +arrayvec.workspace = true bumpalo.workspace = true hashbrown.workspace = true parking_lot.workspace = true diff --git a/crates/compiler/mono/src/borrow.rs b/crates/compiler/mono/src/borrow.rs index b5e4dddfaab..bd03651ecc2 100644 --- a/crates/compiler/mono/src/borrow.rs +++ b/crates/compiler/mono/src/borrow.rs @@ -741,6 +741,14 @@ impl<'a> BorrowInfState<'a> { self.if_is_owned_then_own(z, *x); } + UnionFieldPtrAtIndex { structure: x, .. } => { + // if the structure (record/tag/array) is owned, the extracted value is + self.if_is_owned_then_own(*x, z); + + // if the extracted value is owned, the structure must be too + self.if_is_owned_then_own(z, *x); + } + GetTagId { structure: x, .. } => { // if the structure (record/tag/array) is owned, the extracted value is self.if_is_owned_then_own(*x, z); @@ -1035,8 +1043,12 @@ pub fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] { unreachable!("These lowlevel operations are turned into mono Expr's") } - PtrCast | PtrWrite | RefCountIncRcPtr | RefCountDecRcPtr | RefCountIncDataPtr - | RefCountDecDataPtr | RefCountIsUnique => { + PtrStore => arena.alloc_slice_copy(&[owned, owned]), + PtrLoad => arena.alloc_slice_copy(&[owned]), + Alloca => arena.alloc_slice_copy(&[owned]), + + PtrCast | RefCountIncRcPtr | RefCountDecRcPtr | RefCountIncDataPtr | RefCountDecDataPtr + | RefCountIsUnique => { unreachable!("Only inserted *after* borrow checking: {:?}", op); } } diff --git a/crates/compiler/mono/src/code_gen_help/equality.rs b/crates/compiler/mono/src/code_gen_help/equality.rs index d0e3b813af1..6c212d4c3d1 100644 --- a/crates/compiler/mono/src/code_gen_help/equality.rs +++ b/crates/compiler/mono/src/code_gen_help/equality.rs @@ -38,6 +38,7 @@ pub fn eq_generic<'a>( Struct(field_layouts) => eq_struct(root, ident_ids, ctx, layout_interner, field_layouts), Union(union_layout) => eq_tag_union(root, ident_ids, ctx, layout_interner, union_layout), Boxed(inner_layout) => eq_boxed(root, ident_ids, ctx, layout_interner, inner_layout), + Ptr(inner_layout) => eq_boxed(root, ident_ids, ctx, layout_interner, inner_layout), LambdaSet(_) => unreachable!("`==` is not defined on functions"), RecursivePointer(_) => { unreachable!( diff --git a/crates/compiler/mono/src/code_gen_help/mod.rs b/crates/compiler/mono/src/code_gen_help/mod.rs index 9f51d264942..a79293294fa 100644 --- a/crates/compiler/mono/src/code_gen_help/mod.rs +++ b/crates/compiler/mono/src/code_gen_help/mod.rs @@ -577,6 +577,11 @@ impl<'a> CodeGenHelp<'a> { LayoutRepr::Boxed(inner) } + LayoutRepr::Ptr(inner) => { + let inner = self.replace_rec_ptr(ctx, layout_interner, inner); + LayoutRepr::Ptr(inner) + } + LayoutRepr::LambdaSet(lambda_set) => { return self.replace_rec_ptr(ctx, layout_interner, lambda_set.representation) } @@ -721,7 +726,7 @@ impl<'a> CallerProc<'a> { let ptr_write = Expr::Call(Call { call_type: CallType::LowLevel { - op: LowLevel::PtrWrite, + op: LowLevel::PtrStore, update_mode: UpdateModeId::BACKEND_DUMMY, }, arguments: arena.alloc([Symbol::ARG_3, call_result]), @@ -844,5 +849,6 @@ fn layout_needs_helper_proc<'a>( LayoutRepr::LambdaSet(_) => true, LayoutRepr::RecursivePointer(_) => false, LayoutRepr::Boxed(_) => true, + LayoutRepr::Ptr(_) => false, } } diff --git a/crates/compiler/mono/src/code_gen_help/refcount.rs b/crates/compiler/mono/src/code_gen_help/refcount.rs index 8ebaba87140..4174698e097 100644 --- a/crates/compiler/mono/src/code_gen_help/refcount.rs +++ b/crates/compiler/mono/src/code_gen_help/refcount.rs @@ -239,6 +239,9 @@ pub fn refcount_generic<'a>( inner_layout, structure, ), + LayoutRepr::Ptr(_) => { + unreachable!("We should never call a refcounting helper on a Ptr layout directly") + } } } diff --git a/crates/compiler/mono/src/debug/checker.rs b/crates/compiler/mono/src/debug/checker.rs index 93621212628..1012fa0842c 100644 --- a/crates/compiler/mono/src/debug/checker.rs +++ b/crates/compiler/mono/src/debug/checker.rs @@ -429,6 +429,14 @@ impl<'a, 'r> Ctx<'a, 'r> { } => self.with_sym_layout(structure, |ctx, _def_line, layout| { ctx.check_union_at_index(structure, layout, union_layout, tag_id, index) }), + &Expr::UnionFieldPtrAtIndex { + structure, + tag_id, + union_layout, + index, + } => self.with_sym_layout(structure, |ctx, _def_line, layout| { + ctx.check_union_field_ptr_at_index(structure, layout, union_layout, tag_id, index) + }), Expr::Array { elem_layout, elems } => { for elem in elems.iter() { match elem { @@ -566,6 +574,58 @@ impl<'a, 'r> Ctx<'a, 'r> { }) } + fn check_union_field_ptr_at_index( + &mut self, + structure: Symbol, + interned_union_layout: InLayout<'a>, + union_layout: UnionLayout<'a>, + tag_id: u16, + index: u64, + ) -> Option> { + let union = self + .interner + .insert_direct_no_semantic(LayoutRepr::Union(union_layout)); + + let field_ptr_layout = match get_tag_id_payloads(union_layout, tag_id) { + TagPayloads::IdNotInUnion => None, + TagPayloads::Payloads(payloads) => payloads.get(index as usize).map(|field_layout| { + self.interner + .insert_direct_no_semantic(LayoutRepr::Ptr(*field_layout)) + }), + }; + + self.with_sym_layout(structure, |ctx, def_line, _layout| { + ctx.check_sym_layout(structure, union, UseKind::TagExpr); + + match get_tag_id_payloads(union_layout, tag_id) { + TagPayloads::IdNotInUnion => { + ctx.problem(ProblemKind::IndexingTagIdNotInUnion { + structure, + def_line, + tag_id, + union_layout: interned_union_layout, + }); + None + } + TagPayloads::Payloads(payloads) => { + if field_ptr_layout.is_none() { + ctx.problem(ProblemKind::TagUnionStructIndexOOB { + structure, + def_line, + tag_id, + index, + size: payloads.len(), + }); + + None + } else { + field_ptr_layout + } + } + } + }) + } + fn check_call(&mut self, call: &Call<'a>) -> Option> { let Call { call_type, diff --git a/crates/compiler/mono/src/drop_specialization.rs b/crates/compiler/mono/src/drop_specialization.rs index 82a4978bd50..6639440583c 100644 --- a/crates/compiler/mono/src/drop_specialization.rs +++ b/crates/compiler/mono/src/drop_specialization.rs @@ -211,7 +211,18 @@ fn specialize_drops_stmt<'a, 'i>( // TODO perhaps we need the union_layout later as well? if so, create a new function/map to store it. environment.add_union_child(*structure, *binding, *tag_id, *index); // Generated code might know the tag of the union without switching on it. - // So if we unionAtIndex, we must know the tag and we can use it to specialize the drop. + // So if we UnionAtIndex, we must know the tag and we can use it to specialize the drop. + environment.symbol_tag.insert(*structure, *tag_id); + alloc_let_with_continuation!(environment) + } + Expr::UnionFieldPtrAtIndex { + structure, + tag_id, + union_layout: _, + index: _, + } => { + // Generated code might know the tag of the union without switching on it. + // So if we UnionFieldPtrAtIndex, we must know the tag and we can use it to specialize the drop. environment.symbol_tag.insert(*structure, *tag_id); alloc_let_with_continuation!(environment) } @@ -1666,8 +1677,13 @@ fn low_level_no_rc(lowlevel: &LowLevel) -> RC { unreachable!("These lowlevel operations are turned into mono Expr's") } - PtrCast | PtrWrite | RefCountIncRcPtr | RefCountDecRcPtr | RefCountIncDataPtr - | RefCountDecDataPtr | RefCountIsUnique => { + // only inserted for internal purposes. RC should not touch it + PtrStore => RC::NoRc, + PtrLoad => RC::NoRc, + Alloca => RC::NoRc, + + PtrCast | RefCountIncRcPtr | RefCountDecRcPtr | RefCountIncDataPtr | RefCountDecDataPtr + | RefCountIsUnique => { unreachable!("Only inserted *after* borrow checking: {:?}", lowlevel); } } diff --git a/crates/compiler/mono/src/inc_dec.rs b/crates/compiler/mono/src/inc_dec.rs index fa6978fa1ee..960a45bf10e 100644 --- a/crates/compiler/mono/src/inc_dec.rs +++ b/crates/compiler/mono/src/inc_dec.rs @@ -10,6 +10,7 @@ use std::{collections::HashMap, hash::BuildHasherDefault}; use bumpalo::collections::{CollectIn, Vec}; use bumpalo::Bump; use roc_collections::{all::WyHash, MutMap, MutSet}; +use roc_error_macros::internal_error; use roc_module::low_level::LowLevel; use roc_module::{low_level::LowLevelWrapperType, symbol::Symbol}; @@ -271,9 +272,10 @@ impl<'v> RefcountEnvironment<'v> { */ fn consume_rc_symbol(&mut self, symbol: Symbol) -> Ownership { // Consume the symbol by setting it to borrowed (if it was owned before), and return the previous ownership. - self.symbols_ownership - .insert(symbol, Ownership::Borrowed) - .expect("Expected symbol to be in environment") + match self.symbols_ownership.insert(symbol, Ownership::Borrowed) { + Some(ownership) => ownership, + None => internal_error!("Expected symbol {symbol:?} to be in environment"), + } } /** @@ -344,17 +346,16 @@ impl<'v> RefcountEnvironment<'v> { // A groupby or something similar would be nice here. let mut symbol_usage = MutMap::default(); for symbol in symbols { - match { - self.symbols_rc_types - .get(&symbol) - .expect("Expected symbol to be in the map") - } { + match self.symbols_rc_types.get(&symbol) { // If the symbol is reference counted, we need to increment the usage count. - VarRcType::ReferenceCounted => { + Some(VarRcType::ReferenceCounted) => { *symbol_usage.entry(symbol).or_default() += 1; } // If the symbol is not reference counted, we don't need to do anything. - VarRcType::NotReferenceCounted => continue, + Some(VarRcType::NotReferenceCounted) => continue, + None => { + internal_error!("symbol {symbol:?} does not have an rc type") + } } } symbol_usage @@ -543,15 +544,16 @@ fn insert_refcount_operations_stmt<'v, 'a>( .iter() .filter(|(_, o)| o.is_owned()) { - let error = "All symbols defined in the current environment should be in the environment of the branches."; let consumed = branch_envs .iter() .any(|branch_env: &&RefcountEnvironment<'v>| { - matches!( - branch_env.get_symbol_ownership(symbol).expect(error), - Ownership::Borrowed - ) + match branch_env.get_symbol_ownership(symbol) { + None => internal_error!( + "symbol {symbol:?} in the current env should be in the branch's env" + ), + Some(ownership) => matches!(ownership, Ownership::Borrowed), + } }); if consumed { // If the symbol is currently owned, and not in a some branches, it must be consumed in all branches @@ -889,6 +891,7 @@ fn insert_refcount_operations_binding<'a>( Expr::GetTagId { structure, .. } | Expr::StructAtIndex { structure, .. } | Expr::UnionAtIndex { structure, .. } + | Expr::UnionFieldPtrAtIndex { structure, .. } | Expr::ExprUnbox { symbol: structure } => { // All structures are alive at this point and don't have to be copied in order to take an index out/get tag id/copy values to the stack. // But we do want to make sure to decrement this item if it is the last reference. @@ -902,6 +905,7 @@ fn insert_refcount_operations_binding<'a>( match expr { Expr::StructAtIndex { .. } | Expr::UnionAtIndex { .. } + | Expr::UnionFieldPtrAtIndex { .. } | Expr::ExprUnbox { .. } => insert_inc_stmt(arena, *binding, 1, new_stmt), // No usage of an element of a reference counted symbol. No need to increment. Expr::GetTagId { .. } => new_stmt, diff --git a/crates/compiler/mono/src/ir.rs b/crates/compiler/mono/src/ir.rs index bd9a0975b79..4e417b3cdaf 100644 --- a/crates/compiler/mono/src/ir.rs +++ b/crates/compiler/mono/src/ir.rs @@ -403,34 +403,6 @@ impl<'a> Proc<'a> { w.push(b'\n'); String::from_utf8(w).unwrap() } - - fn make_tail_recursive(&mut self, env: &mut Env<'a, '_>) { - let mut args = Vec::with_capacity_in(self.args.len(), env.arena); - let mut proc_args = Vec::with_capacity_in(self.args.len(), env.arena); - - for (layout, symbol) in self.args { - let new = env.unique_symbol(); - args.push((*layout, *symbol, new)); - proc_args.push((*layout, new)); - } - - use self::SelfRecursive::*; - if let SelfRecursive(id) = self.is_self_recursive { - let transformed = crate::tail_recursion::make_tail_recursive( - env.arena, - id, - self.name, - self.body.clone(), - args.into_bump_slice(), - self.ret_layout, - ); - - if let Some(with_tco) = transformed { - self.body = with_tco; - self.args = proc_args.into_bump_slice(); - } - } - } } /// A host-exposed function must be specialized; it's a seed for subsequent specializations @@ -1018,14 +990,11 @@ impl<'a> Procs<'a> { pub fn get_specialized_procs_without_rc( self, - env: &mut Env<'a, '_>, ) -> (MutMap<(Symbol, ProcLayout<'a>), Proc<'a>>, ProcsBase<'a>) { let mut specialized_procs = MutMap::with_capacity_and_hasher(self.specialized.len(), default_hasher()); - for (symbol, layout, mut proc) in self.specialized.into_iter_assert_done() { - proc.make_tail_recursive(env); - + for (symbol, layout, proc) in self.specialized.into_iter_assert_done() { let key = (symbol, layout); specialized_procs.insert(key, proc); } @@ -1396,6 +1365,11 @@ impl<'a, 'i> Env<'a, 'i> { Symbol::new(self.home, ident_id) } + pub fn named_unique_symbol(&mut self, name: &str) -> Symbol { + let ident_id = self.ident_ids.add_str(name); + Symbol::new(self.home, ident_id) + } + pub fn next_update_mode_id(&mut self) -> UpdateModeId { self.update_mode_ids.next_id() } @@ -1875,6 +1849,12 @@ pub enum Expr<'a> { union_layout: UnionLayout<'a>, index: u64, }, + UnionFieldPtrAtIndex { + structure: Symbol, + tag_id: TagIdIntType, + union_layout: UnionLayout<'a>, + index: u64, + }, Array { elem_layout: InLayout<'a>, @@ -2092,6 +2072,19 @@ impl<'a> Expr<'a> { .. } => text!(alloc, "UnionAtIndex (Id {}) (Index {}) ", tag_id, index) .append(symbol_to_doc(alloc, *structure, pretty)), + + UnionFieldPtrAtIndex { + tag_id, + structure, + index, + .. + } => text!( + alloc, + "UnionFieldPtrAtIndex (Id {}) (Index {}) ", + tag_id, + index + ) + .append(symbol_to_doc(alloc, *structure, pretty)), } } @@ -7665,6 +7658,22 @@ fn substitute_in_expr<'a>( }), None => None, }, + + // currently only used for tail recursion modulo cons (TRMC) + UnionFieldPtrAtIndex { + structure, + tag_id, + index, + union_layout, + } => match substitute(subs, *structure) { + Some(structure) => Some(UnionFieldPtrAtIndex { + structure, + tag_id: *tag_id, + index: *index, + union_layout: *union_layout, + }), + None => None, + }, } } @@ -9866,6 +9875,9 @@ where LayoutRepr::Boxed(boxed) => { stack.push(layout_interner.get(boxed)); } + LayoutRepr::Ptr(inner) => { + stack.push(layout_interner.get(inner)); + } LayoutRepr::Union(union_layout) => match union_layout { UnionLayout::NonRecursive(tags) => { for in_layout in tags.iter().flat_map(|e| e.iter()) { diff --git a/crates/compiler/mono/src/layout.rs b/crates/compiler/mono/src/layout.rs index 91cf9d02ba8..afa9abaa646 100644 --- a/crates/compiler/mono/src/layout.rs +++ b/crates/compiler/mono/src/layout.rs @@ -674,7 +674,11 @@ pub(crate) enum LayoutWrapper<'a> { pub enum LayoutRepr<'a> { Builtin(Builtin<'a>), Struct(&'a [InLayout<'a>]), + // A (heap allocated) reference-counted value Boxed(InLayout<'a>), + // A pointer (heap or stack) without any reference counting + // Ptr is not user-facing. The compiler author must make sure that invariants are upheld + Ptr(InLayout<'a>), Union(UnionLayout<'a>), LambdaSet(LambdaSet<'a>), RecursivePointer(InLayout<'a>), @@ -1106,6 +1110,18 @@ impl<'a> UnionLayout<'a> { | UnionLayout::NullableUnwrapped { .. } => interner.target_info().ptr_width() as u32, } } + + pub fn is_recursive(&self) -> bool { + use UnionLayout::*; + + match self { + NonRecursive(_) => false, + Recursive(_) + | NonNullableUnwrapped(_) + | NullableWrapped { .. } + | NullableUnwrapped { .. } => true, + } + } } pub enum Discriminant { @@ -2555,7 +2571,7 @@ impl<'a> LayoutRepr<'a> { LambdaSet(lambda_set) => interner .get_repr(lambda_set.runtime_representation()) .safe_to_memcpy(interner), - Boxed(_) | RecursivePointer(_) => { + Boxed(_) | Ptr(_) | RecursivePointer(_) => { // We cannot memcpy pointers, because then we would have the same pointer in multiple places! false } @@ -2646,6 +2662,7 @@ impl<'a> LayoutRepr<'a> { .stack_size_without_alignment(interner), RecursivePointer(_) => interner.target_info().ptr_width() as u32, Boxed(_) => interner.target_info().ptr_width() as u32, + Ptr(_) => interner.target_info().ptr_width() as u32, } } @@ -2699,6 +2716,7 @@ impl<'a> LayoutRepr<'a> { Builtin(builtin) => builtin.alignment_bytes(interner.target_info()), RecursivePointer(_) => interner.target_info().ptr_width() as u32, Boxed(_) => interner.target_info().ptr_width() as u32, + Ptr(_) => interner.target_info().ptr_width() as u32, } } @@ -2723,6 +2741,7 @@ impl<'a> LayoutRepr<'a> { ptr_width, interner.get_repr(*inner).alignment_bytes(interner), ), + Ptr(inner) => interner.get_repr(*inner).alignment_bytes(interner), } } @@ -2743,6 +2762,22 @@ impl<'a> LayoutRepr<'a> { } } + pub fn is_nullable(&self) -> bool { + use LayoutRepr::*; + + match self { + Union(union_layout) => match union_layout { + UnionLayout::NonRecursive(_) => false, + UnionLayout::Recursive(_) => false, + UnionLayout::NonNullableUnwrapped(_) => false, + UnionLayout::NullableWrapped { .. } => true, + UnionLayout::NullableUnwrapped { .. } => true, + }, + + _ => false, + } + } + /// Even if a value (say, a record) is not itself reference counted, /// it may contains values/fields that are. Therefore when this record /// goes out of scope, the refcount on those values/fields must be decremented. @@ -2776,6 +2811,11 @@ impl<'a> LayoutRepr<'a> { .contains_refcounted(interner), RecursivePointer(_) => true, Boxed(_) => true, + Ptr(_) => { + // we never consider pointers for refcounting. Ptr is not user-facing. The compiler + // author must make sure that invariants are upheld + false + } } } @@ -2831,7 +2871,7 @@ impl<'a> LayoutRepr<'a> { } }, LambdaSet(_) => return true, - Boxed(_) => { + Boxed(_) | Ptr(_) => { // If there's any layer of indirection (behind a pointer), then it doesn't vary! } RecursivePointer(_) => { diff --git a/crates/compiler/mono/src/layout/intern.rs b/crates/compiler/mono/src/layout/intern.rs index eb182b0b86a..024f32b63b4 100644 --- a/crates/compiler/mono/src/layout/intern.rs +++ b/crates/compiler/mono/src/layout/intern.rs @@ -230,6 +230,10 @@ pub trait LayoutInterner<'a>: Sized { self.get_repr(layout).is_refcounted() } + fn is_nullable(&self, layout: InLayout<'a>) -> bool { + self.get_repr(layout).is_nullable() + } + fn is_passed_by_reference(&self, layout: InLayout<'a>) -> bool { self.get_repr(layout).is_passed_by_reference(self) } @@ -350,6 +354,10 @@ pub trait LayoutInterner<'a>: Sized { .text("Boxed(") .append(self.to_doc(inner, alloc, seen_rec, parens)) .append(")"), + Ptr(inner) => alloc + .text("Ptr(") + .append(self.to_doc(inner, alloc, seen_rec, parens)) + .append(")"), } } @@ -1108,6 +1116,7 @@ mod reify { LayoutRepr::Struct(reify_layout_slice(arena, interner, slot, field_layouts)) } LayoutRepr::Boxed(lay) => LayoutRepr::Boxed(reify_layout(arena, interner, slot, lay)), + LayoutRepr::Ptr(lay) => LayoutRepr::Ptr(reify_layout(arena, interner, slot, lay)), LayoutRepr::Union(un) => LayoutRepr::Union(reify_union(arena, interner, slot, un)), LayoutRepr::LambdaSet(ls) => { LayoutRepr::LambdaSet(reify_lambda_set(arena, interner, slot, ls)) @@ -1312,6 +1321,7 @@ mod equiv { equiv_fields!(fl1, fl2) } (Boxed(b1), Boxed(b2)) => stack.push((b1, b2)), + (Ptr(b1), Ptr(b2)) => stack.push((b1, b2)), (Union(u1), Union(u2)) => { use UnionLayout::*; match (u1, u2) { @@ -1432,6 +1442,7 @@ pub mod dbg_deep { .field("fields", &DbgFields(self.0, field_layouts)) .finish(), LayoutRepr::Boxed(b) => f.debug_tuple("Boxed").field(&Dbg(self.0, *b)).finish(), + LayoutRepr::Ptr(b) => f.debug_tuple("Ptr").field(&Dbg(self.0, *b)).finish(), LayoutRepr::Union(un) => f .debug_tuple("Union") .field(&DbgUnion(self.0, *un)) @@ -1605,6 +1616,7 @@ pub mod dbg_stable { .field("fields", &DbgFields(self.0, field_layouts)) .finish(), LayoutRepr::Boxed(b) => f.debug_tuple("Boxed").field(&Dbg(self.0, *b)).finish(), + LayoutRepr::Ptr(b) => f.debug_tuple("Ptr").field(&Dbg(self.0, *b)).finish(), LayoutRepr::Union(un) => f .debug_tuple("Union") .field(&DbgUnion(self.0, *un)) diff --git a/crates/compiler/mono/src/tail_recursion.rs b/crates/compiler/mono/src/tail_recursion.rs index 383363d3a2b..46b0684ce2e 100644 --- a/crates/compiler/mono/src/tail_recursion.rs +++ b/crates/compiler/mono/src/tail_recursion.rs @@ -1,11 +1,91 @@ #![allow(clippy::manual_map)] use crate::borrow::Ownership; -use crate::ir::{CallType, Expr, JoinPointId, Param, Stmt}; -use crate::layout::{InLayout, LambdaName}; +use crate::ir::{ + Call, CallType, Expr, JoinPointId, Param, Proc, ProcLayout, SelfRecursive, Stmt, UpdateModeId, +}; +use crate::layout::{ + InLayout, LambdaName, Layout, LayoutInterner, LayoutRepr, STLayoutInterner, TagIdIntType, + UnionLayout, +}; use bumpalo::collections::Vec; use bumpalo::Bump; -use roc_module::symbol::Symbol; +use roc_collections::{MutMap, VecMap}; +use roc_module::low_level::LowLevel; +use roc_module::symbol::{IdentIds, ModuleId, Symbol}; + +pub struct Env<'a, 'i> { + arena: &'a Bump, + home: ModuleId, + interner: &'i mut STLayoutInterner<'a>, + ident_ids: &'i mut IdentIds, +} + +impl<'a, 'i> Env<'a, 'i> { + fn unique_symbol(&mut self) -> Symbol { + let ident_id = self.ident_ids.gen_unique(); + + Symbol::new(self.home, ident_id) + } + + fn named_unique_symbol(&mut self, name: &str) -> Symbol { + let ident_id = self.ident_ids.add_str(name); + Symbol::new(self.home, ident_id) + } +} + +pub fn apply_trmc<'a, 'i>( + arena: &'a Bump, + interner: &'i mut STLayoutInterner<'a>, + home: ModuleId, + ident_ids: &'i mut IdentIds, + procs: &mut MutMap<(Symbol, ProcLayout<'a>), Proc<'a>>, +) { + let mut env = Env { + arena, + interner, + home, + ident_ids, + }; + + let env = &mut env; + + for proc in procs.values_mut() { + use self::SelfRecursive::*; + if let SelfRecursive(id) = proc.is_self_recursive { + let trmc_candidate_symbols = trmc_candidates(env.interner, proc); + + if !trmc_candidate_symbols.is_empty() { + let new_proc = + crate::tail_recursion::TrmcEnv::init(env, proc, trmc_candidate_symbols); + *proc = new_proc; + } else { + let mut args = Vec::with_capacity_in(proc.args.len(), arena); + let mut proc_args = Vec::with_capacity_in(proc.args.len(), arena); + + for (layout, symbol) in proc.args { + let new = env.unique_symbol(); + args.push((*layout, *symbol, new)); + proc_args.push((*layout, new)); + } + + let transformed = crate::tail_recursion::make_tail_recursive( + arena, + id, + proc.name, + proc.body.clone(), + args.into_bump_slice(), + proc.ret_layout, + ); + + if let Some(with_tco) = transformed { + proc.body = with_tco; + proc.args = proc_args.into_bump_slice(); + } + } + } + } +} /// Make tail calls into loops (using join points) /// @@ -29,7 +109,8 @@ use roc_module::symbol::Symbol; /// /// This will effectively compile into a loop in llvm, and /// won't grow the call stack for each iteration -pub fn make_tail_recursive<'a>( + +fn make_tail_recursive<'a>( arena: &'a Bump, id: JoinPointId, needle: LambdaName, @@ -323,3 +404,727 @@ fn insert_jumps<'a>( Crash(..) => None, } } + +#[derive(Debug, Default)] +struct TrmcCandidateSet { + interner: arrayvec::ArrayVec, + confirmed: u64, + active: u64, + invalid: u64, +} + +impl TrmcCandidateSet { + fn confirmed(&self) -> impl Iterator + '_ { + self.interner + .iter() + .enumerate() + .filter_map(|(i, s)| (self.confirmed & (1 << i) != 0).then_some(*s)) + } + + fn active(&self) -> impl Iterator + '_ { + self.interner + .iter() + .enumerate() + .filter_map(|(i, s)| (self.active & (1 << i) != 0).then_some(*s)) + } + + fn position(&self, symbol: Symbol) -> Option { + self.interner.iter().position(|s| *s == symbol) + } + + fn insert(&mut self, symbol: Symbol) { + // there really is no way it could have been inserted already + debug_assert!(self.position(symbol).is_none()); + + let index = self.interner.len(); + self.interner.push(symbol); + + self.active |= 1 << index; + } + + fn retain(&mut self, keep: F) + where + F: Fn(&Symbol) -> bool, + { + for (i, s) in self.interner.iter().enumerate() { + if !keep(s) { + let mask = 1 << i; + + self.active &= !mask; + self.confirmed &= !mask; + + self.invalid |= mask; + } + } + } + + fn confirm(&mut self, symbol: Symbol) { + match self.position(symbol) { + None => debug_assert_eq!(0, 1, "confirm of invalid symbol"), + Some(index) => { + let mask = 1 << index; + + debug_assert_eq!(self.invalid & mask, 0); + debug_assert_ne!(self.active & mask, 0); + + self.active &= !mask; + self.confirmed |= mask; + } + } + } + + fn is_empty(&self) -> bool { + self.confirmed == 0 + } +} + +fn trmc_candidates<'a, I>(interner: &'_ I, proc: &'_ Proc<'a>) -> TrmcCandidateSet +where + I: LayoutInterner<'a>, +{ + // it must be a self-recursive function + if !matches!( + proc.is_self_recursive, + crate::ir::SelfRecursive::SelfRecursive(_) + ) { + return TrmcCandidateSet::default(); + } + + // and return a recursive tag union + if !matches!(interner.get_repr(proc.ret_layout), LayoutRepr::Union(union_layout) if union_layout.is_recursive()) + { + return TrmcCandidateSet::default(); + } + + let mut candidate_set = TrmcCandidateSet::default(); + trmc_candidates_help(proc.name, &proc.body, &mut candidate_set); + candidate_set +} + +fn trmc_candidates_help<'a>( + function_name: LambdaName, + stmt: &'_ Stmt<'a>, + candidates: &mut TrmcCandidateSet, +) { + // if this stmt is the literal tail tag application and return, then this is a TRMC opportunity + if let Some(cons_info) = TrmcEnv::is_terminal_constructor(stmt) { + // the tag application must directly use the result of the recursive call + let recursive_call = candidates + .active() + .find(|call| cons_info.arguments.contains(call)); + + // if we find a usage, this is a confirmed TRMC call + if let Some(recursive_call) = recursive_call { + candidates.confirm(recursive_call); + + return; + } + } + + // if the stmt uses the active recursive call, that invalidates the recursive call for this branch + candidates.retain(|recursive_call| !stmt_contains_symbol_nonrec(stmt, *recursive_call)); + + match stmt { + Stmt::Let(symbol, expr, _, next) => { + // find a new recursive call if we currently have none + // that means we generally pick the first recursive call we find + if TrmcEnv::is_recursive_expr(expr, function_name).is_some() { + candidates.insert(*symbol); + } + + trmc_candidates_help(function_name, next, candidates) + } + Stmt::Switch { + branches, + default_branch, + .. + } => { + let it = branches + .iter() + .map(|(_, _, stmt)| stmt) + .chain([default_branch.1]); + + for next in it { + trmc_candidates_help(function_name, next, candidates); + } + } + Stmt::Refcounting(_, next) => trmc_candidates_help(function_name, next, candidates), + Stmt::Expect { remainder, .. } + | Stmt::ExpectFx { remainder, .. } + | Stmt::Dbg { remainder, .. } => trmc_candidates_help(function_name, remainder, candidates), + Stmt::Join { + body, remainder, .. + } => { + trmc_candidates_help(function_name, body, candidates); + trmc_candidates_help(function_name, remainder, candidates); + } + Stmt::Ret(_) | Stmt::Jump(_, _) | Stmt::Crash(_, _) => { /* terminal */ } + } +} + +// TRMC (tail recursion modulo constructor) is an optimization for some recursive functions that return a recursive data type. The most basic example is a repeat function on linked lists: +// +// ```roc +// LinkedList a : [ Nil, Cons a (LinkedList a) ] +// +// repeat : a, Nat -> LinkedList a +// repeat = \element, n -> +// when n is +// 0 -> Nil +// _ -> Cons element (repeat element (n - 1)) +// ``` +// +// This function is recursive, but cannot use standard tail-call elimintation, because the recursive call is not in tail position (i.e. the last thing happening before a return). Rather the recursive call is an argument to a constructor of the recursive output type. This means that `repeat n` will creat `n` stack frames. For big inputs, a stack overflow is inevitable. +// +// But there is a trick: TRMC. Using TRMC and join points, we are able to convert this function into a loop, which uses only one stack frame for the whole process. +// +// ```pseudo-roc +// repeat : a, Nat -> LinkedList a +// repeat = \initialElement, initialN -> +// joinpoint trmc = \element, n, hole, head -> +// when n is +// 0 -> +// # write the value `Nil` into the hole +// *hole = Nil +// # dereference (load from) the pointer to the first element +// *head +// +// _ -> +// *hole = Cons element NULL +// newHole = &hole.Cons.1 +// jump trmc element (n - 1) newHole head +// in +// # creates a stack allocation, gives a pointer to that stack allocation +// initial : Ptr (LinkedList a) = #alloca NULL +// jump trmc initialElement initialN initial initial +// ``` +// +// The functionality here figures out whether this transformation can be applied in valid way, and then performs the transformation. + +#[derive(Clone)] +pub(crate) struct TrmcEnv<'a> { + lambda_name: LambdaName<'a>, + /// Current hole to fill + hole_symbol: Symbol, + /// Pointer to the first constructor ("the head of the list") + head_symbol: Symbol, + joinpoint_id: JoinPointId, + return_layout: InLayout<'a>, + ptr_return_layout: InLayout<'a>, + + trmc_calls: VecMap>>, +} + +#[derive(Debug)] +struct ConstructorInfo<'a> { + tag_layout: UnionLayout<'a>, + tag_id: TagIdIntType, + arguments: &'a [Symbol], +} + +impl<'a> TrmcEnv<'a> { + #[inline(always)] + fn is_terminal_constructor(stmt: &Stmt<'a>) -> Option> { + match stmt { + Stmt::Let(s1, expr, _layout, Stmt::Ret(s2)) if s1 == s2 => { + Self::get_contructor_info(expr) + } + + _ => None, + } + } + + fn get_contructor_info(expr: &Expr<'a>) -> Option> { + if let Expr::Tag { + tag_layout, + tag_id, + arguments, + } = expr + { + let info = ConstructorInfo { + tag_layout: *tag_layout, + tag_id: *tag_id, + arguments, + }; + + Some(info) + } else { + None + } + } + + fn is_recursive_expr(expr: &Expr<'a>, lambda_name: LambdaName<'_>) -> Option> { + if let Expr::Call(call) = expr { + Self::is_recursive_call(call, lambda_name).then_some(call.clone()) + } else { + None + } + } + + fn is_recursive_call(call: &Call<'a>, lambda_name: LambdaName<'_>) -> bool { + match call.call_type { + CallType::ByName { name, .. } => { + // because we do not allow polymorphic recursion, this is the only constraint + name == lambda_name + } + CallType::Foreign { .. } | CallType::LowLevel { .. } | CallType::HigherOrder(_) => { + false + } + } + } + + fn is_tail_recursive_call( + lambda_name: LambdaName, + symbol: Symbol, + expr: &Expr<'a>, + next: &Stmt<'a>, + ) -> Option> { + match next { + Stmt::Ret(s) if *s == symbol => Self::is_recursive_expr(expr, lambda_name), + _ => None, + } + } + + fn ptr_write( + env: &mut Env<'a, '_>, + ptr: Symbol, + value: Symbol, + next: &'a Stmt<'a>, + ) -> Stmt<'a> { + let ptr_write = Call { + call_type: crate::ir::CallType::LowLevel { + op: LowLevel::PtrStore, + update_mode: UpdateModeId::BACKEND_DUMMY, + }, + arguments: env.arena.alloc([ptr, value]), + }; + + Stmt::Let( + env.named_unique_symbol("_ptr_write_unit"), + Expr::Call(ptr_write), + Layout::UNIT, + next, + ) + } + + fn init<'i>(env: &mut Env<'a, 'i>, proc: &Proc<'a>, trmc_calls: TrmcCandidateSet) -> Proc<'a> { + let arena = env.arena; + let return_layout = proc.ret_layout; + + let mut joinpoint_parameters = Vec::with_capacity_in(proc.args.len() + 2, env.arena); + let mut new_proc_arguments = Vec::with_capacity_in(proc.args.len(), env.arena); + let mut jump_arguments = Vec::with_capacity_in(proc.args.len() + 2, env.arena); + + for (i, (layout, old_symbol)) in proc.args.iter().enumerate() { + let symbol = env.named_unique_symbol(&format!("arg_{i}")); + new_proc_arguments.push((*layout, symbol)); + jump_arguments.push(symbol); + + let param = Param { + symbol: *old_symbol, + ownership: Ownership::Owned, + layout: *layout, + }; + joinpoint_parameters.push(param); + } + + // the root of the recursive structure that we'll be building + let initial_ptr_symbol = env.named_unique_symbol("initial"); + jump_arguments.push(initial_ptr_symbol); + jump_arguments.push(initial_ptr_symbol); + + let null_symbol = env.named_unique_symbol("null"); + let let_null = |next| Stmt::Let(null_symbol, Expr::NullPointer, return_layout, next); + + let ptr_return_layout = env + .interner + .insert_direct_no_semantic(LayoutRepr::Ptr(return_layout)); + + let call = Call { + call_type: CallType::LowLevel { + op: LowLevel::Alloca, + update_mode: UpdateModeId::BACKEND_DUMMY, + }, + arguments: arena.alloc([null_symbol]), + }; + + let ptr_null = Expr::Call(call); + let let_ptr = |next| Stmt::Let(initial_ptr_symbol, ptr_null, ptr_return_layout, next); + + let joinpoint_id = JoinPointId(env.named_unique_symbol("trmc")); + let hole_symbol = env.named_unique_symbol("hole"); + let head_symbol = env.named_unique_symbol("head"); + + let jump_stmt = Stmt::Jump(joinpoint_id, jump_arguments.into_bump_slice()); + + let trmc_calls = trmc_calls.confirmed().map(|s| (s, None)).collect(); + + let mut this = Self { + lambda_name: proc.name, + hole_symbol, + head_symbol, + joinpoint_id, + return_layout, + ptr_return_layout, + trmc_calls, + }; + + let param = Param { + symbol: hole_symbol, + ownership: Ownership::Owned, + layout: ptr_return_layout, + }; + joinpoint_parameters.push(param); + + let param = Param { + symbol: head_symbol, + ownership: Ownership::Owned, + layout: ptr_return_layout, + }; + joinpoint_parameters.push(param); + + let joinpoint = Stmt::Join { + id: joinpoint_id, + parameters: joinpoint_parameters.into_bump_slice(), + body: arena.alloc(this.walk_stmt(env, &proc.body)), + remainder: arena.alloc(jump_stmt), + }; + + let body = let_null(arena.alloc( + // + let_ptr(arena.alloc( + // + joinpoint, + )), + )); + + #[cfg(debug_assertions)] + env.home.register_debug_idents(env.ident_ids); + + Proc { + name: proc.name, + args: new_proc_arguments.into_bump_slice(), + body, + closure_data_layout: proc.closure_data_layout, + ret_layout: proc.ret_layout, + is_self_recursive: SelfRecursive::NotSelfRecursive, + host_exposed_layouts: proc.host_exposed_layouts.clone(), + } + } + + fn walk_stmt(&mut self, env: &mut Env<'a, '_>, stmt: &Stmt<'a>) -> Stmt<'a> { + let arena = env.arena; + + match stmt { + Stmt::Let(symbol, expr, layout, next) => { + // if this is a TRMC call, remember what the call looks like, so we can turn it + // into a jump later. The call is then removed from the Stmt + if let Some(opt_call) = self.trmc_calls.get_mut(symbol) { + debug_assert!( + opt_call.is_none(), + "didn't expect to visit call again since symbols are unique" + ); + + let call = match expr { + Expr::Call(call) => call, + _ => unreachable!(), + }; + + *opt_call = Some(call.clone()); + + return self.walk_stmt(env, next); + } + + if let Some(call) = + Self::is_tail_recursive_call(self.lambda_name, *symbol, expr, next) + { + // turn the call into a jump. Just re-use the existing hole + let mut arguments = Vec::new_in(arena); + arguments.extend(call.arguments); + arguments.push(self.hole_symbol); + arguments.push(self.head_symbol); + + let jump = Stmt::Jump(self.joinpoint_id, arguments.into_bump_slice()); + + return jump; + } + + if let Some(cons_info) = Self::is_terminal_constructor(stmt) { + // figure out which TRMC call to use here. We pick the first one that works + let opt_recursive_call = cons_info.arguments.iter().find_map(|arg| { + self.trmc_calls + .get(arg) + .and_then(|x| x.as_ref()) + .map(|x| (arg, x)) + }); + + match opt_recursive_call { + None => { + // this control flow path did not encounter a recursive call. Just + // write the end result into the hole and we're done. + + let define_tag = |next| Stmt::Let(*symbol, expr.clone(), *layout, next); + + let output = define_tag(arena.alloc( + // + self.non_trmc_return(env, *symbol), + )); + + return output; + } + Some((call_symbol, call)) => { + // we did encounter a recursive call, and can perform TRMC in this + // branch. + + let opt_recursive_field_index = + cons_info.arguments.iter().position(|s| *s == *call_symbol); + + let recursive_field_index = match opt_recursive_field_index { + None => { + let next = self.walk_stmt(env, next); + return Stmt::Let( + *symbol, + expr.clone(), + *layout, + arena.alloc(next), + ); + } + Some(v) => v, + }; + + let tag_arg_null_symbol = env.named_unique_symbol("tag_arg_null"); + let let_tag_arg_null = |next| { + Stmt::Let( + tag_arg_null_symbol, + Expr::NullPointer, + self.return_layout, + next, + ) + }; + + let mut arguments = + Vec::from_iter_in(cons_info.arguments.iter().copied(), env.arena); + arguments[recursive_field_index] = tag_arg_null_symbol; + + let tag_expr = Expr::Tag { + tag_layout: cons_info.tag_layout, + tag_id: cons_info.tag_id, + arguments: arguments.into_bump_slice(), + }; + + let let_tag = |next| Stmt::Let(*symbol, tag_expr, *layout, next); + + let get_reference_expr = Expr::UnionFieldPtrAtIndex { + structure: *symbol, + tag_id: cons_info.tag_id, + union_layout: cons_info.tag_layout, + index: recursive_field_index as _, + }; + + let new_hole_symbol = env.named_unique_symbol("newHole"); + let let_new_hole = |next| { + Stmt::Let( + new_hole_symbol, + get_reference_expr, + self.ptr_return_layout, + next, + ) + }; + + let mut jump_arguments = + Vec::from_iter_in(call.arguments.iter().copied(), env.arena); + jump_arguments.push(new_hole_symbol); + jump_arguments.push(self.head_symbol); + + let jump = + Stmt::Jump(self.joinpoint_id, jump_arguments.into_bump_slice()); + + let output = let_tag_arg_null(arena.alloc( + // + let_tag(arena.alloc( + // + let_new_hole(arena.alloc( + // + Self::ptr_write( + env, + self.hole_symbol, + *symbol, + arena.alloc(jump), + ), + )), + )), + )); + + return output; + } + } + } + + let next = self.walk_stmt(env, next); + Stmt::Let(*symbol, expr.clone(), *layout, arena.alloc(next)) + } + Stmt::Switch { + cond_symbol, + cond_layout, + branches, + default_branch, + ret_layout, + } => { + let mut new_branches = Vec::with_capacity_in(branches.len(), arena); + + for (id, info, stmt) in branches.iter() { + let new_stmt = self.walk_stmt(env, stmt); + + new_branches.push((*id, info.clone(), new_stmt)); + } + + let new_default_branch = &*arena.alloc(self.walk_stmt(env, default_branch.1)); + + Stmt::Switch { + cond_symbol: *cond_symbol, + cond_layout: *cond_layout, + branches: arena.alloc(new_branches.into_bump_slice()), + default_branch: (default_branch.0.clone(), new_default_branch), + ret_layout: *ret_layout, + } + } + Stmt::Ret(symbol) => { + // write the symbol we're supposed to return into the hole + // then read initial_symbol and return its contents + self.non_trmc_return(env, *symbol) + } + Stmt::Refcounting(op, next) => { + let new_next = self.walk_stmt(env, next); + Stmt::Refcounting(*op, arena.alloc(new_next)) + } + Stmt::Expect { + condition, + region, + lookups, + variables, + remainder, + } => Stmt::Expect { + condition: *condition, + region: *region, + lookups, + variables, + remainder: arena.alloc(self.walk_stmt(env, remainder)), + }, + Stmt::ExpectFx { + condition, + region, + lookups, + variables, + remainder, + } => Stmt::Expect { + condition: *condition, + region: *region, + lookups, + variables, + remainder: arena.alloc(self.walk_stmt(env, remainder)), + }, + Stmt::Dbg { + symbol, + variable, + remainder, + } => Stmt::Dbg { + symbol: *symbol, + variable: *variable, + remainder: arena.alloc(self.walk_stmt(env, remainder)), + }, + Stmt::Join { + id, + parameters, + body, + remainder, + } => { + let new_body = self.walk_stmt(env, body); + let new_remainder = self.walk_stmt(env, remainder); + + Stmt::Join { + id: *id, + parameters, + body: arena.alloc(new_body), + remainder: arena.alloc(new_remainder), + } + } + Stmt::Jump(id, arguments) => Stmt::Jump(*id, arguments), + Stmt::Crash(symbol, crash_tag) => Stmt::Crash(*symbol, *crash_tag), + } + } + + fn non_trmc_return(&mut self, env: &mut Env<'a, '_>, value_symbol: Symbol) -> Stmt<'a> { + let arena = env.arena; + let layout = self.return_layout; + + let final_symbol = env.named_unique_symbol("final"); + + let call = Call { + call_type: CallType::LowLevel { + op: LowLevel::PtrLoad, + update_mode: UpdateModeId::BACKEND_DUMMY, + }, + arguments: &*arena.alloc([self.head_symbol]), + }; + + let ptr_load = |next| Stmt::Let(final_symbol, Expr::Call(call), layout, next); + + Self::ptr_write( + env, + self.hole_symbol, + value_symbol, + arena.alloc( + // + ptr_load(arena.alloc(Stmt::Ret(final_symbol))), + ), + ) + } +} + +fn expr_contains_symbol(expr: &Expr, needle: Symbol) -> bool { + match expr { + Expr::Literal(_) => false, + Expr::Call(call) => call.arguments.contains(&needle), + Expr::Tag { arguments, .. } => arguments.contains(&needle), + Expr::Struct(fields) => fields.contains(&needle), + Expr::NullPointer => false, + Expr::StructAtIndex { structure, .. } + | Expr::GetTagId { structure, .. } + | Expr::UnionAtIndex { structure, .. } + | Expr::UnionFieldPtrAtIndex { structure, .. } => needle == *structure, + Expr::Array { elems, .. } => elems.iter().any(|element| match element { + crate::ir::ListLiteralElement::Literal(_) => false, + crate::ir::ListLiteralElement::Symbol(symbol) => needle == *symbol, + }), + Expr::EmptyArray => false, + Expr::ExprBox { symbol } | Expr::ExprUnbox { symbol } => needle == *symbol, + Expr::Reuse { + symbol, arguments, .. + } => needle == *symbol || arguments.contains(&needle), + Expr::Reset { symbol, .. } | Expr::ResetRef { symbol, .. } => needle == *symbol, + Expr::RuntimeErrorFunction(_) => false, + } +} + +fn stmt_contains_symbol_nonrec(stmt: &Stmt, needle: Symbol) -> bool { + use crate::ir::ModifyRc::*; + + match stmt { + Stmt::Let(_, expr, _, _) => expr_contains_symbol(expr, needle), + Stmt::Switch { cond_symbol, .. } => needle == *cond_symbol, + Stmt::Ret(symbol) => needle == *symbol, + Stmt::Refcounting(modify, _) => { + matches!( modify, Inc(symbol, _) | Dec(symbol) | DecRef(symbol) if needle == *symbol ) + } + Stmt::Expect { + condition, lookups, .. + } + | Stmt::ExpectFx { + condition, lookups, .. + } => needle == *condition || lookups.contains(&needle), + Stmt::Dbg { symbol, .. } => needle == *symbol, + Stmt::Join { .. } => false, + Stmt::Jump(_, arguments) => arguments.contains(&needle), + Stmt::Crash(symbol, _) => needle == *symbol, + } +} diff --git a/crates/compiler/test_gen/src/gen_primitives.rs b/crates/compiler/test_gen/src/gen_primitives.rs index 587134965e7..7c51ad5c8f8 100644 --- a/crates/compiler/test_gen/src/gen_primitives.rs +++ b/crates/compiler/test_gen/src/gen_primitives.rs @@ -2211,9 +2211,10 @@ fn nullable_eval_cfold() { #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))] fn nested_switch() { - // exposed bug with passing the right symbol/layout down into switch branch generation - // This is also the only test_gen test that exercises Reset/Reuse (as of Aug 2022) - assert_evals_to!( + crate::helpers::with_larger_debug_stack(|| + // exposed bug with passing the right symbol/layout down into switch branch generation + // This is also the only test_gen test that exercises Reset/Reuse (as of Aug 2022) + assert_evals_to!( indoc!( r#" app "test" provides [main] to "./platform" @@ -2249,7 +2250,7 @@ fn nested_switch() { ), 12, i64 - ); + )); } #[test] @@ -4499,3 +4500,36 @@ fn pass_lambda_set_to_function() { i64 ); } + +#[test] +#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))] +fn linked_list_trmc() { + assert_evals_to!( + indoc!( + r#" + app "test" provides [main] to "./platform" + + LinkedList a : [Nil, Cons a (LinkedList a)] + + repeat : a, Nat -> LinkedList a + repeat = \value, n -> + when n is + 0 -> Nil + _ -> Cons value (repeat value (n - 1)) + + length : LinkedList a -> I64 + length = \list -> + when list is + Nil -> 0 + Cons _ rest -> 1 + length rest + + main : I64 + main = + repeat "foo" 5 + |> length + "# + ), + 5, + i64 + ); +} diff --git a/crates/compiler/test_mono/generated/anonymous_closure_in_polymorphic_expression_issue_4717.txt b/crates/compiler/test_mono/generated/anonymous_closure_in_polymorphic_expression_issue_4717.txt index 42f3862731e..f3eca0d0aa6 100644 --- a/crates/compiler/test_mono/generated/anonymous_closure_in_polymorphic_expression_issue_4717.txt +++ b/crates/compiler/test_mono/generated/anonymous_closure_in_polymorphic_expression_issue_4717.txt @@ -53,7 +53,7 @@ procedure List.72 (#Attr.2, #Attr.3, #Attr.4): let List.527 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; ret List.527; -procedure List.80 (List.571, List.572, List.573, List.574, List.575): +procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): joinpoint List.545 List.439 List.440 List.441 List.442 List.443: let List.547 : Int1 = CallByName Num.22 List.442 List.443; if List.547 then @@ -77,7 +77,7 @@ procedure List.80 (List.571, List.572, List.573, List.574, List.575): let List.546 : [C U64, C U64] = TagId(1) List.440; ret List.546; in - jump List.545 List.571 List.572 List.573 List.574 List.575; + jump List.545 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure List.93 (List.436, List.437, List.438): let List.543 : U64 = 0i64; diff --git a/crates/compiler/test_mono/generated/binary_tree_fbip.txt b/crates/compiler/test_mono/generated/binary_tree_fbip.txt index 84f7f6907c3..77de42cdbd8 100644 --- a/crates/compiler/test_mono/generated/binary_tree_fbip.txt +++ b/crates/compiler/test_mono/generated/binary_tree_fbip.txt @@ -8,7 +8,7 @@ procedure Test.4 (Test.27): let Test.38 : I64 = CallByName Test.5 Test.27 Test.39 Test.40; ret Test.38; -procedure Test.5 (Test.67, Test.68, Test.69): +procedure Test.5 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2): joinpoint Test.41 Test.29 Test.30 Test.31: let Test.51 : U8 = 0i64; let Test.52 : U8 = GetTagId Test.29; @@ -16,23 +16,23 @@ procedure Test.5 (Test.67, Test.68, Test.69): if Test.53 then let Test.32 : [, C *self *self] = UnionAtIndex (Id 0) (Index 0) Test.29; let Test.33 : [, C *self *self] = UnionAtIndex (Id 0) (Index 1) Test.29; - joinpoint #Derived_gen.0 #Derived_gen.4: - let #Derived_gen.5 : [C [, C *self *self] *self, ] = lowlevel PtrCast #Derived_gen.4; - let Test.43 : [C [, C *self *self] *self, ] = Reuse #Derived_gen.5 UpdateModeId { id: 1 } TagId(1) Test.33 Test.30; + joinpoint #Derived_gen.3 #Derived_gen.7: + let #Derived_gen.8 : [C [, C *self *self] *self, ] = lowlevel PtrCast #Derived_gen.7; + let Test.43 : [C [, C *self *self] *self, ] = Reuse #Derived_gen.8 UpdateModeId { id: 1 } TagId(1) Test.33 Test.30; let Test.45 : I64 = 1i64; let Test.44 : I64 = CallByName Num.19 Test.31 Test.45; jump Test.41 Test.32 Test.43 Test.44; in - let #Derived_gen.1 : Int1 = lowlevel RefCountIsUnique Test.29; - if #Derived_gen.1 then - let #Derived_gen.6 : [, C *self *self] = ResetRef { symbol: Test.29, id: UpdateModeId { id: 2 } }; - jump #Derived_gen.0 #Derived_gen.6; + let #Derived_gen.4 : Int1 = lowlevel RefCountIsUnique Test.29; + if #Derived_gen.4 then + let #Derived_gen.9 : [, C *self *self] = ResetRef { symbol: Test.29, id: UpdateModeId { id: 2 } }; + jump #Derived_gen.3 #Derived_gen.9; else inc Test.32; inc Test.33; decref Test.29; - let #Derived_gen.7 : [, C *self *self] = NullPointer; - jump #Derived_gen.0 #Derived_gen.7; + let #Derived_gen.10 : [, C *self *self] = NullPointer; + jump #Derived_gen.3 #Derived_gen.10; else let Test.48 : U8 = 1i64; let Test.49 : U8 = GetTagId Test.30; @@ -40,8 +40,8 @@ procedure Test.5 (Test.67, Test.68, Test.69): if Test.50 then let Test.35 : [, C *self *self] = UnionAtIndex (Id 1) (Index 0) Test.30; let Test.36 : [C [, C *self *self] *self, ] = UnionAtIndex (Id 1) (Index 1) Test.30; - let #Derived_gen.2 : Int1 = lowlevel RefCountIsUnique Test.30; - if #Derived_gen.2 then + let #Derived_gen.5 : Int1 = lowlevel RefCountIsUnique Test.30; + if #Derived_gen.5 then decref Test.30; jump Test.41 Test.35 Test.36 Test.31; else @@ -52,7 +52,7 @@ procedure Test.5 (Test.67, Test.68, Test.69): else ret Test.31; in - jump Test.41 Test.67 Test.68 Test.69; + jump Test.41 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2; procedure Test.0 (): let Test.64 : [, C *self *self] = TagId(1) ; diff --git a/crates/compiler/test_mono/generated/choose_correct_recursion_var_under_record.txt b/crates/compiler/test_mono/generated/choose_correct_recursion_var_under_record.txt index 7a3b68e8d6e..653d6dc3b9e 100644 --- a/crates/compiler/test_mono/generated/choose_correct_recursion_var_under_record.txt +++ b/crates/compiler/test_mono/generated/choose_correct_recursion_var_under_record.txt @@ -78,7 +78,7 @@ procedure Test.2 (Test.6): let Test.31 : Int1 = lowlevel Eq Test.29 Test.30; if Test.31 then let Test.7 : [C List *self, C *self] = UnionAtIndex (Id 1) (Index 0) Test.6; - joinpoint #Derived_gen.0: + joinpoint #Derived_gen.1: let Test.8 : Str = CallByName Test.2 Test.7; let Test.18 : Int1 = CallByName Bool.1; if Test.18 then @@ -88,17 +88,17 @@ procedure Test.2 (Test.6): let Test.17 : Str = "foo"; ret Test.17; in - let #Derived_gen.1 : Int1 = lowlevel RefCountIsUnique Test.6; - if #Derived_gen.1 then + let #Derived_gen.2 : Int1 = lowlevel RefCountIsUnique Test.6; + if #Derived_gen.2 then decref Test.6; - jump #Derived_gen.0; + jump #Derived_gen.1; else inc Test.7; decref Test.6; - jump #Derived_gen.0; + jump #Derived_gen.1; else let Test.9 : List [C List [C List *self, C *self], C [C List *self, C *self]] = UnionAtIndex (Id 0) (Index 0) Test.6; - joinpoint #Derived_gen.2: + joinpoint #Derived_gen.3: let Test.24 : {} = Struct {}; let Test.23 : List Str = CallByName List.5 Test.9 Test.24; let Test.21 : [C {}, C Str] = CallByName List.9 Test.23; @@ -106,14 +106,14 @@ procedure Test.2 (Test.6): let Test.20 : Str = CallByName Result.5 Test.21 Test.22; ret Test.20; in - let #Derived_gen.3 : Int1 = lowlevel RefCountIsUnique Test.6; - if #Derived_gen.3 then + let #Derived_gen.4 : Int1 = lowlevel RefCountIsUnique Test.6; + if #Derived_gen.4 then decref Test.6; - jump #Derived_gen.2; + jump #Derived_gen.3; else inc Test.9; decref Test.6; - jump #Derived_gen.2; + jump #Derived_gen.3; procedure Test.0 (): let Test.32 : List [C List [C List *self, C *self], C [C List *self, C *self]] = Array []; diff --git a/crates/compiler/test_mono/generated/compose_recursive_lambda_set_productive_nullable_wrapped.txt b/crates/compiler/test_mono/generated/compose_recursive_lambda_set_productive_nullable_wrapped.txt index 39dc4fc550a..ca95a51d0b1 100644 --- a/crates/compiler/test_mono/generated/compose_recursive_lambda_set_productive_nullable_wrapped.txt +++ b/crates/compiler/test_mono/generated/compose_recursive_lambda_set_productive_nullable_wrapped.txt @@ -18,7 +18,7 @@ procedure List.66 (#Attr.2, #Attr.3): let List.537 : Int1 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; ret List.537; -procedure List.80 (List.544, List.545, List.546, List.547, List.548): +procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): joinpoint List.527 List.439 List.440 List.441 List.442 List.443: let List.529 : Int1 = CallByName Num.22 List.442 List.443; if List.529 then @@ -31,7 +31,7 @@ procedure List.80 (List.544, List.545, List.546, List.547, List.548): dec List.439; ret List.440; in - jump List.527 List.544 List.545 List.546 List.547 List.548; + jump List.527 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure List.93 (List.436, List.437, List.438): let List.525 : U64 = 0i64; @@ -54,11 +54,11 @@ procedure Str.3 (#Attr.2, #Attr.3): procedure Test.1 (Test.5): ret Test.5; -procedure Test.11 (Test.53, Test.54): +procedure Test.11 (#Derived_gen.7, #Derived_gen.8): joinpoint Test.27 Test.12 #Attr.12: let Test.8 : Int1 = UnionAtIndex (Id 2) (Index 1) #Attr.12; let Test.7 : [, C *self Int1, C *self Int1] = UnionAtIndex (Id 2) (Index 0) #Attr.12; - joinpoint #Derived_gen.2: + joinpoint #Derived_gen.14: joinpoint Test.31 Test.29: let Test.30 : U8 = GetTagId Test.7; switch Test.30: @@ -85,16 +85,16 @@ procedure Test.11 (Test.53, Test.54): jump Test.31 Test.32; in - let #Derived_gen.3 : Int1 = lowlevel RefCountIsUnique #Attr.12; - if #Derived_gen.3 then + let #Derived_gen.15 : Int1 = lowlevel RefCountIsUnique #Attr.12; + if #Derived_gen.15 then decref #Attr.12; - jump #Derived_gen.2; + jump #Derived_gen.14; else inc Test.7; decref #Attr.12; - jump #Derived_gen.2; + jump #Derived_gen.14; in - jump Test.27 Test.53 Test.54; + jump Test.27 #Derived_gen.7 #Derived_gen.8; procedure Test.2 (Test.13): ret Test.13; @@ -125,7 +125,7 @@ procedure Test.6 (Test.7, Test.8, Test.5): procedure Test.9 (Test.10, #Attr.12): let Test.8 : Int1 = UnionAtIndex (Id 1) (Index 1) #Attr.12; let Test.7 : [, C *self Int1, C *self Int1] = UnionAtIndex (Id 1) (Index 0) #Attr.12; - joinpoint #Derived_gen.0: + joinpoint #Derived_gen.12: let Test.37 : U8 = GetTagId Test.7; joinpoint Test.38 Test.36: switch Test.8: @@ -153,14 +153,14 @@ procedure Test.9 (Test.10, #Attr.12): jump Test.38 Test.39; in - let #Derived_gen.1 : Int1 = lowlevel RefCountIsUnique #Attr.12; - if #Derived_gen.1 then + let #Derived_gen.13 : Int1 = lowlevel RefCountIsUnique #Attr.12; + if #Derived_gen.13 then decref #Attr.12; - jump #Derived_gen.0; + jump #Derived_gen.12; else inc Test.7; decref #Attr.12; - jump #Derived_gen.0; + jump #Derived_gen.12; procedure Test.0 (): let Test.41 : Int1 = false; diff --git a/crates/compiler/test_mono/generated/dict.txt b/crates/compiler/test_mono/generated/dict.txt index 74e203e84a9..faed8e7fc74 100644 --- a/crates/compiler/test_mono/generated/dict.txt +++ b/crates/compiler/test_mono/generated/dict.txt @@ -16,12 +16,12 @@ procedure Dict.36 (): procedure Dict.4 (Dict.543): let Dict.97 : U64 = StructAtIndex 3 Dict.543; - let #Derived_gen.2 : List {[], []} = StructAtIndex 0 Dict.543; - dec #Derived_gen.2; - let #Derived_gen.1 : List U64 = StructAtIndex 1 Dict.543; - dec #Derived_gen.1; - let #Derived_gen.0 : List I8 = StructAtIndex 2 Dict.543; - dec #Derived_gen.0; + let #Derived_gen.8 : List {[], []} = StructAtIndex 0 Dict.543; + dec #Derived_gen.8; + let #Derived_gen.7 : List U64 = StructAtIndex 1 Dict.543; + dec #Derived_gen.7; + let #Derived_gen.6 : List I8 = StructAtIndex 2 Dict.543; + dec #Derived_gen.6; ret Dict.97; procedure List.11 (List.121, List.122): @@ -50,21 +50,7 @@ procedure List.71 (#Attr.2, #Attr.3): let List.541 : List U64 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; ret List.541; -procedure List.83 (List.545, List.546, List.547): - joinpoint List.523 List.123 List.124 List.125: - let List.531 : U64 = 0i64; - let List.525 : Int1 = CallByName Num.24 List.124 List.531; - if List.525 then - let List.530 : U64 = 1i64; - let List.527 : U64 = CallByName Num.20 List.124 List.530; - let List.528 : List I8 = CallByName List.71 List.125 List.123; - jump List.523 List.123 List.527 List.528; - else - ret List.125; - in - jump List.523 List.545 List.546 List.547; - -procedure List.83 (List.553, List.554, List.555): +procedure List.83 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2): joinpoint List.535 List.123 List.124 List.125: let List.543 : U64 = 0i64; let List.537 : Int1 = CallByName Num.24 List.124 List.543; @@ -76,7 +62,21 @@ procedure List.83 (List.553, List.554, List.555): else ret List.125; in - jump List.535 List.553 List.554 List.555; + jump List.535 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2; + +procedure List.83 (#Derived_gen.3, #Derived_gen.4, #Derived_gen.5): + joinpoint List.523 List.123 List.124 List.125: + let List.531 : U64 = 0i64; + let List.525 : Int1 = CallByName Num.24 List.124 List.531; + if List.525 then + let List.530 : U64 = 1i64; + let List.527 : U64 = CallByName Num.20 List.124 List.530; + let List.528 : List I8 = CallByName List.71 List.125 List.123; + jump List.523 List.123 List.527 List.528; + else + ret List.125; + in + jump List.523 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; procedure Num.20 (#Attr.2, #Attr.3): let Num.293 : U64 = lowlevel NumSub #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt b/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt index 9f28113a0c3..9aa6441298a 100644 --- a/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt @@ -12,17 +12,17 @@ procedure #Derived.2 (#Derived.3, #Derived.4, #Derived.1): ret #Derived_gen.3; procedure #Derived.5 (#Derived.6): - let #Derived_gen.14 : Str = CallByName Encode.23 #Derived.6; - ret #Derived_gen.14; + let #Derived_gen.10 : Str = CallByName Encode.23 #Derived.6; + ret #Derived_gen.10; procedure #Derived.7 (#Derived.8, #Derived.9, #Derived.6): - let #Derived_gen.21 : Str = "b"; - let #Derived_gen.22 : Str = CallByName TotallyNotJson.25 #Derived.6; - let #Derived_gen.20 : {Str, Str} = Struct {#Derived_gen.21, #Derived_gen.22}; - let #Derived_gen.19 : List {Str, Str} = Array [#Derived_gen.20]; - let #Derived_gen.18 : List {Str, Str} = CallByName TotallyNotJson.29 #Derived_gen.19; - let #Derived_gen.17 : List U8 = CallByName Encode.24 #Derived.8 #Derived_gen.18 #Derived.9; - ret #Derived_gen.17; + let #Derived_gen.17 : Str = "b"; + let #Derived_gen.18 : Str = CallByName TotallyNotJson.25 #Derived.6; + let #Derived_gen.16 : {Str, Str} = Struct {#Derived_gen.17, #Derived_gen.18}; + let #Derived_gen.15 : List {Str, Str} = Array [#Derived_gen.16]; + let #Derived_gen.14 : List {Str, Str} = CallByName TotallyNotJson.29 #Derived_gen.15; + let #Derived_gen.13 : List U8 = CallByName Encode.24 #Derived.8 #Derived_gen.14 #Derived.9; + ret #Derived_gen.13; procedure Bool.1 (): let Bool.76 : Int1 = false; @@ -56,20 +56,20 @@ procedure Encode.24 (Encode.99, Encode.107, Encode.101): ret Encode.111; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.118 : List U8 = CallByName TotallyNotJson.234 Encode.99 Encode.101 Encode.107; - ret Encode.118; + let Encode.113 : List U8 = CallByName TotallyNotJson.234 Encode.99 Encode.101 Encode.107; + ret Encode.113; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.120 : List U8 = CallByName #Derived.7 Encode.99 Encode.101 Encode.107; - ret Encode.120; + let Encode.115 : List U8 = CallByName #Derived.7 Encode.99 Encode.101 Encode.107; + ret Encode.115; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.130 : List U8 = CallByName TotallyNotJson.234 Encode.99 Encode.101 Encode.107; - ret Encode.130; + let Encode.117 : List U8 = CallByName TotallyNotJson.234 Encode.99 Encode.101 Encode.107; + ret Encode.117; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.133 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; - ret Encode.133; + let Encode.120 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; + ret Encode.120; procedure Encode.26 (Encode.105, Encode.106): let Encode.109 : List U8 = Array []; @@ -78,303 +78,303 @@ procedure Encode.26 (Encode.105, Encode.106): ret Encode.108; procedure List.13 (#Attr.2, #Attr.3): - let List.730 : List Str = lowlevel ListPrepend #Attr.2 #Attr.3; - ret List.730; + let List.689 : List Str = lowlevel ListPrepend #Attr.2 #Attr.3; + ret List.689; procedure List.145 (List.146, List.147, List.144): - let List.570 : {List U8, U64} = CallByName TotallyNotJson.237 List.146 List.147 List.144; - ret List.570; + let List.569 : {List U8, U64} = CallByName TotallyNotJson.237 List.146 List.147 List.144; + ret List.569; procedure List.145 (List.146, List.147, List.144): - let List.678 : {List U8, U64} = CallByName TotallyNotJson.237 List.146 List.147 List.144; - ret List.678; + let List.637 : {List U8, U64} = CallByName TotallyNotJson.237 List.146 List.147 List.144; + ret List.637; procedure List.145 (List.146, List.147, List.144): - let List.698 : List U8 = CallByName TotallyNotJson.215 List.146 List.147; - ret List.698; + let List.657 : List U8 = CallByName TotallyNotJson.215 List.146 List.147; + ret List.657; procedure List.18 (List.142, List.143, List.144): - let List.551 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; - ret List.551; + let List.550 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; + ret List.550; procedure List.18 (List.142, List.143, List.144): - let List.659 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; - ret List.659; + let List.618 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; + ret List.618; procedure List.18 (List.142, List.143, List.144): - let List.679 : List U8 = CallByName List.93 List.142 List.143 List.144; - ret List.679; + let List.638 : List U8 = CallByName List.93 List.142 List.143 List.144; + ret List.638; procedure List.26 (List.159, List.160, List.161): - let List.747 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.93 List.159 List.160 List.161; - let List.750 : U8 = 1i64; - let List.751 : U8 = GetTagId List.747; - let List.752 : Int1 = lowlevel Eq List.750 List.751; - if List.752 then - let List.162 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.747; + let List.706 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.93 List.159 List.160 List.161; + let List.709 : U8 = 1i64; + let List.710 : U8 = GetTagId List.706; + let List.711 : Int1 = lowlevel Eq List.709 List.710; + if List.711 then + let List.162 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.706; ret List.162; else - let List.163 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.747; + let List.163 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.706; ret List.163; procedure List.31 (#Attr.2, #Attr.3): - let List.712 : List Str = lowlevel ListDropAt #Attr.2 #Attr.3; - ret List.712; + let List.671 : List Str = lowlevel ListDropAt #Attr.2 #Attr.3; + ret List.671; procedure List.38 (List.298): - let List.720 : U64 = 0i64; - let List.719 : List Str = CallByName List.31 List.298 List.720; - ret List.719; + let List.679 : U64 = 0i64; + let List.678 : List Str = CallByName List.31 List.298 List.679; + ret List.678; procedure List.4 (List.113, List.114): - let List.655 : U64 = 1i64; - let List.654 : List Str = CallByName List.70 List.113 List.655; - let List.653 : List Str = CallByName List.71 List.654 List.114; - ret List.653; + let List.614 : U64 = 1i64; + let List.613 : List Str = CallByName List.70 List.113 List.614; + let List.612 : List Str = CallByName List.71 List.613 List.114; + ret List.612; procedure List.4 (List.113, List.114): - let List.658 : U64 = 1i64; - let List.657 : List U8 = CallByName List.70 List.113 List.658; - let List.656 : List U8 = CallByName List.71 List.657 List.114; - ret List.656; + let List.617 : U64 = 1i64; + let List.616 : List U8 = CallByName List.70 List.113 List.617; + let List.615 : List U8 = CallByName List.71 List.616 List.114; + ret List.615; procedure List.49 (List.376, List.377): - let List.739 : U64 = StructAtIndex 0 List.377; - let List.740 : U64 = 0i64; - let List.737 : Int1 = CallByName Bool.11 List.739 List.740; - if List.737 then + let List.698 : U64 = StructAtIndex 0 List.377; + let List.699 : U64 = 0i64; + let List.696 : Int1 = CallByName Bool.11 List.698 List.699; + if List.696 then dec List.376; - let List.738 : List U8 = Array []; - ret List.738; + let List.697 : List U8 = Array []; + ret List.697; else - let List.734 : U64 = StructAtIndex 1 List.377; - let List.735 : U64 = StructAtIndex 0 List.377; - let List.733 : List U8 = CallByName List.72 List.376 List.734 List.735; - ret List.733; + let List.693 : U64 = StructAtIndex 1 List.377; + let List.694 : U64 = StructAtIndex 0 List.377; + let List.692 : List U8 = CallByName List.72 List.376 List.693 List.694; + ret List.692; procedure List.52 (List.391, List.392): let List.393 : U64 = CallByName List.6 List.391; - joinpoint List.745 List.394: - let List.743 : U64 = 0i64; - let List.742 : {U64, U64} = Struct {List.394, List.743}; + joinpoint List.704 List.394: + let List.702 : U64 = 0i64; + let List.701 : {U64, U64} = Struct {List.394, List.702}; inc List.391; - let List.395 : List U8 = CallByName List.49 List.391 List.742; - let List.741 : U64 = CallByName Num.20 List.393 List.394; - let List.732 : {U64, U64} = Struct {List.741, List.394}; - let List.396 : List U8 = CallByName List.49 List.391 List.732; - let List.731 : {List U8, List U8} = Struct {List.395, List.396}; - ret List.731; + let List.395 : List U8 = CallByName List.49 List.391 List.701; + let List.700 : U64 = CallByName Num.20 List.393 List.394; + let List.691 : {U64, U64} = Struct {List.700, List.394}; + let List.396 : List U8 = CallByName List.49 List.391 List.691; + let List.690 : {List U8, List U8} = Struct {List.395, List.396}; + ret List.690; in - let List.746 : Int1 = CallByName Num.24 List.393 List.392; - if List.746 then - jump List.745 List.392; + let List.705 : Int1 = CallByName Num.24 List.393 List.392; + if List.705 then + jump List.704 List.392; else - jump List.745 List.393; + jump List.704 List.393; procedure List.6 (#Attr.2): - let List.589 : U64 = lowlevel ListLen #Attr.2; - ret List.589; + let List.588 : U64 = lowlevel ListLen #Attr.2; + ret List.588; procedure List.6 (#Attr.2): - let List.726 : U64 = lowlevel ListLen #Attr.2; - ret List.726; + let List.685 : U64 = lowlevel ListLen #Attr.2; + ret List.685; procedure List.6 (#Attr.2): - let List.727 : U64 = lowlevel ListLen #Attr.2; - ret List.727; + let List.686 : U64 = lowlevel ListLen #Attr.2; + ret List.686; procedure List.6 (#Attr.2): - let List.729 : U64 = lowlevel ListLen #Attr.2; - ret List.729; + let List.688 : U64 = lowlevel ListLen #Attr.2; + ret List.688; procedure List.66 (#Attr.2, #Attr.3): - let List.567 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.567; + let List.566 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.566; procedure List.66 (#Attr.2, #Attr.3): - let List.675 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.675; + let List.634 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.634; procedure List.66 (#Attr.2, #Attr.3): - let List.695 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.695; + let List.654 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.654; procedure List.68 (#Attr.2): - let List.722 : List Str = lowlevel ListWithCapacity #Attr.2; - ret List.722; + let List.681 : List Str = lowlevel ListWithCapacity #Attr.2; + ret List.681; procedure List.68 (#Attr.2): - let List.724 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.724; + let List.683 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.683; procedure List.70 (#Attr.2, #Attr.3): - let List.635 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.635; + let List.594 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.594; procedure List.70 (#Attr.2, #Attr.3): - let List.652 : List Str = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.652; + let List.611 : List Str = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.611; procedure List.71 (#Attr.2, #Attr.3): - let List.633 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.633; + let List.592 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.592; procedure List.71 (#Attr.2, #Attr.3): - let List.650 : List Str = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.650; + let List.609 : List Str = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.609; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.736 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.736; + let List.695 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.695; procedure List.8 (#Attr.2, #Attr.3): - let List.701 : List Str = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.701; + let List.660 : List Str = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.660; procedure List.8 (#Attr.2, #Attr.3): - let List.709 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.709; - -procedure List.80 (List.606, List.607, List.608, List.609, List.610): - joinpoint List.557 List.439 List.440 List.441 List.442 List.443: - let List.559 : Int1 = CallByName Num.22 List.442 List.443; - if List.559 then - let List.566 : {Str, Str} = CallByName List.66 List.439 List.442; - inc List.566; - let List.560 : {List U8, U64} = CallByName List.145 List.440 List.566 List.441; - let List.563 : U64 = 1i64; - let List.562 : U64 = CallByName Num.19 List.442 List.563; - jump List.557 List.439 List.560 List.441 List.562 List.443; + let List.668 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.668; + +procedure List.80 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): + joinpoint List.715 List.439 List.440 List.441 List.442 List.443: + let List.717 : Int1 = CallByName Num.22 List.442 List.443; + if List.717 then + let List.726 : U8 = CallByName List.66 List.439 List.442; + let List.718 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.726; + let List.723 : U8 = 1i64; + let List.724 : U8 = GetTagId List.718; + let List.725 : Int1 = lowlevel Eq List.723 List.724; + if List.725 then + let List.444 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.718; + let List.721 : U64 = 1i64; + let List.720 : U64 = CallByName Num.19 List.442 List.721; + jump List.715 List.439 List.444 List.441 List.720 List.443; + else + dec List.439; + let List.445 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.718; + let List.722 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.445; + ret List.722; else dec List.439; - ret List.440; + let List.716 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.440; + ret List.716; in - jump List.557 List.606 List.607 List.608 List.609 List.610; - -procedure List.80 (List.783, List.784, List.785, List.786, List.787): - joinpoint List.665 List.439 List.440 List.441 List.442 List.443: - let List.667 : Int1 = CallByName Num.22 List.442 List.443; - if List.667 then - let List.674 : {Str, Str} = CallByName List.66 List.439 List.442; - inc List.674; - let List.668 : {List U8, U64} = CallByName List.145 List.440 List.674 List.441; - let List.671 : U64 = 1i64; - let List.670 : U64 = CallByName Num.19 List.442 List.671; - jump List.665 List.439 List.668 List.441 List.670 List.443; + jump List.715 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; + +procedure List.80 (#Derived_gen.31, #Derived_gen.32, #Derived_gen.33, #Derived_gen.34, #Derived_gen.35): + joinpoint List.644 List.439 List.440 List.441 List.442 List.443: + let List.646 : Int1 = CallByName Num.22 List.442 List.443; + if List.646 then + let List.653 : U8 = CallByName List.66 List.439 List.442; + let List.647 : List U8 = CallByName List.145 List.440 List.653 List.441; + let List.650 : U64 = 1i64; + let List.649 : U64 = CallByName Num.19 List.442 List.650; + jump List.644 List.439 List.647 List.441 List.649 List.443; else dec List.439; ret List.440; in - jump List.665 List.783 List.784 List.785 List.786 List.787; - -procedure List.80 (List.800, List.801, List.802, List.803, List.804): - joinpoint List.685 List.439 List.440 List.441 List.442 List.443: - let List.687 : Int1 = CallByName Num.22 List.442 List.443; - if List.687 then - let List.694 : U8 = CallByName List.66 List.439 List.442; - let List.688 : List U8 = CallByName List.145 List.440 List.694 List.441; - let List.691 : U64 = 1i64; - let List.690 : U64 = CallByName Num.19 List.442 List.691; - jump List.685 List.439 List.688 List.441 List.690 List.443; + jump List.644 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35; + +procedure List.80 (#Derived_gen.36, #Derived_gen.37, #Derived_gen.38, #Derived_gen.39, #Derived_gen.40): + joinpoint List.624 List.439 List.440 List.441 List.442 List.443: + let List.626 : Int1 = CallByName Num.22 List.442 List.443; + if List.626 then + let List.633 : {Str, Str} = CallByName List.66 List.439 List.442; + inc List.633; + let List.627 : {List U8, U64} = CallByName List.145 List.440 List.633 List.441; + let List.630 : U64 = 1i64; + let List.629 : U64 = CallByName Num.19 List.442 List.630; + jump List.624 List.439 List.627 List.441 List.629 List.443; else dec List.439; ret List.440; in - jump List.685 List.800 List.801 List.802 List.803 List.804; - -procedure List.80 (List.836, List.837, List.838, List.839, List.840): - joinpoint List.756 List.439 List.440 List.441 List.442 List.443: - let List.758 : Int1 = CallByName Num.22 List.442 List.443; - if List.758 then - let List.767 : U8 = CallByName List.66 List.439 List.442; - let List.759 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.767; - let List.764 : U8 = 1i64; - let List.765 : U8 = GetTagId List.759; - let List.766 : Int1 = lowlevel Eq List.764 List.765; - if List.766 then - let List.444 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.759; - let List.762 : U64 = 1i64; - let List.761 : U64 = CallByName Num.19 List.442 List.762; - jump List.756 List.439 List.444 List.441 List.761 List.443; - else - dec List.439; - let List.445 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.759; - let List.763 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.445; - ret List.763; + jump List.624 #Derived_gen.36 #Derived_gen.37 #Derived_gen.38 #Derived_gen.39 #Derived_gen.40; + +procedure List.80 (#Derived_gen.42, #Derived_gen.43, #Derived_gen.44, #Derived_gen.45, #Derived_gen.46): + joinpoint List.556 List.439 List.440 List.441 List.442 List.443: + let List.558 : Int1 = CallByName Num.22 List.442 List.443; + if List.558 then + let List.565 : {Str, Str} = CallByName List.66 List.439 List.442; + inc List.565; + let List.559 : {List U8, U64} = CallByName List.145 List.440 List.565 List.441; + let List.562 : U64 = 1i64; + let List.561 : U64 = CallByName Num.19 List.442 List.562; + jump List.556 List.439 List.559 List.441 List.561 List.443; else dec List.439; - let List.757 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.440; - ret List.757; + ret List.440; in - jump List.756 List.836 List.837 List.838 List.839 List.840; + jump List.556 #Derived_gen.42 #Derived_gen.43 #Derived_gen.44 #Derived_gen.45 #Derived_gen.46; procedure List.93 (List.436, List.437, List.438): - let List.555 : U64 = 0i64; - let List.556 : U64 = CallByName List.6 List.436; - let List.554 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.555 List.556; - ret List.554; + let List.554 : U64 = 0i64; + let List.555 : U64 = CallByName List.6 List.436; + let List.553 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.554 List.555; + ret List.553; procedure List.93 (List.436, List.437, List.438): - let List.663 : U64 = 0i64; - let List.664 : U64 = CallByName List.6 List.436; - let List.662 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.663 List.664; - ret List.662; + let List.622 : U64 = 0i64; + let List.623 : U64 = CallByName List.6 List.436; + let List.621 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.622 List.623; + ret List.621; procedure List.93 (List.436, List.437, List.438): - let List.683 : U64 = 0i64; - let List.684 : U64 = CallByName List.6 List.436; - let List.682 : List U8 = CallByName List.80 List.436 List.437 List.438 List.683 List.684; - ret List.682; + let List.642 : U64 = 0i64; + let List.643 : U64 = CallByName List.6 List.436; + let List.641 : List U8 = CallByName List.80 List.436 List.437 List.438 List.642 List.643; + ret List.641; procedure List.93 (List.436, List.437, List.438): - let List.754 : U64 = 0i64; - let List.755 : U64 = CallByName List.6 List.436; - let List.753 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.436 List.437 List.438 List.754 List.755; - ret List.753; + let List.713 : U64 = 0i64; + let List.714 : U64 = CallByName List.6 List.436; + let List.712 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.436 List.437 List.438 List.713 List.714; + ret List.712; procedure Num.127 (#Attr.2): - let Num.316 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.316; + let Num.307 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.307; procedure Num.19 (#Attr.2, #Attr.3): - let Num.325 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.325; + let Num.316 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.316; procedure Num.20 (#Attr.2, #Attr.3): - let Num.329 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.329; + let Num.320 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.320; procedure Num.21 (#Attr.2, #Attr.3): - let Num.322 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.322; + let Num.313 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.313; procedure Num.22 (#Attr.2, #Attr.3): - let Num.328 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.328; + let Num.319 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.319; procedure Num.24 (#Attr.2, #Attr.3): - let Num.330 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.330; + let Num.321 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.321; procedure Num.94 (#Attr.2, #Attr.3): - let Num.321 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.321; + let Num.312 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.312; procedure Str.12 (#Attr.2): - let Str.324 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.324; + let Str.316 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.316; procedure Str.4 (#Attr.2, #Attr.3): - let Str.327 : Str = lowlevel StrJoinWith #Attr.2 #Attr.3; - ret Str.327; + let Str.319 : Str = lowlevel StrJoinWith #Attr.2 #Attr.3; + ret Str.319; procedure Str.48 (#Attr.2, #Attr.3, #Attr.4): let Str.307 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; ret Str.307; procedure Str.55 (#Attr.2): - let Str.330 : List Str = lowlevel StrGraphemes #Attr.2; - ret Str.330; + let Str.322 : List Str = lowlevel StrGraphemes #Attr.2; + ret Str.322; procedure Str.9 (Str.79): let Str.305 : U64 = 0i64; @@ -388,709 +388,709 @@ procedure Str.9 (Str.79): else let Str.300 : U8 = StructAtIndex 3 Str.80; let Str.301 : U64 = StructAtIndex 0 Str.80; - let #Derived_gen.29 : Str = StructAtIndex 1 Str.80; - dec #Derived_gen.29; + let #Derived_gen.58 : Str = StructAtIndex 1 Str.80; + dec #Derived_gen.58; let Str.299 : {U64, U8} = Struct {Str.301, Str.300}; let Str.298 : [C {U64, U8}, C Str] = TagId(0) Str.299; ret Str.298; procedure TotallyNotJson.100 (TotallyNotJson.850): - let TotallyNotJson.1853 : Str = "a"; - let TotallyNotJson.1854 : Int1 = lowlevel Eq TotallyNotJson.1853 TotallyNotJson.850; - dec TotallyNotJson.1853; - if TotallyNotJson.1854 then + let TotallyNotJson.1830 : Str = "a"; + let TotallyNotJson.1831 : Int1 = lowlevel Eq TotallyNotJson.1830 TotallyNotJson.850; + dec TotallyNotJson.1830; + if TotallyNotJson.1831 then dec TotallyNotJson.850; - let TotallyNotJson.1776 : Str = "A"; - ret TotallyNotJson.1776; + let TotallyNotJson.1753 : Str = "A"; + ret TotallyNotJson.1753; else - let TotallyNotJson.1851 : Str = "b"; - let TotallyNotJson.1852 : Int1 = lowlevel Eq TotallyNotJson.1851 TotallyNotJson.850; - dec TotallyNotJson.1851; - if TotallyNotJson.1852 then + let TotallyNotJson.1828 : Str = "b"; + let TotallyNotJson.1829 : Int1 = lowlevel Eq TotallyNotJson.1828 TotallyNotJson.850; + dec TotallyNotJson.1828; + if TotallyNotJson.1829 then dec TotallyNotJson.850; - let TotallyNotJson.1777 : Str = "B"; - ret TotallyNotJson.1777; + let TotallyNotJson.1754 : Str = "B"; + ret TotallyNotJson.1754; else - let TotallyNotJson.1849 : Str = "c"; - let TotallyNotJson.1850 : Int1 = lowlevel Eq TotallyNotJson.1849 TotallyNotJson.850; - dec TotallyNotJson.1849; - if TotallyNotJson.1850 then + let TotallyNotJson.1826 : Str = "c"; + let TotallyNotJson.1827 : Int1 = lowlevel Eq TotallyNotJson.1826 TotallyNotJson.850; + dec TotallyNotJson.1826; + if TotallyNotJson.1827 then dec TotallyNotJson.850; - let TotallyNotJson.1778 : Str = "C"; - ret TotallyNotJson.1778; + let TotallyNotJson.1755 : Str = "C"; + ret TotallyNotJson.1755; else - let TotallyNotJson.1847 : Str = "d"; - let TotallyNotJson.1848 : Int1 = lowlevel Eq TotallyNotJson.1847 TotallyNotJson.850; - dec TotallyNotJson.1847; - if TotallyNotJson.1848 then + let TotallyNotJson.1824 : Str = "d"; + let TotallyNotJson.1825 : Int1 = lowlevel Eq TotallyNotJson.1824 TotallyNotJson.850; + dec TotallyNotJson.1824; + if TotallyNotJson.1825 then dec TotallyNotJson.850; - let TotallyNotJson.1779 : Str = "D"; - ret TotallyNotJson.1779; + let TotallyNotJson.1756 : Str = "D"; + ret TotallyNotJson.1756; else - let TotallyNotJson.1845 : Str = "e"; - let TotallyNotJson.1846 : Int1 = lowlevel Eq TotallyNotJson.1845 TotallyNotJson.850; - dec TotallyNotJson.1845; - if TotallyNotJson.1846 then + let TotallyNotJson.1822 : Str = "e"; + let TotallyNotJson.1823 : Int1 = lowlevel Eq TotallyNotJson.1822 TotallyNotJson.850; + dec TotallyNotJson.1822; + if TotallyNotJson.1823 then dec TotallyNotJson.850; - let TotallyNotJson.1780 : Str = "E"; - ret TotallyNotJson.1780; + let TotallyNotJson.1757 : Str = "E"; + ret TotallyNotJson.1757; else - let TotallyNotJson.1843 : Str = "f"; - let TotallyNotJson.1844 : Int1 = lowlevel Eq TotallyNotJson.1843 TotallyNotJson.850; - dec TotallyNotJson.1843; - if TotallyNotJson.1844 then + let TotallyNotJson.1820 : Str = "f"; + let TotallyNotJson.1821 : Int1 = lowlevel Eq TotallyNotJson.1820 TotallyNotJson.850; + dec TotallyNotJson.1820; + if TotallyNotJson.1821 then dec TotallyNotJson.850; - let TotallyNotJson.1781 : Str = "F"; - ret TotallyNotJson.1781; + let TotallyNotJson.1758 : Str = "F"; + ret TotallyNotJson.1758; else - let TotallyNotJson.1841 : Str = "g"; - let TotallyNotJson.1842 : Int1 = lowlevel Eq TotallyNotJson.1841 TotallyNotJson.850; - dec TotallyNotJson.1841; - if TotallyNotJson.1842 then + let TotallyNotJson.1818 : Str = "g"; + let TotallyNotJson.1819 : Int1 = lowlevel Eq TotallyNotJson.1818 TotallyNotJson.850; + dec TotallyNotJson.1818; + if TotallyNotJson.1819 then dec TotallyNotJson.850; - let TotallyNotJson.1782 : Str = "G"; - ret TotallyNotJson.1782; + let TotallyNotJson.1759 : Str = "G"; + ret TotallyNotJson.1759; else - let TotallyNotJson.1839 : Str = "h"; - let TotallyNotJson.1840 : Int1 = lowlevel Eq TotallyNotJson.1839 TotallyNotJson.850; - dec TotallyNotJson.1839; - if TotallyNotJson.1840 then + let TotallyNotJson.1816 : Str = "h"; + let TotallyNotJson.1817 : Int1 = lowlevel Eq TotallyNotJson.1816 TotallyNotJson.850; + dec TotallyNotJson.1816; + if TotallyNotJson.1817 then dec TotallyNotJson.850; - let TotallyNotJson.1783 : Str = "H"; - ret TotallyNotJson.1783; + let TotallyNotJson.1760 : Str = "H"; + ret TotallyNotJson.1760; else - let TotallyNotJson.1837 : Str = "i"; - let TotallyNotJson.1838 : Int1 = lowlevel Eq TotallyNotJson.1837 TotallyNotJson.850; - dec TotallyNotJson.1837; - if TotallyNotJson.1838 then + let TotallyNotJson.1814 : Str = "i"; + let TotallyNotJson.1815 : Int1 = lowlevel Eq TotallyNotJson.1814 TotallyNotJson.850; + dec TotallyNotJson.1814; + if TotallyNotJson.1815 then dec TotallyNotJson.850; - let TotallyNotJson.1784 : Str = "I"; - ret TotallyNotJson.1784; + let TotallyNotJson.1761 : Str = "I"; + ret TotallyNotJson.1761; else - let TotallyNotJson.1835 : Str = "j"; - let TotallyNotJson.1836 : Int1 = lowlevel Eq TotallyNotJson.1835 TotallyNotJson.850; - dec TotallyNotJson.1835; - if TotallyNotJson.1836 then + let TotallyNotJson.1812 : Str = "j"; + let TotallyNotJson.1813 : Int1 = lowlevel Eq TotallyNotJson.1812 TotallyNotJson.850; + dec TotallyNotJson.1812; + if TotallyNotJson.1813 then dec TotallyNotJson.850; - let TotallyNotJson.1785 : Str = "J"; - ret TotallyNotJson.1785; + let TotallyNotJson.1762 : Str = "J"; + ret TotallyNotJson.1762; else - let TotallyNotJson.1833 : Str = "k"; - let TotallyNotJson.1834 : Int1 = lowlevel Eq TotallyNotJson.1833 TotallyNotJson.850; - dec TotallyNotJson.1833; - if TotallyNotJson.1834 then + let TotallyNotJson.1810 : Str = "k"; + let TotallyNotJson.1811 : Int1 = lowlevel Eq TotallyNotJson.1810 TotallyNotJson.850; + dec TotallyNotJson.1810; + if TotallyNotJson.1811 then dec TotallyNotJson.850; - let TotallyNotJson.1786 : Str = "K"; - ret TotallyNotJson.1786; + let TotallyNotJson.1763 : Str = "K"; + ret TotallyNotJson.1763; else - let TotallyNotJson.1831 : Str = "l"; - let TotallyNotJson.1832 : Int1 = lowlevel Eq TotallyNotJson.1831 TotallyNotJson.850; - dec TotallyNotJson.1831; - if TotallyNotJson.1832 then + let TotallyNotJson.1808 : Str = "l"; + let TotallyNotJson.1809 : Int1 = lowlevel Eq TotallyNotJson.1808 TotallyNotJson.850; + dec TotallyNotJson.1808; + if TotallyNotJson.1809 then dec TotallyNotJson.850; - let TotallyNotJson.1787 : Str = "L"; - ret TotallyNotJson.1787; + let TotallyNotJson.1764 : Str = "L"; + ret TotallyNotJson.1764; else - let TotallyNotJson.1829 : Str = "m"; - let TotallyNotJson.1830 : Int1 = lowlevel Eq TotallyNotJson.1829 TotallyNotJson.850; - dec TotallyNotJson.1829; - if TotallyNotJson.1830 then + let TotallyNotJson.1806 : Str = "m"; + let TotallyNotJson.1807 : Int1 = lowlevel Eq TotallyNotJson.1806 TotallyNotJson.850; + dec TotallyNotJson.1806; + if TotallyNotJson.1807 then dec TotallyNotJson.850; - let TotallyNotJson.1788 : Str = "M"; - ret TotallyNotJson.1788; + let TotallyNotJson.1765 : Str = "M"; + ret TotallyNotJson.1765; else - let TotallyNotJson.1827 : Str = "n"; - let TotallyNotJson.1828 : Int1 = lowlevel Eq TotallyNotJson.1827 TotallyNotJson.850; - dec TotallyNotJson.1827; - if TotallyNotJson.1828 then + let TotallyNotJson.1804 : Str = "n"; + let TotallyNotJson.1805 : Int1 = lowlevel Eq TotallyNotJson.1804 TotallyNotJson.850; + dec TotallyNotJson.1804; + if TotallyNotJson.1805 then dec TotallyNotJson.850; - let TotallyNotJson.1789 : Str = "N"; - ret TotallyNotJson.1789; + let TotallyNotJson.1766 : Str = "N"; + ret TotallyNotJson.1766; else - let TotallyNotJson.1825 : Str = "o"; - let TotallyNotJson.1826 : Int1 = lowlevel Eq TotallyNotJson.1825 TotallyNotJson.850; - dec TotallyNotJson.1825; - if TotallyNotJson.1826 then + let TotallyNotJson.1802 : Str = "o"; + let TotallyNotJson.1803 : Int1 = lowlevel Eq TotallyNotJson.1802 TotallyNotJson.850; + dec TotallyNotJson.1802; + if TotallyNotJson.1803 then dec TotallyNotJson.850; - let TotallyNotJson.1790 : Str = "O"; - ret TotallyNotJson.1790; + let TotallyNotJson.1767 : Str = "O"; + ret TotallyNotJson.1767; else - let TotallyNotJson.1823 : Str = "p"; - let TotallyNotJson.1824 : Int1 = lowlevel Eq TotallyNotJson.1823 TotallyNotJson.850; - dec TotallyNotJson.1823; - if TotallyNotJson.1824 then + let TotallyNotJson.1800 : Str = "p"; + let TotallyNotJson.1801 : Int1 = lowlevel Eq TotallyNotJson.1800 TotallyNotJson.850; + dec TotallyNotJson.1800; + if TotallyNotJson.1801 then dec TotallyNotJson.850; - let TotallyNotJson.1791 : Str = "P"; - ret TotallyNotJson.1791; + let TotallyNotJson.1768 : Str = "P"; + ret TotallyNotJson.1768; else - let TotallyNotJson.1821 : Str = "q"; - let TotallyNotJson.1822 : Int1 = lowlevel Eq TotallyNotJson.1821 TotallyNotJson.850; - dec TotallyNotJson.1821; - if TotallyNotJson.1822 then + let TotallyNotJson.1798 : Str = "q"; + let TotallyNotJson.1799 : Int1 = lowlevel Eq TotallyNotJson.1798 TotallyNotJson.850; + dec TotallyNotJson.1798; + if TotallyNotJson.1799 then dec TotallyNotJson.850; - let TotallyNotJson.1792 : Str = "Q"; - ret TotallyNotJson.1792; + let TotallyNotJson.1769 : Str = "Q"; + ret TotallyNotJson.1769; else - let TotallyNotJson.1819 : Str = "r"; - let TotallyNotJson.1820 : Int1 = lowlevel Eq TotallyNotJson.1819 TotallyNotJson.850; - dec TotallyNotJson.1819; - if TotallyNotJson.1820 then + let TotallyNotJson.1796 : Str = "r"; + let TotallyNotJson.1797 : Int1 = lowlevel Eq TotallyNotJson.1796 TotallyNotJson.850; + dec TotallyNotJson.1796; + if TotallyNotJson.1797 then dec TotallyNotJson.850; - let TotallyNotJson.1793 : Str = "R"; - ret TotallyNotJson.1793; + let TotallyNotJson.1770 : Str = "R"; + ret TotallyNotJson.1770; else - let TotallyNotJson.1817 : Str = "s"; - let TotallyNotJson.1818 : Int1 = lowlevel Eq TotallyNotJson.1817 TotallyNotJson.850; - dec TotallyNotJson.1817; - if TotallyNotJson.1818 then + let TotallyNotJson.1794 : Str = "s"; + let TotallyNotJson.1795 : Int1 = lowlevel Eq TotallyNotJson.1794 TotallyNotJson.850; + dec TotallyNotJson.1794; + if TotallyNotJson.1795 then dec TotallyNotJson.850; - let TotallyNotJson.1794 : Str = "S"; - ret TotallyNotJson.1794; + let TotallyNotJson.1771 : Str = "S"; + ret TotallyNotJson.1771; else - let TotallyNotJson.1815 : Str = "t"; - let TotallyNotJson.1816 : Int1 = lowlevel Eq TotallyNotJson.1815 TotallyNotJson.850; - dec TotallyNotJson.1815; - if TotallyNotJson.1816 then + let TotallyNotJson.1792 : Str = "t"; + let TotallyNotJson.1793 : Int1 = lowlevel Eq TotallyNotJson.1792 TotallyNotJson.850; + dec TotallyNotJson.1792; + if TotallyNotJson.1793 then dec TotallyNotJson.850; - let TotallyNotJson.1795 : Str = "T"; - ret TotallyNotJson.1795; + let TotallyNotJson.1772 : Str = "T"; + ret TotallyNotJson.1772; else - let TotallyNotJson.1813 : Str = "u"; - let TotallyNotJson.1814 : Int1 = lowlevel Eq TotallyNotJson.1813 TotallyNotJson.850; - dec TotallyNotJson.1813; - if TotallyNotJson.1814 then + let TotallyNotJson.1790 : Str = "u"; + let TotallyNotJson.1791 : Int1 = lowlevel Eq TotallyNotJson.1790 TotallyNotJson.850; + dec TotallyNotJson.1790; + if TotallyNotJson.1791 then dec TotallyNotJson.850; - let TotallyNotJson.1796 : Str = "U"; - ret TotallyNotJson.1796; + let TotallyNotJson.1773 : Str = "U"; + ret TotallyNotJson.1773; else - let TotallyNotJson.1811 : Str = "v"; - let TotallyNotJson.1812 : Int1 = lowlevel Eq TotallyNotJson.1811 TotallyNotJson.850; - dec TotallyNotJson.1811; - if TotallyNotJson.1812 then + let TotallyNotJson.1788 : Str = "v"; + let TotallyNotJson.1789 : Int1 = lowlevel Eq TotallyNotJson.1788 TotallyNotJson.850; + dec TotallyNotJson.1788; + if TotallyNotJson.1789 then dec TotallyNotJson.850; - let TotallyNotJson.1797 : Str = "V"; - ret TotallyNotJson.1797; + let TotallyNotJson.1774 : Str = "V"; + ret TotallyNotJson.1774; else - let TotallyNotJson.1809 : Str = "w"; - let TotallyNotJson.1810 : Int1 = lowlevel Eq TotallyNotJson.1809 TotallyNotJson.850; - dec TotallyNotJson.1809; - if TotallyNotJson.1810 then + let TotallyNotJson.1786 : Str = "w"; + let TotallyNotJson.1787 : Int1 = lowlevel Eq TotallyNotJson.1786 TotallyNotJson.850; + dec TotallyNotJson.1786; + if TotallyNotJson.1787 then dec TotallyNotJson.850; - let TotallyNotJson.1798 : Str = "W"; - ret TotallyNotJson.1798; + let TotallyNotJson.1775 : Str = "W"; + ret TotallyNotJson.1775; else - let TotallyNotJson.1807 : Str = "x"; - let TotallyNotJson.1808 : Int1 = lowlevel Eq TotallyNotJson.1807 TotallyNotJson.850; - dec TotallyNotJson.1807; - if TotallyNotJson.1808 then + let TotallyNotJson.1784 : Str = "x"; + let TotallyNotJson.1785 : Int1 = lowlevel Eq TotallyNotJson.1784 TotallyNotJson.850; + dec TotallyNotJson.1784; + if TotallyNotJson.1785 then dec TotallyNotJson.850; - let TotallyNotJson.1799 : Str = "X"; - ret TotallyNotJson.1799; + let TotallyNotJson.1776 : Str = "X"; + ret TotallyNotJson.1776; else - let TotallyNotJson.1805 : Str = "y"; - let TotallyNotJson.1806 : Int1 = lowlevel Eq TotallyNotJson.1805 TotallyNotJson.850; - dec TotallyNotJson.1805; - if TotallyNotJson.1806 then + let TotallyNotJson.1782 : Str = "y"; + let TotallyNotJson.1783 : Int1 = lowlevel Eq TotallyNotJson.1782 TotallyNotJson.850; + dec TotallyNotJson.1782; + if TotallyNotJson.1783 then dec TotallyNotJson.850; - let TotallyNotJson.1800 : Str = "Y"; - ret TotallyNotJson.1800; + let TotallyNotJson.1777 : Str = "Y"; + ret TotallyNotJson.1777; else - let TotallyNotJson.1803 : Str = "z"; - let TotallyNotJson.1804 : Int1 = lowlevel Eq TotallyNotJson.1803 TotallyNotJson.850; - dec TotallyNotJson.1803; - if TotallyNotJson.1804 then + let TotallyNotJson.1780 : Str = "z"; + let TotallyNotJson.1781 : Int1 = lowlevel Eq TotallyNotJson.1780 TotallyNotJson.850; + dec TotallyNotJson.1780; + if TotallyNotJson.1781 then dec TotallyNotJson.850; - let TotallyNotJson.1801 : Str = "Z"; - ret TotallyNotJson.1801; + let TotallyNotJson.1778 : Str = "Z"; + ret TotallyNotJson.1778; else ret TotallyNotJson.850; procedure TotallyNotJson.101 (TotallyNotJson.851): - let TotallyNotJson.1677 : Str = "A"; - let TotallyNotJson.1678 : Int1 = lowlevel Eq TotallyNotJson.1677 TotallyNotJson.851; - dec TotallyNotJson.1677; - if TotallyNotJson.1678 then + let TotallyNotJson.1654 : Str = "A"; + let TotallyNotJson.1655 : Int1 = lowlevel Eq TotallyNotJson.1654 TotallyNotJson.851; + dec TotallyNotJson.1654; + if TotallyNotJson.1655 then dec TotallyNotJson.851; - let TotallyNotJson.1600 : Str = "a"; - ret TotallyNotJson.1600; + let TotallyNotJson.1577 : Str = "a"; + ret TotallyNotJson.1577; else - let TotallyNotJson.1675 : Str = "B"; - let TotallyNotJson.1676 : Int1 = lowlevel Eq TotallyNotJson.1675 TotallyNotJson.851; - dec TotallyNotJson.1675; - if TotallyNotJson.1676 then + let TotallyNotJson.1652 : Str = "B"; + let TotallyNotJson.1653 : Int1 = lowlevel Eq TotallyNotJson.1652 TotallyNotJson.851; + dec TotallyNotJson.1652; + if TotallyNotJson.1653 then dec TotallyNotJson.851; - let TotallyNotJson.1601 : Str = "b"; - ret TotallyNotJson.1601; + let TotallyNotJson.1578 : Str = "b"; + ret TotallyNotJson.1578; else - let TotallyNotJson.1673 : Str = "C"; - let TotallyNotJson.1674 : Int1 = lowlevel Eq TotallyNotJson.1673 TotallyNotJson.851; - dec TotallyNotJson.1673; - if TotallyNotJson.1674 then + let TotallyNotJson.1650 : Str = "C"; + let TotallyNotJson.1651 : Int1 = lowlevel Eq TotallyNotJson.1650 TotallyNotJson.851; + dec TotallyNotJson.1650; + if TotallyNotJson.1651 then dec TotallyNotJson.851; - let TotallyNotJson.1602 : Str = "c"; - ret TotallyNotJson.1602; + let TotallyNotJson.1579 : Str = "c"; + ret TotallyNotJson.1579; else - let TotallyNotJson.1671 : Str = "D"; - let TotallyNotJson.1672 : Int1 = lowlevel Eq TotallyNotJson.1671 TotallyNotJson.851; - dec TotallyNotJson.1671; - if TotallyNotJson.1672 then + let TotallyNotJson.1648 : Str = "D"; + let TotallyNotJson.1649 : Int1 = lowlevel Eq TotallyNotJson.1648 TotallyNotJson.851; + dec TotallyNotJson.1648; + if TotallyNotJson.1649 then dec TotallyNotJson.851; - let TotallyNotJson.1603 : Str = "d"; - ret TotallyNotJson.1603; + let TotallyNotJson.1580 : Str = "d"; + ret TotallyNotJson.1580; else - let TotallyNotJson.1669 : Str = "E"; - let TotallyNotJson.1670 : Int1 = lowlevel Eq TotallyNotJson.1669 TotallyNotJson.851; - dec TotallyNotJson.1669; - if TotallyNotJson.1670 then + let TotallyNotJson.1646 : Str = "E"; + let TotallyNotJson.1647 : Int1 = lowlevel Eq TotallyNotJson.1646 TotallyNotJson.851; + dec TotallyNotJson.1646; + if TotallyNotJson.1647 then dec TotallyNotJson.851; - let TotallyNotJson.1604 : Str = "e"; - ret TotallyNotJson.1604; + let TotallyNotJson.1581 : Str = "e"; + ret TotallyNotJson.1581; else - let TotallyNotJson.1667 : Str = "F"; - let TotallyNotJson.1668 : Int1 = lowlevel Eq TotallyNotJson.1667 TotallyNotJson.851; - dec TotallyNotJson.1667; - if TotallyNotJson.1668 then + let TotallyNotJson.1644 : Str = "F"; + let TotallyNotJson.1645 : Int1 = lowlevel Eq TotallyNotJson.1644 TotallyNotJson.851; + dec TotallyNotJson.1644; + if TotallyNotJson.1645 then dec TotallyNotJson.851; - let TotallyNotJson.1605 : Str = "f"; - ret TotallyNotJson.1605; + let TotallyNotJson.1582 : Str = "f"; + ret TotallyNotJson.1582; else - let TotallyNotJson.1665 : Str = "G"; - let TotallyNotJson.1666 : Int1 = lowlevel Eq TotallyNotJson.1665 TotallyNotJson.851; - dec TotallyNotJson.1665; - if TotallyNotJson.1666 then + let TotallyNotJson.1642 : Str = "G"; + let TotallyNotJson.1643 : Int1 = lowlevel Eq TotallyNotJson.1642 TotallyNotJson.851; + dec TotallyNotJson.1642; + if TotallyNotJson.1643 then dec TotallyNotJson.851; - let TotallyNotJson.1606 : Str = "g"; - ret TotallyNotJson.1606; + let TotallyNotJson.1583 : Str = "g"; + ret TotallyNotJson.1583; else - let TotallyNotJson.1663 : Str = "H"; - let TotallyNotJson.1664 : Int1 = lowlevel Eq TotallyNotJson.1663 TotallyNotJson.851; - dec TotallyNotJson.1663; - if TotallyNotJson.1664 then + let TotallyNotJson.1640 : Str = "H"; + let TotallyNotJson.1641 : Int1 = lowlevel Eq TotallyNotJson.1640 TotallyNotJson.851; + dec TotallyNotJson.1640; + if TotallyNotJson.1641 then dec TotallyNotJson.851; - let TotallyNotJson.1607 : Str = "h"; - ret TotallyNotJson.1607; + let TotallyNotJson.1584 : Str = "h"; + ret TotallyNotJson.1584; else - let TotallyNotJson.1661 : Str = "I"; - let TotallyNotJson.1662 : Int1 = lowlevel Eq TotallyNotJson.1661 TotallyNotJson.851; - dec TotallyNotJson.1661; - if TotallyNotJson.1662 then + let TotallyNotJson.1638 : Str = "I"; + let TotallyNotJson.1639 : Int1 = lowlevel Eq TotallyNotJson.1638 TotallyNotJson.851; + dec TotallyNotJson.1638; + if TotallyNotJson.1639 then dec TotallyNotJson.851; - let TotallyNotJson.1608 : Str = "i"; - ret TotallyNotJson.1608; + let TotallyNotJson.1585 : Str = "i"; + ret TotallyNotJson.1585; else - let TotallyNotJson.1659 : Str = "J"; - let TotallyNotJson.1660 : Int1 = lowlevel Eq TotallyNotJson.1659 TotallyNotJson.851; - dec TotallyNotJson.1659; - if TotallyNotJson.1660 then + let TotallyNotJson.1636 : Str = "J"; + let TotallyNotJson.1637 : Int1 = lowlevel Eq TotallyNotJson.1636 TotallyNotJson.851; + dec TotallyNotJson.1636; + if TotallyNotJson.1637 then dec TotallyNotJson.851; - let TotallyNotJson.1609 : Str = "j"; - ret TotallyNotJson.1609; + let TotallyNotJson.1586 : Str = "j"; + ret TotallyNotJson.1586; else - let TotallyNotJson.1657 : Str = "K"; - let TotallyNotJson.1658 : Int1 = lowlevel Eq TotallyNotJson.1657 TotallyNotJson.851; - dec TotallyNotJson.1657; - if TotallyNotJson.1658 then + let TotallyNotJson.1634 : Str = "K"; + let TotallyNotJson.1635 : Int1 = lowlevel Eq TotallyNotJson.1634 TotallyNotJson.851; + dec TotallyNotJson.1634; + if TotallyNotJson.1635 then dec TotallyNotJson.851; - let TotallyNotJson.1610 : Str = "k"; - ret TotallyNotJson.1610; + let TotallyNotJson.1587 : Str = "k"; + ret TotallyNotJson.1587; else - let TotallyNotJson.1655 : Str = "L"; - let TotallyNotJson.1656 : Int1 = lowlevel Eq TotallyNotJson.1655 TotallyNotJson.851; - dec TotallyNotJson.1655; - if TotallyNotJson.1656 then + let TotallyNotJson.1632 : Str = "L"; + let TotallyNotJson.1633 : Int1 = lowlevel Eq TotallyNotJson.1632 TotallyNotJson.851; + dec TotallyNotJson.1632; + if TotallyNotJson.1633 then dec TotallyNotJson.851; - let TotallyNotJson.1611 : Str = "l"; - ret TotallyNotJson.1611; + let TotallyNotJson.1588 : Str = "l"; + ret TotallyNotJson.1588; else - let TotallyNotJson.1653 : Str = "M"; - let TotallyNotJson.1654 : Int1 = lowlevel Eq TotallyNotJson.1653 TotallyNotJson.851; - dec TotallyNotJson.1653; - if TotallyNotJson.1654 then + let TotallyNotJson.1630 : Str = "M"; + let TotallyNotJson.1631 : Int1 = lowlevel Eq TotallyNotJson.1630 TotallyNotJson.851; + dec TotallyNotJson.1630; + if TotallyNotJson.1631 then dec TotallyNotJson.851; - let TotallyNotJson.1612 : Str = "m"; - ret TotallyNotJson.1612; + let TotallyNotJson.1589 : Str = "m"; + ret TotallyNotJson.1589; else - let TotallyNotJson.1651 : Str = "N"; - let TotallyNotJson.1652 : Int1 = lowlevel Eq TotallyNotJson.1651 TotallyNotJson.851; - dec TotallyNotJson.1651; - if TotallyNotJson.1652 then + let TotallyNotJson.1628 : Str = "N"; + let TotallyNotJson.1629 : Int1 = lowlevel Eq TotallyNotJson.1628 TotallyNotJson.851; + dec TotallyNotJson.1628; + if TotallyNotJson.1629 then dec TotallyNotJson.851; - let TotallyNotJson.1613 : Str = "n"; - ret TotallyNotJson.1613; + let TotallyNotJson.1590 : Str = "n"; + ret TotallyNotJson.1590; else - let TotallyNotJson.1649 : Str = "O"; - let TotallyNotJson.1650 : Int1 = lowlevel Eq TotallyNotJson.1649 TotallyNotJson.851; - dec TotallyNotJson.1649; - if TotallyNotJson.1650 then + let TotallyNotJson.1626 : Str = "O"; + let TotallyNotJson.1627 : Int1 = lowlevel Eq TotallyNotJson.1626 TotallyNotJson.851; + dec TotallyNotJson.1626; + if TotallyNotJson.1627 then dec TotallyNotJson.851; - let TotallyNotJson.1614 : Str = "o"; - ret TotallyNotJson.1614; + let TotallyNotJson.1591 : Str = "o"; + ret TotallyNotJson.1591; else - let TotallyNotJson.1647 : Str = "P"; - let TotallyNotJson.1648 : Int1 = lowlevel Eq TotallyNotJson.1647 TotallyNotJson.851; - dec TotallyNotJson.1647; - if TotallyNotJson.1648 then + let TotallyNotJson.1624 : Str = "P"; + let TotallyNotJson.1625 : Int1 = lowlevel Eq TotallyNotJson.1624 TotallyNotJson.851; + dec TotallyNotJson.1624; + if TotallyNotJson.1625 then dec TotallyNotJson.851; - let TotallyNotJson.1615 : Str = "p"; - ret TotallyNotJson.1615; + let TotallyNotJson.1592 : Str = "p"; + ret TotallyNotJson.1592; else - let TotallyNotJson.1645 : Str = "Q"; - let TotallyNotJson.1646 : Int1 = lowlevel Eq TotallyNotJson.1645 TotallyNotJson.851; - dec TotallyNotJson.1645; - if TotallyNotJson.1646 then + let TotallyNotJson.1622 : Str = "Q"; + let TotallyNotJson.1623 : Int1 = lowlevel Eq TotallyNotJson.1622 TotallyNotJson.851; + dec TotallyNotJson.1622; + if TotallyNotJson.1623 then dec TotallyNotJson.851; - let TotallyNotJson.1616 : Str = "q"; - ret TotallyNotJson.1616; + let TotallyNotJson.1593 : Str = "q"; + ret TotallyNotJson.1593; else - let TotallyNotJson.1643 : Str = "R"; - let TotallyNotJson.1644 : Int1 = lowlevel Eq TotallyNotJson.1643 TotallyNotJson.851; - dec TotallyNotJson.1643; - if TotallyNotJson.1644 then + let TotallyNotJson.1620 : Str = "R"; + let TotallyNotJson.1621 : Int1 = lowlevel Eq TotallyNotJson.1620 TotallyNotJson.851; + dec TotallyNotJson.1620; + if TotallyNotJson.1621 then dec TotallyNotJson.851; - let TotallyNotJson.1617 : Str = "r"; - ret TotallyNotJson.1617; + let TotallyNotJson.1594 : Str = "r"; + ret TotallyNotJson.1594; else - let TotallyNotJson.1641 : Str = "S"; - let TotallyNotJson.1642 : Int1 = lowlevel Eq TotallyNotJson.1641 TotallyNotJson.851; - dec TotallyNotJson.1641; - if TotallyNotJson.1642 then + let TotallyNotJson.1618 : Str = "S"; + let TotallyNotJson.1619 : Int1 = lowlevel Eq TotallyNotJson.1618 TotallyNotJson.851; + dec TotallyNotJson.1618; + if TotallyNotJson.1619 then dec TotallyNotJson.851; - let TotallyNotJson.1618 : Str = "s"; - ret TotallyNotJson.1618; + let TotallyNotJson.1595 : Str = "s"; + ret TotallyNotJson.1595; else - let TotallyNotJson.1639 : Str = "T"; - let TotallyNotJson.1640 : Int1 = lowlevel Eq TotallyNotJson.1639 TotallyNotJson.851; - dec TotallyNotJson.1639; - if TotallyNotJson.1640 then + let TotallyNotJson.1616 : Str = "T"; + let TotallyNotJson.1617 : Int1 = lowlevel Eq TotallyNotJson.1616 TotallyNotJson.851; + dec TotallyNotJson.1616; + if TotallyNotJson.1617 then dec TotallyNotJson.851; - let TotallyNotJson.1619 : Str = "t"; - ret TotallyNotJson.1619; + let TotallyNotJson.1596 : Str = "t"; + ret TotallyNotJson.1596; else - let TotallyNotJson.1637 : Str = "U"; - let TotallyNotJson.1638 : Int1 = lowlevel Eq TotallyNotJson.1637 TotallyNotJson.851; - dec TotallyNotJson.1637; - if TotallyNotJson.1638 then + let TotallyNotJson.1614 : Str = "U"; + let TotallyNotJson.1615 : Int1 = lowlevel Eq TotallyNotJson.1614 TotallyNotJson.851; + dec TotallyNotJson.1614; + if TotallyNotJson.1615 then dec TotallyNotJson.851; - let TotallyNotJson.1620 : Str = "u"; - ret TotallyNotJson.1620; + let TotallyNotJson.1597 : Str = "u"; + ret TotallyNotJson.1597; else - let TotallyNotJson.1635 : Str = "V"; - let TotallyNotJson.1636 : Int1 = lowlevel Eq TotallyNotJson.1635 TotallyNotJson.851; - dec TotallyNotJson.1635; - if TotallyNotJson.1636 then + let TotallyNotJson.1612 : Str = "V"; + let TotallyNotJson.1613 : Int1 = lowlevel Eq TotallyNotJson.1612 TotallyNotJson.851; + dec TotallyNotJson.1612; + if TotallyNotJson.1613 then dec TotallyNotJson.851; - let TotallyNotJson.1621 : Str = "v"; - ret TotallyNotJson.1621; + let TotallyNotJson.1598 : Str = "v"; + ret TotallyNotJson.1598; else - let TotallyNotJson.1633 : Str = "W"; - let TotallyNotJson.1634 : Int1 = lowlevel Eq TotallyNotJson.1633 TotallyNotJson.851; - dec TotallyNotJson.1633; - if TotallyNotJson.1634 then + let TotallyNotJson.1610 : Str = "W"; + let TotallyNotJson.1611 : Int1 = lowlevel Eq TotallyNotJson.1610 TotallyNotJson.851; + dec TotallyNotJson.1610; + if TotallyNotJson.1611 then dec TotallyNotJson.851; - let TotallyNotJson.1622 : Str = "w"; - ret TotallyNotJson.1622; + let TotallyNotJson.1599 : Str = "w"; + ret TotallyNotJson.1599; else - let TotallyNotJson.1631 : Str = "X"; - let TotallyNotJson.1632 : Int1 = lowlevel Eq TotallyNotJson.1631 TotallyNotJson.851; - dec TotallyNotJson.1631; - if TotallyNotJson.1632 then + let TotallyNotJson.1608 : Str = "X"; + let TotallyNotJson.1609 : Int1 = lowlevel Eq TotallyNotJson.1608 TotallyNotJson.851; + dec TotallyNotJson.1608; + if TotallyNotJson.1609 then dec TotallyNotJson.851; - let TotallyNotJson.1623 : Str = "x"; - ret TotallyNotJson.1623; + let TotallyNotJson.1600 : Str = "x"; + ret TotallyNotJson.1600; else - let TotallyNotJson.1629 : Str = "Y"; - let TotallyNotJson.1630 : Int1 = lowlevel Eq TotallyNotJson.1629 TotallyNotJson.851; - dec TotallyNotJson.1629; - if TotallyNotJson.1630 then + let TotallyNotJson.1606 : Str = "Y"; + let TotallyNotJson.1607 : Int1 = lowlevel Eq TotallyNotJson.1606 TotallyNotJson.851; + dec TotallyNotJson.1606; + if TotallyNotJson.1607 then dec TotallyNotJson.851; - let TotallyNotJson.1624 : Str = "y"; - ret TotallyNotJson.1624; + let TotallyNotJson.1601 : Str = "y"; + ret TotallyNotJson.1601; else - let TotallyNotJson.1627 : Str = "Z"; - let TotallyNotJson.1628 : Int1 = lowlevel Eq TotallyNotJson.1627 TotallyNotJson.851; - dec TotallyNotJson.1627; - if TotallyNotJson.1628 then + let TotallyNotJson.1604 : Str = "Z"; + let TotallyNotJson.1605 : Int1 = lowlevel Eq TotallyNotJson.1604 TotallyNotJson.851; + dec TotallyNotJson.1604; + if TotallyNotJson.1605 then dec TotallyNotJson.851; - let TotallyNotJson.1625 : Str = "z"; - ret TotallyNotJson.1625; + let TotallyNotJson.1602 : Str = "z"; + ret TotallyNotJson.1602; else ret TotallyNotJson.851; procedure TotallyNotJson.102 (TotallyNotJson.852): - let TotallyNotJson.1764 : Str = "A"; - let TotallyNotJson.1765 : Int1 = lowlevel Eq TotallyNotJson.1764 TotallyNotJson.852; - dec TotallyNotJson.1764; - if TotallyNotJson.1765 then + let TotallyNotJson.1741 : Str = "A"; + let TotallyNotJson.1742 : Int1 = lowlevel Eq TotallyNotJson.1741 TotallyNotJson.852; + dec TotallyNotJson.1741; + if TotallyNotJson.1742 then dec TotallyNotJson.852; - let TotallyNotJson.1687 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1687; + let TotallyNotJson.1664 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1664; else - let TotallyNotJson.1762 : Str = "B"; - let TotallyNotJson.1763 : Int1 = lowlevel Eq TotallyNotJson.1762 TotallyNotJson.852; - dec TotallyNotJson.1762; - if TotallyNotJson.1763 then + let TotallyNotJson.1739 : Str = "B"; + let TotallyNotJson.1740 : Int1 = lowlevel Eq TotallyNotJson.1739 TotallyNotJson.852; + dec TotallyNotJson.1739; + if TotallyNotJson.1740 then dec TotallyNotJson.852; - let TotallyNotJson.1688 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1688; + let TotallyNotJson.1665 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1665; else - let TotallyNotJson.1760 : Str = "C"; - let TotallyNotJson.1761 : Int1 = lowlevel Eq TotallyNotJson.1760 TotallyNotJson.852; - dec TotallyNotJson.1760; - if TotallyNotJson.1761 then + let TotallyNotJson.1737 : Str = "C"; + let TotallyNotJson.1738 : Int1 = lowlevel Eq TotallyNotJson.1737 TotallyNotJson.852; + dec TotallyNotJson.1737; + if TotallyNotJson.1738 then dec TotallyNotJson.852; - let TotallyNotJson.1689 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1689; + let TotallyNotJson.1666 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1666; else - let TotallyNotJson.1758 : Str = "D"; - let TotallyNotJson.1759 : Int1 = lowlevel Eq TotallyNotJson.1758 TotallyNotJson.852; - dec TotallyNotJson.1758; - if TotallyNotJson.1759 then + let TotallyNotJson.1735 : Str = "D"; + let TotallyNotJson.1736 : Int1 = lowlevel Eq TotallyNotJson.1735 TotallyNotJson.852; + dec TotallyNotJson.1735; + if TotallyNotJson.1736 then dec TotallyNotJson.852; - let TotallyNotJson.1690 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1690; + let TotallyNotJson.1667 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1667; else - let TotallyNotJson.1756 : Str = "E"; - let TotallyNotJson.1757 : Int1 = lowlevel Eq TotallyNotJson.1756 TotallyNotJson.852; - dec TotallyNotJson.1756; - if TotallyNotJson.1757 then + let TotallyNotJson.1733 : Str = "E"; + let TotallyNotJson.1734 : Int1 = lowlevel Eq TotallyNotJson.1733 TotallyNotJson.852; + dec TotallyNotJson.1733; + if TotallyNotJson.1734 then dec TotallyNotJson.852; - let TotallyNotJson.1691 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1691; + let TotallyNotJson.1668 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1668; else - let TotallyNotJson.1754 : Str = "F"; - let TotallyNotJson.1755 : Int1 = lowlevel Eq TotallyNotJson.1754 TotallyNotJson.852; - dec TotallyNotJson.1754; - if TotallyNotJson.1755 then + let TotallyNotJson.1731 : Str = "F"; + let TotallyNotJson.1732 : Int1 = lowlevel Eq TotallyNotJson.1731 TotallyNotJson.852; + dec TotallyNotJson.1731; + if TotallyNotJson.1732 then dec TotallyNotJson.852; - let TotallyNotJson.1692 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1692; + let TotallyNotJson.1669 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1669; else - let TotallyNotJson.1752 : Str = "G"; - let TotallyNotJson.1753 : Int1 = lowlevel Eq TotallyNotJson.1752 TotallyNotJson.852; - dec TotallyNotJson.1752; - if TotallyNotJson.1753 then + let TotallyNotJson.1729 : Str = "G"; + let TotallyNotJson.1730 : Int1 = lowlevel Eq TotallyNotJson.1729 TotallyNotJson.852; + dec TotallyNotJson.1729; + if TotallyNotJson.1730 then dec TotallyNotJson.852; - let TotallyNotJson.1693 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1693; + let TotallyNotJson.1670 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1670; else - let TotallyNotJson.1750 : Str = "H"; - let TotallyNotJson.1751 : Int1 = lowlevel Eq TotallyNotJson.1750 TotallyNotJson.852; - dec TotallyNotJson.1750; - if TotallyNotJson.1751 then + let TotallyNotJson.1727 : Str = "H"; + let TotallyNotJson.1728 : Int1 = lowlevel Eq TotallyNotJson.1727 TotallyNotJson.852; + dec TotallyNotJson.1727; + if TotallyNotJson.1728 then dec TotallyNotJson.852; - let TotallyNotJson.1694 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1694; + let TotallyNotJson.1671 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1671; else - let TotallyNotJson.1748 : Str = "I"; - let TotallyNotJson.1749 : Int1 = lowlevel Eq TotallyNotJson.1748 TotallyNotJson.852; - dec TotallyNotJson.1748; - if TotallyNotJson.1749 then + let TotallyNotJson.1725 : Str = "I"; + let TotallyNotJson.1726 : Int1 = lowlevel Eq TotallyNotJson.1725 TotallyNotJson.852; + dec TotallyNotJson.1725; + if TotallyNotJson.1726 then dec TotallyNotJson.852; - let TotallyNotJson.1695 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1695; + let TotallyNotJson.1672 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1672; else - let TotallyNotJson.1746 : Str = "J"; - let TotallyNotJson.1747 : Int1 = lowlevel Eq TotallyNotJson.1746 TotallyNotJson.852; - dec TotallyNotJson.1746; - if TotallyNotJson.1747 then + let TotallyNotJson.1723 : Str = "J"; + let TotallyNotJson.1724 : Int1 = lowlevel Eq TotallyNotJson.1723 TotallyNotJson.852; + dec TotallyNotJson.1723; + if TotallyNotJson.1724 then dec TotallyNotJson.852; - let TotallyNotJson.1696 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1696; + let TotallyNotJson.1673 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1673; else - let TotallyNotJson.1744 : Str = "K"; - let TotallyNotJson.1745 : Int1 = lowlevel Eq TotallyNotJson.1744 TotallyNotJson.852; - dec TotallyNotJson.1744; - if TotallyNotJson.1745 then + let TotallyNotJson.1721 : Str = "K"; + let TotallyNotJson.1722 : Int1 = lowlevel Eq TotallyNotJson.1721 TotallyNotJson.852; + dec TotallyNotJson.1721; + if TotallyNotJson.1722 then dec TotallyNotJson.852; - let TotallyNotJson.1697 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1697; + let TotallyNotJson.1674 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1674; else - let TotallyNotJson.1742 : Str = "L"; - let TotallyNotJson.1743 : Int1 = lowlevel Eq TotallyNotJson.1742 TotallyNotJson.852; - dec TotallyNotJson.1742; - if TotallyNotJson.1743 then + let TotallyNotJson.1719 : Str = "L"; + let TotallyNotJson.1720 : Int1 = lowlevel Eq TotallyNotJson.1719 TotallyNotJson.852; + dec TotallyNotJson.1719; + if TotallyNotJson.1720 then dec TotallyNotJson.852; - let TotallyNotJson.1698 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1698; + let TotallyNotJson.1675 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1675; else - let TotallyNotJson.1740 : Str = "M"; - let TotallyNotJson.1741 : Int1 = lowlevel Eq TotallyNotJson.1740 TotallyNotJson.852; - dec TotallyNotJson.1740; - if TotallyNotJson.1741 then + let TotallyNotJson.1717 : Str = "M"; + let TotallyNotJson.1718 : Int1 = lowlevel Eq TotallyNotJson.1717 TotallyNotJson.852; + dec TotallyNotJson.1717; + if TotallyNotJson.1718 then dec TotallyNotJson.852; - let TotallyNotJson.1699 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1699; + let TotallyNotJson.1676 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1676; else - let TotallyNotJson.1738 : Str = "N"; - let TotallyNotJson.1739 : Int1 = lowlevel Eq TotallyNotJson.1738 TotallyNotJson.852; - dec TotallyNotJson.1738; - if TotallyNotJson.1739 then + let TotallyNotJson.1715 : Str = "N"; + let TotallyNotJson.1716 : Int1 = lowlevel Eq TotallyNotJson.1715 TotallyNotJson.852; + dec TotallyNotJson.1715; + if TotallyNotJson.1716 then dec TotallyNotJson.852; - let TotallyNotJson.1700 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1700; + let TotallyNotJson.1677 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1677; else - let TotallyNotJson.1736 : Str = "O"; - let TotallyNotJson.1737 : Int1 = lowlevel Eq TotallyNotJson.1736 TotallyNotJson.852; - dec TotallyNotJson.1736; - if TotallyNotJson.1737 then + let TotallyNotJson.1713 : Str = "O"; + let TotallyNotJson.1714 : Int1 = lowlevel Eq TotallyNotJson.1713 TotallyNotJson.852; + dec TotallyNotJson.1713; + if TotallyNotJson.1714 then dec TotallyNotJson.852; - let TotallyNotJson.1701 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1701; + let TotallyNotJson.1678 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1678; else - let TotallyNotJson.1734 : Str = "P"; - let TotallyNotJson.1735 : Int1 = lowlevel Eq TotallyNotJson.1734 TotallyNotJson.852; - dec TotallyNotJson.1734; - if TotallyNotJson.1735 then + let TotallyNotJson.1711 : Str = "P"; + let TotallyNotJson.1712 : Int1 = lowlevel Eq TotallyNotJson.1711 TotallyNotJson.852; + dec TotallyNotJson.1711; + if TotallyNotJson.1712 then dec TotallyNotJson.852; - let TotallyNotJson.1702 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1702; + let TotallyNotJson.1679 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1679; else - let TotallyNotJson.1732 : Str = "Q"; - let TotallyNotJson.1733 : Int1 = lowlevel Eq TotallyNotJson.1732 TotallyNotJson.852; - dec TotallyNotJson.1732; - if TotallyNotJson.1733 then + let TotallyNotJson.1709 : Str = "Q"; + let TotallyNotJson.1710 : Int1 = lowlevel Eq TotallyNotJson.1709 TotallyNotJson.852; + dec TotallyNotJson.1709; + if TotallyNotJson.1710 then dec TotallyNotJson.852; - let TotallyNotJson.1703 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1703; + let TotallyNotJson.1680 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1680; else - let TotallyNotJson.1730 : Str = "R"; - let TotallyNotJson.1731 : Int1 = lowlevel Eq TotallyNotJson.1730 TotallyNotJson.852; - dec TotallyNotJson.1730; - if TotallyNotJson.1731 then + let TotallyNotJson.1707 : Str = "R"; + let TotallyNotJson.1708 : Int1 = lowlevel Eq TotallyNotJson.1707 TotallyNotJson.852; + dec TotallyNotJson.1707; + if TotallyNotJson.1708 then dec TotallyNotJson.852; - let TotallyNotJson.1704 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1704; + let TotallyNotJson.1681 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1681; else - let TotallyNotJson.1728 : Str = "S"; - let TotallyNotJson.1729 : Int1 = lowlevel Eq TotallyNotJson.1728 TotallyNotJson.852; - dec TotallyNotJson.1728; - if TotallyNotJson.1729 then + let TotallyNotJson.1705 : Str = "S"; + let TotallyNotJson.1706 : Int1 = lowlevel Eq TotallyNotJson.1705 TotallyNotJson.852; + dec TotallyNotJson.1705; + if TotallyNotJson.1706 then dec TotallyNotJson.852; - let TotallyNotJson.1705 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1705; + let TotallyNotJson.1682 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1682; else - let TotallyNotJson.1726 : Str = "T"; - let TotallyNotJson.1727 : Int1 = lowlevel Eq TotallyNotJson.1726 TotallyNotJson.852; - dec TotallyNotJson.1726; - if TotallyNotJson.1727 then + let TotallyNotJson.1703 : Str = "T"; + let TotallyNotJson.1704 : Int1 = lowlevel Eq TotallyNotJson.1703 TotallyNotJson.852; + dec TotallyNotJson.1703; + if TotallyNotJson.1704 then dec TotallyNotJson.852; - let TotallyNotJson.1706 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1706; + let TotallyNotJson.1683 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1683; else - let TotallyNotJson.1724 : Str = "U"; - let TotallyNotJson.1725 : Int1 = lowlevel Eq TotallyNotJson.1724 TotallyNotJson.852; - dec TotallyNotJson.1724; - if TotallyNotJson.1725 then + let TotallyNotJson.1701 : Str = "U"; + let TotallyNotJson.1702 : Int1 = lowlevel Eq TotallyNotJson.1701 TotallyNotJson.852; + dec TotallyNotJson.1701; + if TotallyNotJson.1702 then dec TotallyNotJson.852; - let TotallyNotJson.1707 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1707; + let TotallyNotJson.1684 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1684; else - let TotallyNotJson.1722 : Str = "V"; - let TotallyNotJson.1723 : Int1 = lowlevel Eq TotallyNotJson.1722 TotallyNotJson.852; - dec TotallyNotJson.1722; - if TotallyNotJson.1723 then + let TotallyNotJson.1699 : Str = "V"; + let TotallyNotJson.1700 : Int1 = lowlevel Eq TotallyNotJson.1699 TotallyNotJson.852; + dec TotallyNotJson.1699; + if TotallyNotJson.1700 then dec TotallyNotJson.852; - let TotallyNotJson.1708 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1708; + let TotallyNotJson.1685 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1685; else - let TotallyNotJson.1720 : Str = "W"; - let TotallyNotJson.1721 : Int1 = lowlevel Eq TotallyNotJson.1720 TotallyNotJson.852; - dec TotallyNotJson.1720; - if TotallyNotJson.1721 then + let TotallyNotJson.1697 : Str = "W"; + let TotallyNotJson.1698 : Int1 = lowlevel Eq TotallyNotJson.1697 TotallyNotJson.852; + dec TotallyNotJson.1697; + if TotallyNotJson.1698 then dec TotallyNotJson.852; - let TotallyNotJson.1709 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1709; + let TotallyNotJson.1686 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1686; else - let TotallyNotJson.1718 : Str = "X"; - let TotallyNotJson.1719 : Int1 = lowlevel Eq TotallyNotJson.1718 TotallyNotJson.852; - dec TotallyNotJson.1718; - if TotallyNotJson.1719 then + let TotallyNotJson.1695 : Str = "X"; + let TotallyNotJson.1696 : Int1 = lowlevel Eq TotallyNotJson.1695 TotallyNotJson.852; + dec TotallyNotJson.1695; + if TotallyNotJson.1696 then dec TotallyNotJson.852; - let TotallyNotJson.1710 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1710; + let TotallyNotJson.1687 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1687; else - let TotallyNotJson.1716 : Str = "Y"; - let TotallyNotJson.1717 : Int1 = lowlevel Eq TotallyNotJson.1716 TotallyNotJson.852; - dec TotallyNotJson.1716; - if TotallyNotJson.1717 then + let TotallyNotJson.1693 : Str = "Y"; + let TotallyNotJson.1694 : Int1 = lowlevel Eq TotallyNotJson.1693 TotallyNotJson.852; + dec TotallyNotJson.1693; + if TotallyNotJson.1694 then dec TotallyNotJson.852; - let TotallyNotJson.1711 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1711; + let TotallyNotJson.1688 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1688; else - let TotallyNotJson.1714 : Str = "Z"; - let TotallyNotJson.1715 : Int1 = lowlevel Eq TotallyNotJson.1714 TotallyNotJson.852; + let TotallyNotJson.1691 : Str = "Z"; + let TotallyNotJson.1692 : Int1 = lowlevel Eq TotallyNotJson.1691 TotallyNotJson.852; dec TotallyNotJson.852; - dec TotallyNotJson.1714; - if TotallyNotJson.1715 then - let TotallyNotJson.1712 : Int1 = CallByName Bool.2; - ret TotallyNotJson.1712; + dec TotallyNotJson.1691; + if TotallyNotJson.1692 then + let TotallyNotJson.1689 : Int1 = CallByName Bool.2; + ret TotallyNotJson.1689; else - let TotallyNotJson.1713 : Int1 = CallByName Bool.1; - ret TotallyNotJson.1713; + let TotallyNotJson.1690 : Int1 = CallByName Bool.1; + ret TotallyNotJson.1690; -procedure TotallyNotJson.182 (TotallyNotJson.183, TotallyNotJson.1902, TotallyNotJson.181): - let TotallyNotJson.1905 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.181; - let TotallyNotJson.1904 : List U8 = CallByName List.8 TotallyNotJson.183 TotallyNotJson.1905; - ret TotallyNotJson.1904; +procedure TotallyNotJson.182 (TotallyNotJson.183, TotallyNotJson.1879, TotallyNotJson.181): + let TotallyNotJson.1882 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.181; + let TotallyNotJson.1881 : List U8 = CallByName List.8 TotallyNotJson.183 TotallyNotJson.1882; + ret TotallyNotJson.1881; -procedure TotallyNotJson.189 (TotallyNotJson.1953, TotallyNotJson.192): - let TotallyNotJson.190 : U64 = StructAtIndex 0 TotallyNotJson.1953; - let TotallyNotJson.191 : Int1 = StructAtIndex 1 TotallyNotJson.1953; +procedure TotallyNotJson.189 (TotallyNotJson.1930, TotallyNotJson.192): + let TotallyNotJson.190 : U64 = StructAtIndex 0 TotallyNotJson.1930; + let TotallyNotJson.191 : Int1 = StructAtIndex 1 TotallyNotJson.1930; switch TotallyNotJson.192: case 34: - let TotallyNotJson.1956 : Int1 = false; - let TotallyNotJson.1955 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1956}; - let TotallyNotJson.1954 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1955; - ret TotallyNotJson.1954; + let TotallyNotJson.1933 : Int1 = false; + let TotallyNotJson.1932 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1933}; + let TotallyNotJson.1931 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1932; + ret TotallyNotJson.1931; case 92: - let TotallyNotJson.1959 : Int1 = false; - let TotallyNotJson.1958 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1959}; - let TotallyNotJson.1957 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1958; - ret TotallyNotJson.1957; + let TotallyNotJson.1936 : Int1 = false; + let TotallyNotJson.1935 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1936}; + let TotallyNotJson.1934 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1935; + ret TotallyNotJson.1934; case 47: - let TotallyNotJson.1962 : Int1 = false; - let TotallyNotJson.1961 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1962}; - let TotallyNotJson.1960 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1961; - ret TotallyNotJson.1960; + let TotallyNotJson.1939 : Int1 = false; + let TotallyNotJson.1938 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1939}; + let TotallyNotJson.1937 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1938; + ret TotallyNotJson.1937; case 8: - let TotallyNotJson.1965 : Int1 = false; - let TotallyNotJson.1964 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1965}; - let TotallyNotJson.1963 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1964; - ret TotallyNotJson.1963; + let TotallyNotJson.1942 : Int1 = false; + let TotallyNotJson.1941 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1942}; + let TotallyNotJson.1940 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1941; + ret TotallyNotJson.1940; case 12: - let TotallyNotJson.1968 : Int1 = false; - let TotallyNotJson.1967 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1968}; - let TotallyNotJson.1966 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1967; - ret TotallyNotJson.1966; + let TotallyNotJson.1945 : Int1 = false; + let TotallyNotJson.1944 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1945}; + let TotallyNotJson.1943 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1944; + ret TotallyNotJson.1943; case 10: - let TotallyNotJson.1971 : Int1 = false; - let TotallyNotJson.1970 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1971}; - let TotallyNotJson.1969 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1970; - ret TotallyNotJson.1969; + let TotallyNotJson.1948 : Int1 = false; + let TotallyNotJson.1947 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1948}; + let TotallyNotJson.1946 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1947; + ret TotallyNotJson.1946; case 13: - let TotallyNotJson.1974 : Int1 = false; - let TotallyNotJson.1973 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1974}; - let TotallyNotJson.1972 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1973; - ret TotallyNotJson.1972; + let TotallyNotJson.1951 : Int1 = false; + let TotallyNotJson.1950 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1951}; + let TotallyNotJson.1949 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1950; + ret TotallyNotJson.1949; case 9: - let TotallyNotJson.1977 : Int1 = false; - let TotallyNotJson.1976 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1977}; - let TotallyNotJson.1975 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1976; - ret TotallyNotJson.1975; + let TotallyNotJson.1954 : Int1 = false; + let TotallyNotJson.1953 : {U64, Int1} = Struct {TotallyNotJson.190, TotallyNotJson.1954}; + let TotallyNotJson.1952 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) TotallyNotJson.1953; + ret TotallyNotJson.1952; default: - let TotallyNotJson.1981 : U64 = 1i64; - let TotallyNotJson.1980 : U64 = CallByName Num.19 TotallyNotJson.190 TotallyNotJson.1981; - let TotallyNotJson.1979 : {U64, Int1} = Struct {TotallyNotJson.1980, TotallyNotJson.191}; - let TotallyNotJson.1978 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) TotallyNotJson.1979; - ret TotallyNotJson.1978; + let TotallyNotJson.1958 : U64 = 1i64; + let TotallyNotJson.1957 : U64 = CallByName Num.19 TotallyNotJson.190 TotallyNotJson.1958; + let TotallyNotJson.1956 : {U64, Int1} = Struct {TotallyNotJson.1957, TotallyNotJson.191}; + let TotallyNotJson.1955 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) TotallyNotJson.1956; + ret TotallyNotJson.1955; procedure TotallyNotJson.2 (): @@ -1098,9 +1098,9 @@ procedure TotallyNotJson.2 (): ret TotallyNotJson.1172; procedure TotallyNotJson.215 (TotallyNotJson.216, TotallyNotJson.217): - let TotallyNotJson.1924 : List U8 = CallByName TotallyNotJson.27 TotallyNotJson.217; - let TotallyNotJson.1923 : List U8 = CallByName List.8 TotallyNotJson.216 TotallyNotJson.1924; - ret TotallyNotJson.1923; + let TotallyNotJson.1901 : List U8 = CallByName TotallyNotJson.27 TotallyNotJson.217; + let TotallyNotJson.1900 : List U8 = CallByName List.8 TotallyNotJson.216 TotallyNotJson.1901; + ret TotallyNotJson.1900; procedure TotallyNotJson.234 (TotallyNotJson.235, TotallyNotJson.1175, TotallyNotJson.233): let TotallyNotJson.1525 : I64 = 123i64; @@ -1116,17 +1116,17 @@ procedure TotallyNotJson.234 (TotallyNotJson.235, TotallyNotJson.1175, TotallyNo ret TotallyNotJson.1179; procedure TotallyNotJson.234 (TotallyNotJson.235, TotallyNotJson.1175, TotallyNotJson.233): - let TotallyNotJson.1899 : I64 = 123i64; - let TotallyNotJson.1898 : U8 = CallByName Num.127 TotallyNotJson.1899; - let TotallyNotJson.238 : List U8 = CallByName List.4 TotallyNotJson.235 TotallyNotJson.1898; - let TotallyNotJson.1897 : U64 = CallByName List.6 TotallyNotJson.233; - let TotallyNotJson.1557 : {List U8, U64} = Struct {TotallyNotJson.238, TotallyNotJson.1897}; - let TotallyNotJson.1556 : {List U8, U64} = CallByName List.18 TotallyNotJson.233 TotallyNotJson.1557 TotallyNotJson.1175; - let TotallyNotJson.240 : List U8 = StructAtIndex 0 TotallyNotJson.1556; - let TotallyNotJson.1555 : I64 = 125i64; - let TotallyNotJson.1554 : U8 = CallByName Num.127 TotallyNotJson.1555; - let TotallyNotJson.1553 : List U8 = CallByName List.4 TotallyNotJson.240 TotallyNotJson.1554; - ret TotallyNotJson.1553; + let TotallyNotJson.1876 : I64 = 123i64; + let TotallyNotJson.1875 : U8 = CallByName Num.127 TotallyNotJson.1876; + let TotallyNotJson.238 : List U8 = CallByName List.4 TotallyNotJson.235 TotallyNotJson.1875; + let TotallyNotJson.1874 : U64 = CallByName List.6 TotallyNotJson.233; + let TotallyNotJson.1534 : {List U8, U64} = Struct {TotallyNotJson.238, TotallyNotJson.1874}; + let TotallyNotJson.1533 : {List U8, U64} = CallByName List.18 TotallyNotJson.233 TotallyNotJson.1534 TotallyNotJson.1175; + let TotallyNotJson.240 : List U8 = StructAtIndex 0 TotallyNotJson.1533; + let TotallyNotJson.1532 : I64 = 125i64; + let TotallyNotJson.1531 : U8 = CallByName Num.127 TotallyNotJson.1532; + let TotallyNotJson.1530 : List U8 = CallByName List.4 TotallyNotJson.240 TotallyNotJson.1531; + ret TotallyNotJson.1530; procedure TotallyNotJson.237 (TotallyNotJson.1177, TotallyNotJson.1178, TotallyNotJson.236): let TotallyNotJson.243 : Str = StructAtIndex 0 TotallyNotJson.1178; @@ -1168,128 +1168,128 @@ procedure TotallyNotJson.237 (TotallyNotJson.1177, TotallyNotJson.1178, TotallyN let TotallyNotJson.241 : List U8 = StructAtIndex 0 TotallyNotJson.1177; let TotallyNotJson.242 : U64 = StructAtIndex 1 TotallyNotJson.1177; let TotallyNotJson.245 : Str = CallByName TotallyNotJson.82 TotallyNotJson.243 TotallyNotJson.236; - let TotallyNotJson.1579 : I64 = 34i64; - let TotallyNotJson.1578 : U8 = CallByName Num.127 TotallyNotJson.1579; - let TotallyNotJson.1576 : List U8 = CallByName List.4 TotallyNotJson.241 TotallyNotJson.1578; - let TotallyNotJson.1577 : List U8 = CallByName Str.12 TotallyNotJson.245; - let TotallyNotJson.1573 : List U8 = CallByName List.8 TotallyNotJson.1576 TotallyNotJson.1577; - let TotallyNotJson.1575 : I64 = 34i64; - let TotallyNotJson.1574 : U8 = CallByName Num.127 TotallyNotJson.1575; - let TotallyNotJson.1570 : List U8 = CallByName List.4 TotallyNotJson.1573 TotallyNotJson.1574; - let TotallyNotJson.1572 : I64 = 58i64; - let TotallyNotJson.1571 : U8 = CallByName Num.127 TotallyNotJson.1572; - let TotallyNotJson.1568 : List U8 = CallByName List.4 TotallyNotJson.1570 TotallyNotJson.1571; - let TotallyNotJson.246 : List U8 = CallByName Encode.24 TotallyNotJson.1568 TotallyNotJson.244 TotallyNotJson.236; - joinpoint TotallyNotJson.1563 TotallyNotJson.247: - let TotallyNotJson.1561 : U64 = 1i64; - let TotallyNotJson.1560 : U64 = CallByName Num.20 TotallyNotJson.242 TotallyNotJson.1561; - let TotallyNotJson.1559 : {List U8, U64} = Struct {TotallyNotJson.247, TotallyNotJson.1560}; - ret TotallyNotJson.1559; + let TotallyNotJson.1556 : I64 = 34i64; + let TotallyNotJson.1555 : U8 = CallByName Num.127 TotallyNotJson.1556; + let TotallyNotJson.1553 : List U8 = CallByName List.4 TotallyNotJson.241 TotallyNotJson.1555; + let TotallyNotJson.1554 : List U8 = CallByName Str.12 TotallyNotJson.245; + let TotallyNotJson.1550 : List U8 = CallByName List.8 TotallyNotJson.1553 TotallyNotJson.1554; + let TotallyNotJson.1552 : I64 = 34i64; + let TotallyNotJson.1551 : U8 = CallByName Num.127 TotallyNotJson.1552; + let TotallyNotJson.1547 : List U8 = CallByName List.4 TotallyNotJson.1550 TotallyNotJson.1551; + let TotallyNotJson.1549 : I64 = 58i64; + let TotallyNotJson.1548 : U8 = CallByName Num.127 TotallyNotJson.1549; + let TotallyNotJson.1545 : List U8 = CallByName List.4 TotallyNotJson.1547 TotallyNotJson.1548; + let TotallyNotJson.246 : List U8 = CallByName Encode.24 TotallyNotJson.1545 TotallyNotJson.244 TotallyNotJson.236; + joinpoint TotallyNotJson.1540 TotallyNotJson.247: + let TotallyNotJson.1538 : U64 = 1i64; + let TotallyNotJson.1537 : U64 = CallByName Num.20 TotallyNotJson.242 TotallyNotJson.1538; + let TotallyNotJson.1536 : {List U8, U64} = Struct {TotallyNotJson.247, TotallyNotJson.1537}; + ret TotallyNotJson.1536; in - let TotallyNotJson.1567 : U64 = 1i64; - let TotallyNotJson.1564 : Int1 = CallByName Num.24 TotallyNotJson.242 TotallyNotJson.1567; - if TotallyNotJson.1564 then - let TotallyNotJson.1566 : I64 = 44i64; - let TotallyNotJson.1565 : U8 = CallByName Num.127 TotallyNotJson.1566; - let TotallyNotJson.1562 : List U8 = CallByName List.4 TotallyNotJson.246 TotallyNotJson.1565; - jump TotallyNotJson.1563 TotallyNotJson.1562; + let TotallyNotJson.1544 : U64 = 1i64; + let TotallyNotJson.1541 : Int1 = CallByName Num.24 TotallyNotJson.242 TotallyNotJson.1544; + if TotallyNotJson.1541 then + let TotallyNotJson.1543 : I64 = 44i64; + let TotallyNotJson.1542 : U8 = CallByName Num.127 TotallyNotJson.1543; + let TotallyNotJson.1539 : List U8 = CallByName List.4 TotallyNotJson.246 TotallyNotJson.1542; + jump TotallyNotJson.1540 TotallyNotJson.1539; else - jump TotallyNotJson.1563 TotallyNotJson.246; + jump TotallyNotJson.1540 TotallyNotJson.246; procedure TotallyNotJson.25 (TotallyNotJson.181): - let TotallyNotJson.1900 : Str = CallByName Encode.23 TotallyNotJson.181; - ret TotallyNotJson.1900; + let TotallyNotJson.1877 : Str = CallByName Encode.23 TotallyNotJson.181; + ret TotallyNotJson.1877; procedure TotallyNotJson.26 (TotallyNotJson.184): let TotallyNotJson.185 : List U8 = CallByName Str.12 TotallyNotJson.184; - let TotallyNotJson.1982 : U64 = 0i64; - let TotallyNotJson.1983 : Int1 = true; - let TotallyNotJson.186 : {U64, Int1} = Struct {TotallyNotJson.1982, TotallyNotJson.1983}; - let TotallyNotJson.1952 : {} = Struct {}; + let TotallyNotJson.1959 : U64 = 0i64; + let TotallyNotJson.1960 : Int1 = true; + let TotallyNotJson.186 : {U64, Int1} = Struct {TotallyNotJson.1959, TotallyNotJson.1960}; + let TotallyNotJson.1929 : {} = Struct {}; inc TotallyNotJson.185; - let TotallyNotJson.187 : {U64, Int1} = CallByName List.26 TotallyNotJson.185 TotallyNotJson.186 TotallyNotJson.1952; - let TotallyNotJson.1906 : Int1 = StructAtIndex 1 TotallyNotJson.187; - let TotallyNotJson.1950 : Int1 = true; - let TotallyNotJson.1951 : Int1 = lowlevel Eq TotallyNotJson.1950 TotallyNotJson.1906; - if TotallyNotJson.1951 then - let TotallyNotJson.1916 : U64 = CallByName List.6 TotallyNotJson.185; - let TotallyNotJson.1917 : U64 = 2i64; - let TotallyNotJson.1915 : U64 = CallByName Num.19 TotallyNotJson.1916 TotallyNotJson.1917; - let TotallyNotJson.1912 : List U8 = CallByName List.68 TotallyNotJson.1915; - let TotallyNotJson.1914 : U8 = 34i64; - let TotallyNotJson.1913 : List U8 = Array [TotallyNotJson.1914]; - let TotallyNotJson.1911 : List U8 = CallByName List.8 TotallyNotJson.1912 TotallyNotJson.1913; - let TotallyNotJson.1908 : List U8 = CallByName List.8 TotallyNotJson.1911 TotallyNotJson.185; - let TotallyNotJson.1910 : U8 = 34i64; - let TotallyNotJson.1909 : List U8 = Array [TotallyNotJson.1910]; - let TotallyNotJson.1907 : List U8 = CallByName List.8 TotallyNotJson.1908 TotallyNotJson.1909; - ret TotallyNotJson.1907; + let TotallyNotJson.187 : {U64, Int1} = CallByName List.26 TotallyNotJson.185 TotallyNotJson.186 TotallyNotJson.1929; + let TotallyNotJson.1883 : Int1 = StructAtIndex 1 TotallyNotJson.187; + let TotallyNotJson.1927 : Int1 = true; + let TotallyNotJson.1928 : Int1 = lowlevel Eq TotallyNotJson.1927 TotallyNotJson.1883; + if TotallyNotJson.1928 then + let TotallyNotJson.1893 : U64 = CallByName List.6 TotallyNotJson.185; + let TotallyNotJson.1894 : U64 = 2i64; + let TotallyNotJson.1892 : U64 = CallByName Num.19 TotallyNotJson.1893 TotallyNotJson.1894; + let TotallyNotJson.1889 : List U8 = CallByName List.68 TotallyNotJson.1892; + let TotallyNotJson.1891 : U8 = 34i64; + let TotallyNotJson.1890 : List U8 = Array [TotallyNotJson.1891]; + let TotallyNotJson.1888 : List U8 = CallByName List.8 TotallyNotJson.1889 TotallyNotJson.1890; + let TotallyNotJson.1885 : List U8 = CallByName List.8 TotallyNotJson.1888 TotallyNotJson.185; + let TotallyNotJson.1887 : U8 = 34i64; + let TotallyNotJson.1886 : List U8 = Array [TotallyNotJson.1887]; + let TotallyNotJson.1884 : List U8 = CallByName List.8 TotallyNotJson.1885 TotallyNotJson.1886; + ret TotallyNotJson.1884; else inc TotallyNotJson.185; - let TotallyNotJson.1949 : U64 = StructAtIndex 0 TotallyNotJson.187; - let TotallyNotJson.1948 : {List U8, List U8} = CallByName List.52 TotallyNotJson.185 TotallyNotJson.1949; - let TotallyNotJson.211 : List U8 = StructAtIndex 0 TotallyNotJson.1948; - let TotallyNotJson.213 : List U8 = StructAtIndex 1 TotallyNotJson.1948; - let TotallyNotJson.1946 : U64 = CallByName List.6 TotallyNotJson.185; + let TotallyNotJson.1926 : U64 = StructAtIndex 0 TotallyNotJson.187; + let TotallyNotJson.1925 : {List U8, List U8} = CallByName List.52 TotallyNotJson.185 TotallyNotJson.1926; + let TotallyNotJson.211 : List U8 = StructAtIndex 0 TotallyNotJson.1925; + let TotallyNotJson.213 : List U8 = StructAtIndex 1 TotallyNotJson.1925; + let TotallyNotJson.1923 : U64 = CallByName List.6 TotallyNotJson.185; dec TotallyNotJson.185; - let TotallyNotJson.1947 : U64 = 120i64; - let TotallyNotJson.1944 : U64 = CallByName Num.21 TotallyNotJson.1946 TotallyNotJson.1947; - let TotallyNotJson.1945 : U64 = 100i64; - let TotallyNotJson.1943 : U64 = CallByName Num.94 TotallyNotJson.1944 TotallyNotJson.1945; - let TotallyNotJson.1940 : List U8 = CallByName List.68 TotallyNotJson.1943; - let TotallyNotJson.1942 : U8 = 34i64; - let TotallyNotJson.1941 : List U8 = Array [TotallyNotJson.1942]; - let TotallyNotJson.1939 : List U8 = CallByName List.8 TotallyNotJson.1940 TotallyNotJson.1941; - let TotallyNotJson.214 : List U8 = CallByName List.8 TotallyNotJson.1939 TotallyNotJson.211; - let TotallyNotJson.1922 : {} = Struct {}; - let TotallyNotJson.1919 : List U8 = CallByName List.18 TotallyNotJson.213 TotallyNotJson.214 TotallyNotJson.1922; - let TotallyNotJson.1921 : U8 = 34i64; - let TotallyNotJson.1920 : List U8 = Array [TotallyNotJson.1921]; - let TotallyNotJson.1918 : List U8 = CallByName List.8 TotallyNotJson.1919 TotallyNotJson.1920; - ret TotallyNotJson.1918; + let TotallyNotJson.1924 : U64 = 120i64; + let TotallyNotJson.1921 : U64 = CallByName Num.21 TotallyNotJson.1923 TotallyNotJson.1924; + let TotallyNotJson.1922 : U64 = 100i64; + let TotallyNotJson.1920 : U64 = CallByName Num.94 TotallyNotJson.1921 TotallyNotJson.1922; + let TotallyNotJson.1917 : List U8 = CallByName List.68 TotallyNotJson.1920; + let TotallyNotJson.1919 : U8 = 34i64; + let TotallyNotJson.1918 : List U8 = Array [TotallyNotJson.1919]; + let TotallyNotJson.1916 : List U8 = CallByName List.8 TotallyNotJson.1917 TotallyNotJson.1918; + let TotallyNotJson.214 : List U8 = CallByName List.8 TotallyNotJson.1916 TotallyNotJson.211; + let TotallyNotJson.1899 : {} = Struct {}; + let TotallyNotJson.1896 : List U8 = CallByName List.18 TotallyNotJson.213 TotallyNotJson.214 TotallyNotJson.1899; + let TotallyNotJson.1898 : U8 = 34i64; + let TotallyNotJson.1897 : List U8 = Array [TotallyNotJson.1898]; + let TotallyNotJson.1895 : List U8 = CallByName List.8 TotallyNotJson.1896 TotallyNotJson.1897; + ret TotallyNotJson.1895; procedure TotallyNotJson.27 (TotallyNotJson.218): switch TotallyNotJson.218: case 34: - let TotallyNotJson.1925 : List U8 = Array [92i64, 34i64]; - ret TotallyNotJson.1925; + let TotallyNotJson.1902 : List U8 = Array [92i64, 34i64]; + ret TotallyNotJson.1902; case 92: - let TotallyNotJson.1926 : List U8 = Array [92i64, 92i64]; - ret TotallyNotJson.1926; + let TotallyNotJson.1903 : List U8 = Array [92i64, 92i64]; + ret TotallyNotJson.1903; case 47: - let TotallyNotJson.1927 : List U8 = Array [92i64, 47i64]; - ret TotallyNotJson.1927; + let TotallyNotJson.1904 : List U8 = Array [92i64, 47i64]; + ret TotallyNotJson.1904; case 8: - let TotallyNotJson.1929 : U8 = 98i64; - let TotallyNotJson.1928 : List U8 = Array [92i64, TotallyNotJson.1929]; - ret TotallyNotJson.1928; + let TotallyNotJson.1906 : U8 = 98i64; + let TotallyNotJson.1905 : List U8 = Array [92i64, TotallyNotJson.1906]; + ret TotallyNotJson.1905; case 12: - let TotallyNotJson.1931 : U8 = 102i64; - let TotallyNotJson.1930 : List U8 = Array [92i64, TotallyNotJson.1931]; - ret TotallyNotJson.1930; + let TotallyNotJson.1908 : U8 = 102i64; + let TotallyNotJson.1907 : List U8 = Array [92i64, TotallyNotJson.1908]; + ret TotallyNotJson.1907; case 10: - let TotallyNotJson.1933 : U8 = 110i64; - let TotallyNotJson.1932 : List U8 = Array [92i64, TotallyNotJson.1933]; - ret TotallyNotJson.1932; + let TotallyNotJson.1910 : U8 = 110i64; + let TotallyNotJson.1909 : List U8 = Array [92i64, TotallyNotJson.1910]; + ret TotallyNotJson.1909; case 13: - let TotallyNotJson.1935 : U8 = 114i64; - let TotallyNotJson.1934 : List U8 = Array [92i64, TotallyNotJson.1935]; - ret TotallyNotJson.1934; + let TotallyNotJson.1912 : U8 = 114i64; + let TotallyNotJson.1911 : List U8 = Array [92i64, TotallyNotJson.1912]; + ret TotallyNotJson.1911; case 9: - let TotallyNotJson.1937 : U8 = 114i64; - let TotallyNotJson.1936 : List U8 = Array [92i64, TotallyNotJson.1937]; - ret TotallyNotJson.1936; + let TotallyNotJson.1914 : U8 = 114i64; + let TotallyNotJson.1913 : List U8 = Array [92i64, TotallyNotJson.1914]; + ret TotallyNotJson.1913; default: - let TotallyNotJson.1938 : List U8 = Array [TotallyNotJson.218]; - ret TotallyNotJson.1938; + let TotallyNotJson.1915 : List U8 = Array [TotallyNotJson.218]; + ret TotallyNotJson.1915; procedure TotallyNotJson.29 (TotallyNotJson.233): @@ -1297,83 +1297,83 @@ procedure TotallyNotJson.29 (TotallyNotJson.233): ret TotallyNotJson.1173; procedure TotallyNotJson.29 (TotallyNotJson.233): - let TotallyNotJson.1549 : List {Str, Str} = CallByName Encode.23 TotallyNotJson.233; - ret TotallyNotJson.1549; + let TotallyNotJson.1526 : List {Str, Str} = CallByName Encode.23 TotallyNotJson.233; + ret TotallyNotJson.1526; procedure TotallyNotJson.82 (TotallyNotJson.802, TotallyNotJson.803): - let TotallyNotJson.1896 : U8 = GetTagId TotallyNotJson.803; - switch TotallyNotJson.1896: + let TotallyNotJson.1873 : U8 = GetTagId TotallyNotJson.803; + switch TotallyNotJson.1873: case 2: ret TotallyNotJson.802; case 5: - let TotallyNotJson.1581 : Str = CallByName TotallyNotJson.87 TotallyNotJson.802; - ret TotallyNotJson.1581; + let TotallyNotJson.1558 : Str = CallByName TotallyNotJson.87 TotallyNotJson.802; + ret TotallyNotJson.1558; case 4: - let TotallyNotJson.1771 : Str = CallByName TotallyNotJson.88 TotallyNotJson.802; - ret TotallyNotJson.1771; + let TotallyNotJson.1748 : Str = CallByName TotallyNotJson.88 TotallyNotJson.802; + ret TotallyNotJson.1748; case 3: - let TotallyNotJson.1860 : Str = CallByName TotallyNotJson.89 TotallyNotJson.802; - ret TotallyNotJson.1860; + let TotallyNotJson.1837 : Str = CallByName TotallyNotJson.89 TotallyNotJson.802; + ret TotallyNotJson.1837; case 0: - let TotallyNotJson.1892 : Str = CallByName TotallyNotJson.90 TotallyNotJson.802; - ret TotallyNotJson.1892; + let TotallyNotJson.1869 : Str = CallByName TotallyNotJson.90 TotallyNotJson.802; + ret TotallyNotJson.1869; default: dec TotallyNotJson.802; let TotallyNotJson.804 : [] = UnionAtIndex (Id 1) (Index 0) TotallyNotJson.803; - let TotallyNotJson.1895 : Str = "a Lambda Set is empty. Most likely there is a type error in your program."; - Crash TotallyNotJson.1895 + let TotallyNotJson.1872 : Str = "a Lambda Set is empty. Most likely there is a type error in your program."; + Crash TotallyNotJson.1872 procedure TotallyNotJson.832 (TotallyNotJson.1493): - let TotallyNotJson.1868 : List Str = StructAtIndex 1 TotallyNotJson.1493; - let #Derived_gen.30 : List Str = StructAtIndex 0 TotallyNotJson.1493; - dec #Derived_gen.30; - ret TotallyNotJson.1868; + let TotallyNotJson.1845 : List Str = StructAtIndex 1 TotallyNotJson.1493; + let #Derived_gen.59 : List Str = StructAtIndex 0 TotallyNotJson.1493; + dec #Derived_gen.59; + ret TotallyNotJson.1845; procedure TotallyNotJson.840 (TotallyNotJson.1214): - let TotallyNotJson.1589 : List Str = StructAtIndex 1 TotallyNotJson.1214; - let #Derived_gen.28 : List Str = StructAtIndex 0 TotallyNotJson.1214; - dec #Derived_gen.28; - ret TotallyNotJson.1589; + let TotallyNotJson.1566 : List Str = StructAtIndex 1 TotallyNotJson.1214; + let #Derived_gen.57 : List Str = StructAtIndex 0 TotallyNotJson.1214; + dec #Derived_gen.57; + ret TotallyNotJson.1566; procedure TotallyNotJson.87 (TotallyNotJson.809): - let TotallyNotJson.1582 : Str = CallByName TotallyNotJson.97 TotallyNotJson.809; - ret TotallyNotJson.1582; + let TotallyNotJson.1559 : Str = CallByName TotallyNotJson.97 TotallyNotJson.809; + ret TotallyNotJson.1559; procedure TotallyNotJson.88 (TotallyNotJson.810): - let TotallyNotJson.1772 : Str = CallByName TotallyNotJson.94 TotallyNotJson.810; - ret TotallyNotJson.1772; + let TotallyNotJson.1749 : Str = CallByName TotallyNotJson.94 TotallyNotJson.810; + ret TotallyNotJson.1749; procedure TotallyNotJson.89 (TotallyNotJson.811): - let TotallyNotJson.1861 : Str = CallByName TotallyNotJson.95 TotallyNotJson.811; - ret TotallyNotJson.1861; + let TotallyNotJson.1838 : Str = CallByName TotallyNotJson.95 TotallyNotJson.811; + ret TotallyNotJson.1838; procedure TotallyNotJson.90 (TotallyNotJson.812): ret TotallyNotJson.812; procedure TotallyNotJson.94 (TotallyNotJson.824): let TotallyNotJson.825 : List Str = CallByName Str.55 TotallyNotJson.824; - let TotallyNotJson.1857 : U64 = lowlevel ListLen TotallyNotJson.825; - let TotallyNotJson.1858 : U64 = 1i64; - let TotallyNotJson.1859 : Int1 = lowlevel NumGte TotallyNotJson.1857 TotallyNotJson.1858; - if TotallyNotJson.1859 then + let TotallyNotJson.1834 : U64 = lowlevel ListLen TotallyNotJson.825; + let TotallyNotJson.1835 : U64 = 1i64; + let TotallyNotJson.1836 : Int1 = lowlevel NumGte TotallyNotJson.1834 TotallyNotJson.1835; + if TotallyNotJson.1836 then dec TotallyNotJson.824; - let TotallyNotJson.1856 : U64 = 0i64; - let TotallyNotJson.826 : Str = lowlevel ListGetUnsafe TotallyNotJson.825 TotallyNotJson.1856; + let TotallyNotJson.1833 : U64 = 0i64; + let TotallyNotJson.826 : Str = lowlevel ListGetUnsafe TotallyNotJson.825 TotallyNotJson.1833; inc TotallyNotJson.826; let TotallyNotJson.827 : Str = CallByName TotallyNotJson.100 TotallyNotJson.826; let TotallyNotJson.828 : List Str = CallByName List.38 TotallyNotJson.825; - let TotallyNotJson.1774 : List Str = CallByName List.13 TotallyNotJson.828 TotallyNotJson.827; - let TotallyNotJson.1775 : Str = ""; - let TotallyNotJson.1773 : Str = CallByName Str.4 TotallyNotJson.1774 TotallyNotJson.1775; - dec TotallyNotJson.1774; - dec TotallyNotJson.1775; - ret TotallyNotJson.1773; + let TotallyNotJson.1751 : List Str = CallByName List.13 TotallyNotJson.828 TotallyNotJson.827; + let TotallyNotJson.1752 : Str = ""; + let TotallyNotJson.1750 : Str = CallByName Str.4 TotallyNotJson.1751 TotallyNotJson.1752; + dec TotallyNotJson.1752; + dec TotallyNotJson.1751; + ret TotallyNotJson.1750; else dec TotallyNotJson.825; ret TotallyNotJson.824; @@ -1381,108 +1381,108 @@ procedure TotallyNotJson.94 (TotallyNotJson.824): procedure TotallyNotJson.95 (TotallyNotJson.829): let TotallyNotJson.830 : List Str = CallByName Str.55 TotallyNotJson.829; dec TotallyNotJson.829; - let TotallyNotJson.1891 : U64 = CallByName List.6 TotallyNotJson.830; - let TotallyNotJson.831 : List Str = CallByName List.68 TotallyNotJson.1891; - let TotallyNotJson.1869 : {List Str, List Str} = Struct {TotallyNotJson.830, TotallyNotJson.831}; - let TotallyNotJson.1865 : {List Str, List Str} = CallByName TotallyNotJson.96 TotallyNotJson.1869; - let TotallyNotJson.1866 : {} = Struct {}; - let TotallyNotJson.1863 : List Str = CallByName TotallyNotJson.832 TotallyNotJson.1865; - let TotallyNotJson.1864 : Str = ""; - let TotallyNotJson.1862 : Str = CallByName Str.4 TotallyNotJson.1863 TotallyNotJson.1864; - dec TotallyNotJson.1864; - dec TotallyNotJson.1863; - ret TotallyNotJson.1862; - -procedure TotallyNotJson.96 (TotallyNotJson.2004): - joinpoint TotallyNotJson.1870 TotallyNotJson.1168: + let TotallyNotJson.1868 : U64 = CallByName List.6 TotallyNotJson.830; + let TotallyNotJson.831 : List Str = CallByName List.68 TotallyNotJson.1868; + let TotallyNotJson.1846 : {List Str, List Str} = Struct {TotallyNotJson.830, TotallyNotJson.831}; + let TotallyNotJson.1842 : {List Str, List Str} = CallByName TotallyNotJson.96 TotallyNotJson.1846; + let TotallyNotJson.1843 : {} = Struct {}; + let TotallyNotJson.1840 : List Str = CallByName TotallyNotJson.832 TotallyNotJson.1842; + let TotallyNotJson.1841 : Str = ""; + let TotallyNotJson.1839 : Str = CallByName Str.4 TotallyNotJson.1840 TotallyNotJson.1841; + dec TotallyNotJson.1840; + dec TotallyNotJson.1841; + ret TotallyNotJson.1839; + +procedure TotallyNotJson.96 (#Derived_gen.41): + joinpoint TotallyNotJson.1847 TotallyNotJson.1168: let TotallyNotJson.834 : List Str = StructAtIndex 0 TotallyNotJson.1168; let TotallyNotJson.833 : List Str = StructAtIndex 1 TotallyNotJson.1168; - let TotallyNotJson.1888 : U64 = lowlevel ListLen TotallyNotJson.834; - let TotallyNotJson.1889 : U64 = 1i64; - let TotallyNotJson.1890 : Int1 = lowlevel NumGte TotallyNotJson.1888 TotallyNotJson.1889; - if TotallyNotJson.1890 then - let TotallyNotJson.1887 : U64 = 0i64; - let TotallyNotJson.835 : Str = lowlevel ListGetUnsafe TotallyNotJson.834 TotallyNotJson.1887; + let TotallyNotJson.1865 : U64 = lowlevel ListLen TotallyNotJson.834; + let TotallyNotJson.1866 : U64 = 1i64; + let TotallyNotJson.1867 : Int1 = lowlevel NumGte TotallyNotJson.1865 TotallyNotJson.1866; + if TotallyNotJson.1867 then + let TotallyNotJson.1864 : U64 = 0i64; + let TotallyNotJson.835 : Str = lowlevel ListGetUnsafe TotallyNotJson.834 TotallyNotJson.1864; inc 2 TotallyNotJson.835; - joinpoint TotallyNotJson.1885 TotallyNotJson.1884: - if TotallyNotJson.1884 then - let TotallyNotJson.1874 : List Str = CallByName List.38 TotallyNotJson.834; - let TotallyNotJson.1877 : Str = "-"; - let TotallyNotJson.1878 : Str = CallByName TotallyNotJson.101 TotallyNotJson.835; - let TotallyNotJson.1876 : List Str = Array [TotallyNotJson.1877, TotallyNotJson.1878]; - let TotallyNotJson.1875 : List Str = CallByName List.8 TotallyNotJson.833 TotallyNotJson.1876; - let TotallyNotJson.1873 : {List Str, List Str} = Struct {TotallyNotJson.1874, TotallyNotJson.1875}; - jump TotallyNotJson.1870 TotallyNotJson.1873; + joinpoint TotallyNotJson.1862 TotallyNotJson.1861: + if TotallyNotJson.1861 then + let TotallyNotJson.1851 : List Str = CallByName List.38 TotallyNotJson.834; + let TotallyNotJson.1854 : Str = "-"; + let TotallyNotJson.1855 : Str = CallByName TotallyNotJson.101 TotallyNotJson.835; + let TotallyNotJson.1853 : List Str = Array [TotallyNotJson.1854, TotallyNotJson.1855]; + let TotallyNotJson.1852 : List Str = CallByName List.8 TotallyNotJson.833 TotallyNotJson.1853; + let TotallyNotJson.1850 : {List Str, List Str} = Struct {TotallyNotJson.1851, TotallyNotJson.1852}; + jump TotallyNotJson.1847 TotallyNotJson.1850; else dec TotallyNotJson.835; - let TotallyNotJson.1883 : U64 = 0i64; - let TotallyNotJson.836 : Str = lowlevel ListGetUnsafe TotallyNotJson.834 TotallyNotJson.1883; + let TotallyNotJson.1860 : U64 = 0i64; + let TotallyNotJson.836 : Str = lowlevel ListGetUnsafe TotallyNotJson.834 TotallyNotJson.1860; inc TotallyNotJson.836; - let TotallyNotJson.1881 : List Str = CallByName List.38 TotallyNotJson.834; - let TotallyNotJson.1882 : List Str = CallByName List.4 TotallyNotJson.833 TotallyNotJson.836; - let TotallyNotJson.1880 : {List Str, List Str} = Struct {TotallyNotJson.1881, TotallyNotJson.1882}; - jump TotallyNotJson.1870 TotallyNotJson.1880; + let TotallyNotJson.1858 : List Str = CallByName List.38 TotallyNotJson.834; + let TotallyNotJson.1859 : List Str = CallByName List.4 TotallyNotJson.833 TotallyNotJson.836; + let TotallyNotJson.1857 : {List Str, List Str} = Struct {TotallyNotJson.1858, TotallyNotJson.1859}; + jump TotallyNotJson.1847 TotallyNotJson.1857; in - let TotallyNotJson.1886 : Int1 = CallByName TotallyNotJson.102 TotallyNotJson.835; - jump TotallyNotJson.1885 TotallyNotJson.1886; + let TotallyNotJson.1863 : Int1 = CallByName TotallyNotJson.102 TotallyNotJson.835; + jump TotallyNotJson.1862 TotallyNotJson.1863; else - let TotallyNotJson.1871 : {List Str, List Str} = Struct {TotallyNotJson.834, TotallyNotJson.833}; - ret TotallyNotJson.1871; + let TotallyNotJson.1848 : {List Str, List Str} = Struct {TotallyNotJson.834, TotallyNotJson.833}; + ret TotallyNotJson.1848; in - jump TotallyNotJson.1870 TotallyNotJson.2004; + jump TotallyNotJson.1847 #Derived_gen.41; procedure TotallyNotJson.97 (TotallyNotJson.837): let TotallyNotJson.838 : List Str = CallByName Str.55 TotallyNotJson.837; dec TotallyNotJson.837; - let TotallyNotJson.1770 : U64 = CallByName List.6 TotallyNotJson.838; - let TotallyNotJson.839 : List Str = CallByName List.68 TotallyNotJson.1770; - let TotallyNotJson.1590 : {List Str, List Str} = Struct {TotallyNotJson.838, TotallyNotJson.839}; - let TotallyNotJson.1586 : {List Str, List Str} = CallByName TotallyNotJson.98 TotallyNotJson.1590; - let TotallyNotJson.1587 : {} = Struct {}; - let TotallyNotJson.1584 : List Str = CallByName TotallyNotJson.840 TotallyNotJson.1586; - let TotallyNotJson.1585 : Str = ""; - let TotallyNotJson.1583 : Str = CallByName Str.4 TotallyNotJson.1584 TotallyNotJson.1585; - dec TotallyNotJson.1585; - dec TotallyNotJson.1584; - ret TotallyNotJson.1583; - -procedure TotallyNotJson.98 (TotallyNotJson.1995): - joinpoint TotallyNotJson.1591 TotallyNotJson.1169: + let TotallyNotJson.1747 : U64 = CallByName List.6 TotallyNotJson.838; + let TotallyNotJson.839 : List Str = CallByName List.68 TotallyNotJson.1747; + let TotallyNotJson.1567 : {List Str, List Str} = Struct {TotallyNotJson.838, TotallyNotJson.839}; + let TotallyNotJson.1563 : {List Str, List Str} = CallByName TotallyNotJson.98 TotallyNotJson.1567; + let TotallyNotJson.1564 : {} = Struct {}; + let TotallyNotJson.1561 : List Str = CallByName TotallyNotJson.840 TotallyNotJson.1563; + let TotallyNotJson.1562 : Str = ""; + let TotallyNotJson.1560 : Str = CallByName Str.4 TotallyNotJson.1561 TotallyNotJson.1562; + dec TotallyNotJson.1561; + dec TotallyNotJson.1562; + ret TotallyNotJson.1560; + +procedure TotallyNotJson.98 (#Derived_gen.47): + joinpoint TotallyNotJson.1568 TotallyNotJson.1169: let TotallyNotJson.842 : List Str = StructAtIndex 0 TotallyNotJson.1169; let TotallyNotJson.841 : List Str = StructAtIndex 1 TotallyNotJson.1169; - let TotallyNotJson.1767 : U64 = lowlevel ListLen TotallyNotJson.842; - let TotallyNotJson.1768 : U64 = 1i64; - let TotallyNotJson.1769 : Int1 = lowlevel NumGte TotallyNotJson.1767 TotallyNotJson.1768; - if TotallyNotJson.1769 then - let TotallyNotJson.1766 : U64 = 0i64; - let TotallyNotJson.843 : Str = lowlevel ListGetUnsafe TotallyNotJson.842 TotallyNotJson.1766; + let TotallyNotJson.1744 : U64 = lowlevel ListLen TotallyNotJson.842; + let TotallyNotJson.1745 : U64 = 1i64; + let TotallyNotJson.1746 : Int1 = lowlevel NumGte TotallyNotJson.1744 TotallyNotJson.1745; + if TotallyNotJson.1746 then + let TotallyNotJson.1743 : U64 = 0i64; + let TotallyNotJson.843 : Str = lowlevel ListGetUnsafe TotallyNotJson.842 TotallyNotJson.1743; inc 2 TotallyNotJson.843; - joinpoint TotallyNotJson.1685 TotallyNotJson.1684: - if TotallyNotJson.1684 then - let TotallyNotJson.1595 : List Str = CallByName List.38 TotallyNotJson.842; - let TotallyNotJson.1598 : Str = "_"; - let TotallyNotJson.1599 : Str = CallByName TotallyNotJson.101 TotallyNotJson.843; - let TotallyNotJson.1597 : List Str = Array [TotallyNotJson.1598, TotallyNotJson.1599]; - let TotallyNotJson.1596 : List Str = CallByName List.8 TotallyNotJson.841 TotallyNotJson.1597; - let TotallyNotJson.1594 : {List Str, List Str} = Struct {TotallyNotJson.1595, TotallyNotJson.1596}; - jump TotallyNotJson.1591 TotallyNotJson.1594; + joinpoint TotallyNotJson.1662 TotallyNotJson.1661: + if TotallyNotJson.1661 then + let TotallyNotJson.1572 : List Str = CallByName List.38 TotallyNotJson.842; + let TotallyNotJson.1575 : Str = "_"; + let TotallyNotJson.1576 : Str = CallByName TotallyNotJson.101 TotallyNotJson.843; + let TotallyNotJson.1574 : List Str = Array [TotallyNotJson.1575, TotallyNotJson.1576]; + let TotallyNotJson.1573 : List Str = CallByName List.8 TotallyNotJson.841 TotallyNotJson.1574; + let TotallyNotJson.1571 : {List Str, List Str} = Struct {TotallyNotJson.1572, TotallyNotJson.1573}; + jump TotallyNotJson.1568 TotallyNotJson.1571; else dec TotallyNotJson.843; - let TotallyNotJson.1683 : U64 = 0i64; - let TotallyNotJson.844 : Str = lowlevel ListGetUnsafe TotallyNotJson.842 TotallyNotJson.1683; + let TotallyNotJson.1660 : U64 = 0i64; + let TotallyNotJson.844 : Str = lowlevel ListGetUnsafe TotallyNotJson.842 TotallyNotJson.1660; inc TotallyNotJson.844; - let TotallyNotJson.1681 : List Str = CallByName List.38 TotallyNotJson.842; - let TotallyNotJson.1682 : List Str = CallByName List.4 TotallyNotJson.841 TotallyNotJson.844; - let TotallyNotJson.1680 : {List Str, List Str} = Struct {TotallyNotJson.1681, TotallyNotJson.1682}; - jump TotallyNotJson.1591 TotallyNotJson.1680; + let TotallyNotJson.1658 : List Str = CallByName List.38 TotallyNotJson.842; + let TotallyNotJson.1659 : List Str = CallByName List.4 TotallyNotJson.841 TotallyNotJson.844; + let TotallyNotJson.1657 : {List Str, List Str} = Struct {TotallyNotJson.1658, TotallyNotJson.1659}; + jump TotallyNotJson.1568 TotallyNotJson.1657; in - let TotallyNotJson.1686 : Int1 = CallByName TotallyNotJson.102 TotallyNotJson.843; - jump TotallyNotJson.1685 TotallyNotJson.1686; + let TotallyNotJson.1663 : Int1 = CallByName TotallyNotJson.102 TotallyNotJson.843; + jump TotallyNotJson.1662 TotallyNotJson.1663; else - let TotallyNotJson.1592 : {List Str, List Str} = Struct {TotallyNotJson.842, TotallyNotJson.841}; - ret TotallyNotJson.1592; + let TotallyNotJson.1569 : {List Str, List Str} = Struct {TotallyNotJson.842, TotallyNotJson.841}; + ret TotallyNotJson.1569; in - jump TotallyNotJson.1591 TotallyNotJson.1995; + jump TotallyNotJson.1568 #Derived_gen.47; procedure Test.0 (): let Test.12 : Str = "bar"; diff --git a/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt b/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt index 5aff466792c..a8e9541cdfa 100644 --- a/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt @@ -37,12 +37,12 @@ procedure Encode.24 (Encode.99, Encode.107, Encode.101): ret Encode.111; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.118 : List U8 = CallByName TotallyNotJson.234 Encode.99 Encode.101 Encode.107; - ret Encode.118; + let Encode.113 : List U8 = CallByName TotallyNotJson.234 Encode.99 Encode.101 Encode.107; + ret Encode.113; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.121 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; - ret Encode.121; + let Encode.116 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; + ret Encode.116; procedure Encode.26 (Encode.105, Encode.106): let Encode.109 : List U8 = Array []; @@ -51,221 +51,221 @@ procedure Encode.26 (Encode.105, Encode.106): ret Encode.108; procedure List.13 (#Attr.2, #Attr.3): - let List.622 : List Str = lowlevel ListPrepend #Attr.2 #Attr.3; - ret List.622; + let List.621 : List Str = lowlevel ListPrepend #Attr.2 #Attr.3; + ret List.621; procedure List.145 (List.146, List.147, List.144): - let List.570 : {List U8, U64} = CallByName TotallyNotJson.237 List.146 List.147 List.144; - ret List.570; + let List.569 : {List U8, U64} = CallByName TotallyNotJson.237 List.146 List.147 List.144; + ret List.569; procedure List.145 (List.146, List.147, List.144): - let List.590 : List U8 = CallByName TotallyNotJson.215 List.146 List.147; - ret List.590; + let List.589 : List U8 = CallByName TotallyNotJson.215 List.146 List.147; + ret List.589; procedure List.18 (List.142, List.143, List.144): - let List.551 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; - ret List.551; + let List.550 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; + ret List.550; procedure List.18 (List.142, List.143, List.144): - let List.571 : List U8 = CallByName List.93 List.142 List.143 List.144; - ret List.571; + let List.570 : List U8 = CallByName List.93 List.142 List.143 List.144; + ret List.570; procedure List.26 (List.159, List.160, List.161): - let List.639 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.93 List.159 List.160 List.161; - let List.642 : U8 = 1i64; - let List.643 : U8 = GetTagId List.639; - let List.644 : Int1 = lowlevel Eq List.642 List.643; - if List.644 then - let List.162 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.639; + let List.638 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.93 List.159 List.160 List.161; + let List.641 : U8 = 1i64; + let List.642 : U8 = GetTagId List.638; + let List.643 : Int1 = lowlevel Eq List.641 List.642; + if List.643 then + let List.162 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.638; ret List.162; else - let List.163 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.639; + let List.163 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.638; ret List.163; procedure List.31 (#Attr.2, #Attr.3): - let List.604 : List Str = lowlevel ListDropAt #Attr.2 #Attr.3; - ret List.604; + let List.603 : List Str = lowlevel ListDropAt #Attr.2 #Attr.3; + ret List.603; procedure List.38 (List.298): - let List.612 : U64 = 0i64; - let List.611 : List Str = CallByName List.31 List.298 List.612; - ret List.611; + let List.611 : U64 = 0i64; + let List.610 : List Str = CallByName List.31 List.298 List.611; + ret List.610; procedure List.4 (List.113, List.114): - let List.547 : U64 = 1i64; - let List.546 : List Str = CallByName List.70 List.113 List.547; - let List.545 : List Str = CallByName List.71 List.546 List.114; - ret List.545; + let List.546 : U64 = 1i64; + let List.545 : List Str = CallByName List.70 List.113 List.546; + let List.544 : List Str = CallByName List.71 List.545 List.114; + ret List.544; procedure List.4 (List.113, List.114): - let List.550 : U64 = 1i64; - let List.549 : List U8 = CallByName List.70 List.113 List.550; - let List.548 : List U8 = CallByName List.71 List.549 List.114; - ret List.548; + let List.549 : U64 = 1i64; + let List.548 : List U8 = CallByName List.70 List.113 List.549; + let List.547 : List U8 = CallByName List.71 List.548 List.114; + ret List.547; procedure List.49 (List.376, List.377): - let List.631 : U64 = StructAtIndex 0 List.377; - let List.632 : U64 = 0i64; - let List.629 : Int1 = CallByName Bool.11 List.631 List.632; - if List.629 then + let List.630 : U64 = StructAtIndex 0 List.377; + let List.631 : U64 = 0i64; + let List.628 : Int1 = CallByName Bool.11 List.630 List.631; + if List.628 then dec List.376; - let List.630 : List U8 = Array []; - ret List.630; + let List.629 : List U8 = Array []; + ret List.629; else - let List.626 : U64 = StructAtIndex 1 List.377; - let List.627 : U64 = StructAtIndex 0 List.377; - let List.625 : List U8 = CallByName List.72 List.376 List.626 List.627; - ret List.625; + let List.625 : U64 = StructAtIndex 1 List.377; + let List.626 : U64 = StructAtIndex 0 List.377; + let List.624 : List U8 = CallByName List.72 List.376 List.625 List.626; + ret List.624; procedure List.52 (List.391, List.392): let List.393 : U64 = CallByName List.6 List.391; - joinpoint List.637 List.394: - let List.635 : U64 = 0i64; - let List.634 : {U64, U64} = Struct {List.394, List.635}; + joinpoint List.636 List.394: + let List.634 : U64 = 0i64; + let List.633 : {U64, U64} = Struct {List.394, List.634}; inc List.391; - let List.395 : List U8 = CallByName List.49 List.391 List.634; - let List.633 : U64 = CallByName Num.20 List.393 List.394; - let List.624 : {U64, U64} = Struct {List.633, List.394}; - let List.396 : List U8 = CallByName List.49 List.391 List.624; - let List.623 : {List U8, List U8} = Struct {List.395, List.396}; - ret List.623; + let List.395 : List U8 = CallByName List.49 List.391 List.633; + let List.632 : U64 = CallByName Num.20 List.393 List.394; + let List.623 : {U64, U64} = Struct {List.632, List.394}; + let List.396 : List U8 = CallByName List.49 List.391 List.623; + let List.622 : {List U8, List U8} = Struct {List.395, List.396}; + ret List.622; in - let List.638 : Int1 = CallByName Num.24 List.393 List.392; - if List.638 then - jump List.637 List.392; + let List.637 : Int1 = CallByName Num.24 List.393 List.392; + if List.637 then + jump List.636 List.392; else - jump List.637 List.393; + jump List.636 List.393; procedure List.6 (#Attr.2): - let List.618 : U64 = lowlevel ListLen #Attr.2; - ret List.618; + let List.617 : U64 = lowlevel ListLen #Attr.2; + ret List.617; procedure List.6 (#Attr.2): - let List.619 : U64 = lowlevel ListLen #Attr.2; - ret List.619; + let List.618 : U64 = lowlevel ListLen #Attr.2; + ret List.618; procedure List.6 (#Attr.2): - let List.621 : U64 = lowlevel ListLen #Attr.2; - ret List.621; + let List.620 : U64 = lowlevel ListLen #Attr.2; + ret List.620; procedure List.66 (#Attr.2, #Attr.3): - let List.567 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.567; + let List.566 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.566; procedure List.66 (#Attr.2, #Attr.3): - let List.587 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.587; + let List.586 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.586; procedure List.68 (#Attr.2): - let List.614 : List Str = lowlevel ListWithCapacity #Attr.2; - ret List.614; + let List.613 : List Str = lowlevel ListWithCapacity #Attr.2; + ret List.613; procedure List.68 (#Attr.2): - let List.616 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.616; + let List.615 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.615; procedure List.70 (#Attr.2, #Attr.3): - let List.527 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.527; + let List.526 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.526; procedure List.70 (#Attr.2, #Attr.3): - let List.544 : List Str = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.544; + let List.543 : List Str = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.543; procedure List.71 (#Attr.2, #Attr.3): - let List.525 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.525; + let List.524 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.524; procedure List.71 (#Attr.2, #Attr.3): - let List.542 : List Str = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.542; + let List.541 : List Str = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.541; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.628 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.628; + let List.627 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.627; procedure List.8 (#Attr.2, #Attr.3): - let List.593 : List Str = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.593; + let List.592 : List Str = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.592; procedure List.8 (#Attr.2, #Attr.3): - let List.601 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.601; - -procedure List.80 (List.675, List.676, List.677, List.678, List.679): - joinpoint List.557 List.439 List.440 List.441 List.442 List.443: - let List.559 : Int1 = CallByName Num.22 List.442 List.443; - if List.559 then - let List.566 : {Str, Str} = CallByName List.66 List.439 List.442; - inc List.566; - let List.560 : {List U8, U64} = CallByName List.145 List.440 List.566 List.441; - let List.563 : U64 = 1i64; - let List.562 : U64 = CallByName Num.19 List.442 List.563; - jump List.557 List.439 List.560 List.441 List.562 List.443; + let List.600 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.600; + +procedure List.80 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14, #Derived_gen.15): + joinpoint List.556 List.439 List.440 List.441 List.442 List.443: + let List.558 : Int1 = CallByName Num.22 List.442 List.443; + if List.558 then + let List.565 : {Str, Str} = CallByName List.66 List.439 List.442; + inc List.565; + let List.559 : {List U8, U64} = CallByName List.145 List.440 List.565 List.441; + let List.562 : U64 = 1i64; + let List.561 : U64 = CallByName Num.19 List.442 List.562; + jump List.556 List.439 List.559 List.441 List.561 List.443; else dec List.439; ret List.440; in - jump List.557 List.675 List.676 List.677 List.678 List.679; - -procedure List.80 (List.692, List.693, List.694, List.695, List.696): - joinpoint List.577 List.439 List.440 List.441 List.442 List.443: - let List.579 : Int1 = CallByName Num.22 List.442 List.443; - if List.579 then - let List.586 : U8 = CallByName List.66 List.439 List.442; - let List.580 : List U8 = CallByName List.145 List.440 List.586 List.441; - let List.583 : U64 = 1i64; - let List.582 : U64 = CallByName Num.19 List.442 List.583; - jump List.577 List.439 List.580 List.441 List.582 List.443; + jump List.556 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15; + +procedure List.80 (#Derived_gen.16, #Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20): + joinpoint List.647 List.439 List.440 List.441 List.442 List.443: + let List.649 : Int1 = CallByName Num.22 List.442 List.443; + if List.649 then + let List.658 : U8 = CallByName List.66 List.439 List.442; + let List.650 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.658; + let List.655 : U8 = 1i64; + let List.656 : U8 = GetTagId List.650; + let List.657 : Int1 = lowlevel Eq List.655 List.656; + if List.657 then + let List.444 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.650; + let List.653 : U64 = 1i64; + let List.652 : U64 = CallByName Num.19 List.442 List.653; + jump List.647 List.439 List.444 List.441 List.652 List.443; + else + dec List.439; + let List.445 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.650; + let List.654 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.445; + ret List.654; else dec List.439; - ret List.440; + let List.648 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.440; + ret List.648; in - jump List.577 List.692 List.693 List.694 List.695 List.696; - -procedure List.80 (List.728, List.729, List.730, List.731, List.732): - joinpoint List.648 List.439 List.440 List.441 List.442 List.443: - let List.650 : Int1 = CallByName Num.22 List.442 List.443; - if List.650 then - let List.659 : U8 = CallByName List.66 List.439 List.442; - let List.651 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.659; - let List.656 : U8 = 1i64; - let List.657 : U8 = GetTagId List.651; - let List.658 : Int1 = lowlevel Eq List.656 List.657; - if List.658 then - let List.444 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.651; - let List.654 : U64 = 1i64; - let List.653 : U64 = CallByName Num.19 List.442 List.654; - jump List.648 List.439 List.444 List.441 List.653 List.443; - else - dec List.439; - let List.445 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.651; - let List.655 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.445; - ret List.655; + jump List.647 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20; + +procedure List.80 (#Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24, #Derived_gen.25): + joinpoint List.576 List.439 List.440 List.441 List.442 List.443: + let List.578 : Int1 = CallByName Num.22 List.442 List.443; + if List.578 then + let List.585 : U8 = CallByName List.66 List.439 List.442; + let List.579 : List U8 = CallByName List.145 List.440 List.585 List.441; + let List.582 : U64 = 1i64; + let List.581 : U64 = CallByName Num.19 List.442 List.582; + jump List.576 List.439 List.579 List.441 List.581 List.443; else dec List.439; - let List.649 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.440; - ret List.649; + ret List.440; in - jump List.648 List.728 List.729 List.730 List.731 List.732; + jump List.576 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25; procedure List.93 (List.436, List.437, List.438): - let List.555 : U64 = 0i64; - let List.556 : U64 = CallByName List.6 List.436; - let List.554 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.555 List.556; - ret List.554; + let List.554 : U64 = 0i64; + let List.555 : U64 = CallByName List.6 List.436; + let List.553 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.554 List.555; + ret List.553; procedure List.93 (List.436, List.437, List.438): - let List.575 : U64 = 0i64; - let List.576 : U64 = CallByName List.6 List.436; - let List.574 : List U8 = CallByName List.80 List.436 List.437 List.438 List.575 List.576; - ret List.574; + let List.574 : U64 = 0i64; + let List.575 : U64 = CallByName List.6 List.436; + let List.573 : List U8 = CallByName List.80 List.436 List.437 List.438 List.574 List.575; + ret List.573; procedure List.93 (List.436, List.437, List.438): - let List.646 : U64 = 0i64; - let List.647 : U64 = CallByName List.6 List.436; - let List.645 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.436 List.437 List.438 List.646 List.647; - ret List.645; + let List.645 : U64 = 0i64; + let List.646 : U64 = CallByName List.6 List.436; + let List.644 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.436 List.437 List.438 List.645 List.646; + ret List.644; procedure Num.127 (#Attr.2): let Num.297 : U8 = lowlevel NumIntCast #Attr.2; @@ -296,20 +296,20 @@ procedure Num.94 (#Attr.2, #Attr.3): ret Num.302; procedure Str.12 (#Attr.2): - let Str.313 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.313; + let Str.309 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.309; procedure Str.4 (#Attr.2, #Attr.3): - let Str.316 : Str = lowlevel StrJoinWith #Attr.2 #Attr.3; - ret Str.316; + let Str.312 : Str = lowlevel StrJoinWith #Attr.2 #Attr.3; + ret Str.312; procedure Str.48 (#Attr.2, #Attr.3, #Attr.4): let Str.307 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; ret Str.307; procedure Str.55 (#Attr.2): - let Str.319 : List Str = lowlevel StrGraphemes #Attr.2; - ret Str.319; + let Str.315 : List Str = lowlevel StrGraphemes #Attr.2; + ret Str.315; procedure Str.9 (Str.79): let Str.305 : U64 = 0i64; @@ -323,8 +323,8 @@ procedure Str.9 (Str.79): else let Str.300 : U8 = StructAtIndex 3 Str.80; let Str.301 : U64 = StructAtIndex 0 Str.80; - let #Derived_gen.16 : Str = StructAtIndex 1 Str.80; - dec #Derived_gen.16; + let #Derived_gen.38 : Str = StructAtIndex 1 Str.80; + dec #Derived_gen.38; let Str.299 : {U64, U8} = Struct {Str.301, Str.300}; let Str.298 : [C {U64, U8}, C Str] = TagId(0) Str.299; ret Str.298; @@ -1215,14 +1215,14 @@ procedure TotallyNotJson.82 (TotallyNotJson.802, TotallyNotJson.803): procedure TotallyNotJson.832 (TotallyNotJson.1493): let TotallyNotJson.1494 : List Str = StructAtIndex 1 TotallyNotJson.1493; - let #Derived_gen.14 : List Str = StructAtIndex 0 TotallyNotJson.1493; - dec #Derived_gen.14; + let #Derived_gen.36 : List Str = StructAtIndex 0 TotallyNotJson.1493; + dec #Derived_gen.36; ret TotallyNotJson.1494; procedure TotallyNotJson.840 (TotallyNotJson.1214): let TotallyNotJson.1215 : List Str = StructAtIndex 1 TotallyNotJson.1214; - let #Derived_gen.15 : List Str = StructAtIndex 0 TotallyNotJson.1214; - dec #Derived_gen.15; + let #Derived_gen.37 : List Str = StructAtIndex 0 TotallyNotJson.1214; + dec #Derived_gen.37; ret TotallyNotJson.1215; procedure TotallyNotJson.87 (TotallyNotJson.809): @@ -1277,7 +1277,7 @@ procedure TotallyNotJson.95 (TotallyNotJson.829): dec TotallyNotJson.1489; ret TotallyNotJson.1488; -procedure TotallyNotJson.96 (TotallyNotJson.1630): +procedure TotallyNotJson.96 (#Derived_gen.32): joinpoint TotallyNotJson.1496 TotallyNotJson.1168: let TotallyNotJson.834 : List Str = StructAtIndex 0 TotallyNotJson.1168; let TotallyNotJson.833 : List Str = StructAtIndex 1 TotallyNotJson.1168; @@ -1313,7 +1313,7 @@ procedure TotallyNotJson.96 (TotallyNotJson.1630): let TotallyNotJson.1497 : {List Str, List Str} = Struct {TotallyNotJson.834, TotallyNotJson.833}; ret TotallyNotJson.1497; in - jump TotallyNotJson.1496 TotallyNotJson.1630; + jump TotallyNotJson.1496 #Derived_gen.32; procedure TotallyNotJson.97 (TotallyNotJson.837): let TotallyNotJson.838 : List Str = CallByName Str.55 TotallyNotJson.837; @@ -1330,7 +1330,7 @@ procedure TotallyNotJson.97 (TotallyNotJson.837): dec TotallyNotJson.1210; ret TotallyNotJson.1209; -procedure TotallyNotJson.98 (TotallyNotJson.1621): +procedure TotallyNotJson.98 (#Derived_gen.10): joinpoint TotallyNotJson.1217 TotallyNotJson.1169: let TotallyNotJson.842 : List Str = StructAtIndex 0 TotallyNotJson.1169; let TotallyNotJson.841 : List Str = StructAtIndex 1 TotallyNotJson.1169; @@ -1366,7 +1366,7 @@ procedure TotallyNotJson.98 (TotallyNotJson.1621): let TotallyNotJson.1218 : {List Str, List Str} = Struct {TotallyNotJson.842, TotallyNotJson.841}; ret TotallyNotJson.1218; in - jump TotallyNotJson.1217 TotallyNotJson.1621; + jump TotallyNotJson.1217 #Derived_gen.10; procedure Test.0 (): let Test.11 : Str = "foo"; diff --git a/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt b/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt index 6ee53cde33a..5069fc23e17 100644 --- a/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt +++ b/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt @@ -44,12 +44,12 @@ procedure Encode.24 (Encode.99, Encode.107, Encode.101): ret Encode.111; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.118 : List U8 = CallByName TotallyNotJson.234 Encode.99 Encode.101 Encode.107; - ret Encode.118; + let Encode.113 : List U8 = CallByName TotallyNotJson.234 Encode.99 Encode.101 Encode.107; + ret Encode.113; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.122 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; - ret Encode.122; + let Encode.117 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; + ret Encode.117; procedure Encode.26 (Encode.105, Encode.106): let Encode.109 : List U8 = Array []; @@ -58,221 +58,221 @@ procedure Encode.26 (Encode.105, Encode.106): ret Encode.108; procedure List.13 (#Attr.2, #Attr.3): - let List.622 : List Str = lowlevel ListPrepend #Attr.2 #Attr.3; - ret List.622; + let List.621 : List Str = lowlevel ListPrepend #Attr.2 #Attr.3; + ret List.621; procedure List.145 (List.146, List.147, List.144): - let List.570 : {List U8, U64} = CallByName TotallyNotJson.237 List.146 List.147 List.144; - ret List.570; + let List.569 : {List U8, U64} = CallByName TotallyNotJson.237 List.146 List.147 List.144; + ret List.569; procedure List.145 (List.146, List.147, List.144): - let List.590 : List U8 = CallByName TotallyNotJson.215 List.146 List.147; - ret List.590; + let List.589 : List U8 = CallByName TotallyNotJson.215 List.146 List.147; + ret List.589; procedure List.18 (List.142, List.143, List.144): - let List.551 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; - ret List.551; + let List.550 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; + ret List.550; procedure List.18 (List.142, List.143, List.144): - let List.571 : List U8 = CallByName List.93 List.142 List.143 List.144; - ret List.571; + let List.570 : List U8 = CallByName List.93 List.142 List.143 List.144; + ret List.570; procedure List.26 (List.159, List.160, List.161): - let List.639 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.93 List.159 List.160 List.161; - let List.642 : U8 = 1i64; - let List.643 : U8 = GetTagId List.639; - let List.644 : Int1 = lowlevel Eq List.642 List.643; - if List.644 then - let List.162 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.639; + let List.638 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.93 List.159 List.160 List.161; + let List.641 : U8 = 1i64; + let List.642 : U8 = GetTagId List.638; + let List.643 : Int1 = lowlevel Eq List.641 List.642; + if List.643 then + let List.162 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.638; ret List.162; else - let List.163 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.639; + let List.163 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.638; ret List.163; procedure List.31 (#Attr.2, #Attr.3): - let List.604 : List Str = lowlevel ListDropAt #Attr.2 #Attr.3; - ret List.604; + let List.603 : List Str = lowlevel ListDropAt #Attr.2 #Attr.3; + ret List.603; procedure List.38 (List.298): - let List.612 : U64 = 0i64; - let List.611 : List Str = CallByName List.31 List.298 List.612; - ret List.611; + let List.611 : U64 = 0i64; + let List.610 : List Str = CallByName List.31 List.298 List.611; + ret List.610; procedure List.4 (List.113, List.114): - let List.547 : U64 = 1i64; - let List.546 : List Str = CallByName List.70 List.113 List.547; - let List.545 : List Str = CallByName List.71 List.546 List.114; - ret List.545; + let List.546 : U64 = 1i64; + let List.545 : List Str = CallByName List.70 List.113 List.546; + let List.544 : List Str = CallByName List.71 List.545 List.114; + ret List.544; procedure List.4 (List.113, List.114): - let List.550 : U64 = 1i64; - let List.549 : List U8 = CallByName List.70 List.113 List.550; - let List.548 : List U8 = CallByName List.71 List.549 List.114; - ret List.548; + let List.549 : U64 = 1i64; + let List.548 : List U8 = CallByName List.70 List.113 List.549; + let List.547 : List U8 = CallByName List.71 List.548 List.114; + ret List.547; procedure List.49 (List.376, List.377): - let List.631 : U64 = StructAtIndex 0 List.377; - let List.632 : U64 = 0i64; - let List.629 : Int1 = CallByName Bool.11 List.631 List.632; - if List.629 then + let List.630 : U64 = StructAtIndex 0 List.377; + let List.631 : U64 = 0i64; + let List.628 : Int1 = CallByName Bool.11 List.630 List.631; + if List.628 then dec List.376; - let List.630 : List U8 = Array []; - ret List.630; + let List.629 : List U8 = Array []; + ret List.629; else - let List.626 : U64 = StructAtIndex 1 List.377; - let List.627 : U64 = StructAtIndex 0 List.377; - let List.625 : List U8 = CallByName List.72 List.376 List.626 List.627; - ret List.625; + let List.625 : U64 = StructAtIndex 1 List.377; + let List.626 : U64 = StructAtIndex 0 List.377; + let List.624 : List U8 = CallByName List.72 List.376 List.625 List.626; + ret List.624; procedure List.52 (List.391, List.392): let List.393 : U64 = CallByName List.6 List.391; - joinpoint List.637 List.394: - let List.635 : U64 = 0i64; - let List.634 : {U64, U64} = Struct {List.394, List.635}; + joinpoint List.636 List.394: + let List.634 : U64 = 0i64; + let List.633 : {U64, U64} = Struct {List.394, List.634}; inc List.391; - let List.395 : List U8 = CallByName List.49 List.391 List.634; - let List.633 : U64 = CallByName Num.20 List.393 List.394; - let List.624 : {U64, U64} = Struct {List.633, List.394}; - let List.396 : List U8 = CallByName List.49 List.391 List.624; - let List.623 : {List U8, List U8} = Struct {List.395, List.396}; - ret List.623; + let List.395 : List U8 = CallByName List.49 List.391 List.633; + let List.632 : U64 = CallByName Num.20 List.393 List.394; + let List.623 : {U64, U64} = Struct {List.632, List.394}; + let List.396 : List U8 = CallByName List.49 List.391 List.623; + let List.622 : {List U8, List U8} = Struct {List.395, List.396}; + ret List.622; in - let List.638 : Int1 = CallByName Num.24 List.393 List.392; - if List.638 then - jump List.637 List.392; + let List.637 : Int1 = CallByName Num.24 List.393 List.392; + if List.637 then + jump List.636 List.392; else - jump List.637 List.393; + jump List.636 List.393; procedure List.6 (#Attr.2): - let List.618 : U64 = lowlevel ListLen #Attr.2; - ret List.618; + let List.617 : U64 = lowlevel ListLen #Attr.2; + ret List.617; procedure List.6 (#Attr.2): - let List.619 : U64 = lowlevel ListLen #Attr.2; - ret List.619; + let List.618 : U64 = lowlevel ListLen #Attr.2; + ret List.618; procedure List.6 (#Attr.2): - let List.621 : U64 = lowlevel ListLen #Attr.2; - ret List.621; + let List.620 : U64 = lowlevel ListLen #Attr.2; + ret List.620; procedure List.66 (#Attr.2, #Attr.3): - let List.567 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.567; + let List.566 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.566; procedure List.66 (#Attr.2, #Attr.3): - let List.587 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.587; + let List.586 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.586; procedure List.68 (#Attr.2): - let List.614 : List Str = lowlevel ListWithCapacity #Attr.2; - ret List.614; + let List.613 : List Str = lowlevel ListWithCapacity #Attr.2; + ret List.613; procedure List.68 (#Attr.2): - let List.616 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.616; + let List.615 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.615; procedure List.70 (#Attr.2, #Attr.3): - let List.527 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.527; + let List.526 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.526; procedure List.70 (#Attr.2, #Attr.3): - let List.544 : List Str = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.544; + let List.543 : List Str = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.543; procedure List.71 (#Attr.2, #Attr.3): - let List.525 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.525; + let List.524 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.524; procedure List.71 (#Attr.2, #Attr.3): - let List.542 : List Str = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.542; + let List.541 : List Str = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.541; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.628 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.628; + let List.627 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.627; procedure List.8 (#Attr.2, #Attr.3): - let List.593 : List Str = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.593; + let List.592 : List Str = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.592; procedure List.8 (#Attr.2, #Attr.3): - let List.601 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.601; - -procedure List.80 (List.675, List.676, List.677, List.678, List.679): - joinpoint List.557 List.439 List.440 List.441 List.442 List.443: - let List.559 : Int1 = CallByName Num.22 List.442 List.443; - if List.559 then - let List.566 : {Str, Str} = CallByName List.66 List.439 List.442; - inc List.566; - let List.560 : {List U8, U64} = CallByName List.145 List.440 List.566 List.441; - let List.563 : U64 = 1i64; - let List.562 : U64 = CallByName Num.19 List.442 List.563; - jump List.557 List.439 List.560 List.441 List.562 List.443; + let List.600 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.600; + +procedure List.80 (#Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18, #Derived_gen.19): + joinpoint List.556 List.439 List.440 List.441 List.442 List.443: + let List.558 : Int1 = CallByName Num.22 List.442 List.443; + if List.558 then + let List.565 : {Str, Str} = CallByName List.66 List.439 List.442; + inc List.565; + let List.559 : {List U8, U64} = CallByName List.145 List.440 List.565 List.441; + let List.562 : U64 = 1i64; + let List.561 : U64 = CallByName Num.19 List.442 List.562; + jump List.556 List.439 List.559 List.441 List.561 List.443; else dec List.439; ret List.440; in - jump List.557 List.675 List.676 List.677 List.678 List.679; - -procedure List.80 (List.692, List.693, List.694, List.695, List.696): - joinpoint List.577 List.439 List.440 List.441 List.442 List.443: - let List.579 : Int1 = CallByName Num.22 List.442 List.443; - if List.579 then - let List.586 : U8 = CallByName List.66 List.439 List.442; - let List.580 : List U8 = CallByName List.145 List.440 List.586 List.441; - let List.583 : U64 = 1i64; - let List.582 : U64 = CallByName Num.19 List.442 List.583; - jump List.577 List.439 List.580 List.441 List.582 List.443; + jump List.556 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19; + +procedure List.80 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24): + joinpoint List.647 List.439 List.440 List.441 List.442 List.443: + let List.649 : Int1 = CallByName Num.22 List.442 List.443; + if List.649 then + let List.658 : U8 = CallByName List.66 List.439 List.442; + let List.650 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.658; + let List.655 : U8 = 1i64; + let List.656 : U8 = GetTagId List.650; + let List.657 : Int1 = lowlevel Eq List.655 List.656; + if List.657 then + let List.444 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.650; + let List.653 : U64 = 1i64; + let List.652 : U64 = CallByName Num.19 List.442 List.653; + jump List.647 List.439 List.444 List.441 List.652 List.443; + else + dec List.439; + let List.445 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.650; + let List.654 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.445; + ret List.654; else dec List.439; - ret List.440; + let List.648 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.440; + ret List.648; in - jump List.577 List.692 List.693 List.694 List.695 List.696; - -procedure List.80 (List.728, List.729, List.730, List.731, List.732): - joinpoint List.648 List.439 List.440 List.441 List.442 List.443: - let List.650 : Int1 = CallByName Num.22 List.442 List.443; - if List.650 then - let List.659 : U8 = CallByName List.66 List.439 List.442; - let List.651 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.659; - let List.656 : U8 = 1i64; - let List.657 : U8 = GetTagId List.651; - let List.658 : Int1 = lowlevel Eq List.656 List.657; - if List.658 then - let List.444 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.651; - let List.654 : U64 = 1i64; - let List.653 : U64 = CallByName Num.19 List.442 List.654; - jump List.648 List.439 List.444 List.441 List.653 List.443; - else - dec List.439; - let List.445 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.651; - let List.655 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.445; - ret List.655; + jump List.647 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24; + +procedure List.80 (#Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29): + joinpoint List.576 List.439 List.440 List.441 List.442 List.443: + let List.578 : Int1 = CallByName Num.22 List.442 List.443; + if List.578 then + let List.585 : U8 = CallByName List.66 List.439 List.442; + let List.579 : List U8 = CallByName List.145 List.440 List.585 List.441; + let List.582 : U64 = 1i64; + let List.581 : U64 = CallByName Num.19 List.442 List.582; + jump List.576 List.439 List.579 List.441 List.581 List.443; else dec List.439; - let List.649 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.440; - ret List.649; + ret List.440; in - jump List.648 List.728 List.729 List.730 List.731 List.732; + jump List.576 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29; procedure List.93 (List.436, List.437, List.438): - let List.555 : U64 = 0i64; - let List.556 : U64 = CallByName List.6 List.436; - let List.554 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.555 List.556; - ret List.554; + let List.554 : U64 = 0i64; + let List.555 : U64 = CallByName List.6 List.436; + let List.553 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.554 List.555; + ret List.553; procedure List.93 (List.436, List.437, List.438): - let List.575 : U64 = 0i64; - let List.576 : U64 = CallByName List.6 List.436; - let List.574 : List U8 = CallByName List.80 List.436 List.437 List.438 List.575 List.576; - ret List.574; + let List.574 : U64 = 0i64; + let List.575 : U64 = CallByName List.6 List.436; + let List.573 : List U8 = CallByName List.80 List.436 List.437 List.438 List.574 List.575; + ret List.573; procedure List.93 (List.436, List.437, List.438): - let List.646 : U64 = 0i64; - let List.647 : U64 = CallByName List.6 List.436; - let List.645 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.436 List.437 List.438 List.646 List.647; - ret List.645; + let List.645 : U64 = 0i64; + let List.646 : U64 = CallByName List.6 List.436; + let List.644 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.436 List.437 List.438 List.645 List.646; + ret List.644; procedure Num.127 (#Attr.2): let Num.297 : U8 = lowlevel NumIntCast #Attr.2; @@ -303,20 +303,20 @@ procedure Num.94 (#Attr.2, #Attr.3): ret Num.302; procedure Str.12 (#Attr.2): - let Str.313 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.313; + let Str.309 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.309; procedure Str.4 (#Attr.2, #Attr.3): - let Str.316 : Str = lowlevel StrJoinWith #Attr.2 #Attr.3; - ret Str.316; + let Str.312 : Str = lowlevel StrJoinWith #Attr.2 #Attr.3; + ret Str.312; procedure Str.48 (#Attr.2, #Attr.3, #Attr.4): let Str.307 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; ret Str.307; procedure Str.55 (#Attr.2): - let Str.319 : List Str = lowlevel StrGraphemes #Attr.2; - ret Str.319; + let Str.315 : List Str = lowlevel StrGraphemes #Attr.2; + ret Str.315; procedure Str.9 (Str.79): let Str.305 : U64 = 0i64; @@ -330,8 +330,8 @@ procedure Str.9 (Str.79): else let Str.300 : U8 = StructAtIndex 3 Str.80; let Str.301 : U64 = StructAtIndex 0 Str.80; - let #Derived_gen.20 : Str = StructAtIndex 1 Str.80; - dec #Derived_gen.20; + let #Derived_gen.42 : Str = StructAtIndex 1 Str.80; + dec #Derived_gen.42; let Str.299 : {U64, U8} = Struct {Str.301, Str.300}; let Str.298 : [C {U64, U8}, C Str] = TagId(0) Str.299; ret Str.298; @@ -1222,14 +1222,14 @@ procedure TotallyNotJson.82 (TotallyNotJson.802, TotallyNotJson.803): procedure TotallyNotJson.832 (TotallyNotJson.1493): let TotallyNotJson.1494 : List Str = StructAtIndex 1 TotallyNotJson.1493; - let #Derived_gen.18 : List Str = StructAtIndex 0 TotallyNotJson.1493; - dec #Derived_gen.18; + let #Derived_gen.40 : List Str = StructAtIndex 0 TotallyNotJson.1493; + dec #Derived_gen.40; ret TotallyNotJson.1494; procedure TotallyNotJson.840 (TotallyNotJson.1214): let TotallyNotJson.1215 : List Str = StructAtIndex 1 TotallyNotJson.1214; - let #Derived_gen.19 : List Str = StructAtIndex 0 TotallyNotJson.1214; - dec #Derived_gen.19; + let #Derived_gen.41 : List Str = StructAtIndex 0 TotallyNotJson.1214; + dec #Derived_gen.41; ret TotallyNotJson.1215; procedure TotallyNotJson.87 (TotallyNotJson.809): @@ -1284,7 +1284,7 @@ procedure TotallyNotJson.95 (TotallyNotJson.829): dec TotallyNotJson.1489; ret TotallyNotJson.1488; -procedure TotallyNotJson.96 (TotallyNotJson.1633): +procedure TotallyNotJson.96 (#Derived_gen.36): joinpoint TotallyNotJson.1496 TotallyNotJson.1168: let TotallyNotJson.834 : List Str = StructAtIndex 0 TotallyNotJson.1168; let TotallyNotJson.833 : List Str = StructAtIndex 1 TotallyNotJson.1168; @@ -1320,7 +1320,7 @@ procedure TotallyNotJson.96 (TotallyNotJson.1633): let TotallyNotJson.1497 : {List Str, List Str} = Struct {TotallyNotJson.834, TotallyNotJson.833}; ret TotallyNotJson.1497; in - jump TotallyNotJson.1496 TotallyNotJson.1633; + jump TotallyNotJson.1496 #Derived_gen.36; procedure TotallyNotJson.97 (TotallyNotJson.837): let TotallyNotJson.838 : List Str = CallByName Str.55 TotallyNotJson.837; @@ -1337,7 +1337,7 @@ procedure TotallyNotJson.97 (TotallyNotJson.837): dec TotallyNotJson.1210; ret TotallyNotJson.1209; -procedure TotallyNotJson.98 (TotallyNotJson.1624): +procedure TotallyNotJson.98 (#Derived_gen.14): joinpoint TotallyNotJson.1217 TotallyNotJson.1169: let TotallyNotJson.842 : List Str = StructAtIndex 0 TotallyNotJson.1169; let TotallyNotJson.841 : List Str = StructAtIndex 1 TotallyNotJson.1169; @@ -1373,7 +1373,7 @@ procedure TotallyNotJson.98 (TotallyNotJson.1624): let TotallyNotJson.1218 : {List Str, List Str} = Struct {TotallyNotJson.842, TotallyNotJson.841}; ret TotallyNotJson.1218; in - jump TotallyNotJson.1217 TotallyNotJson.1624; + jump TotallyNotJson.1217 #Derived_gen.14; procedure Test.0 (): let Test.11 : Str = "foo"; diff --git a/crates/compiler/test_mono/generated/encode_derived_string.txt b/crates/compiler/test_mono/generated/encode_derived_string.txt index 5685ff13aed..57d54ca67a8 100644 --- a/crates/compiler/test_mono/generated/encode_derived_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_string.txt @@ -16,130 +16,130 @@ procedure Encode.26 (Encode.105, Encode.106): ret Encode.108; procedure List.145 (List.146, List.147, List.144): - let List.553 : List U8 = CallByName TotallyNotJson.215 List.146 List.147; - ret List.553; + let List.552 : List U8 = CallByName TotallyNotJson.215 List.146 List.147; + ret List.552; procedure List.18 (List.142, List.143, List.144): - let List.535 : List U8 = CallByName List.93 List.142 List.143 List.144; - ret List.535; + let List.534 : List U8 = CallByName List.93 List.142 List.143 List.144; + ret List.534; procedure List.26 (List.159, List.160, List.161): - let List.570 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.93 List.159 List.160 List.161; - let List.573 : U8 = 1i64; - let List.574 : U8 = GetTagId List.570; - let List.575 : Int1 = lowlevel Eq List.573 List.574; - if List.575 then - let List.162 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.570; + let List.569 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.93 List.159 List.160 List.161; + let List.572 : U8 = 1i64; + let List.573 : U8 = GetTagId List.569; + let List.574 : Int1 = lowlevel Eq List.572 List.573; + if List.574 then + let List.162 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.569; ret List.162; else - let List.163 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.570; + let List.163 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.569; ret List.163; procedure List.49 (List.376, List.377): - let List.562 : U64 = StructAtIndex 0 List.377; - let List.563 : U64 = 0i64; - let List.560 : Int1 = CallByName Bool.11 List.562 List.563; - if List.560 then + let List.561 : U64 = StructAtIndex 0 List.377; + let List.562 : U64 = 0i64; + let List.559 : Int1 = CallByName Bool.11 List.561 List.562; + if List.559 then dec List.376; - let List.561 : List U8 = Array []; - ret List.561; + let List.560 : List U8 = Array []; + ret List.560; else - let List.557 : U64 = StructAtIndex 1 List.377; - let List.558 : U64 = StructAtIndex 0 List.377; - let List.556 : List U8 = CallByName List.72 List.376 List.557 List.558; - ret List.556; + let List.556 : U64 = StructAtIndex 1 List.377; + let List.557 : U64 = StructAtIndex 0 List.377; + let List.555 : List U8 = CallByName List.72 List.376 List.556 List.557; + ret List.555; procedure List.52 (List.391, List.392): let List.393 : U64 = CallByName List.6 List.391; - joinpoint List.568 List.394: - let List.566 : U64 = 0i64; - let List.565 : {U64, U64} = Struct {List.394, List.566}; + joinpoint List.567 List.394: + let List.565 : U64 = 0i64; + let List.564 : {U64, U64} = Struct {List.394, List.565}; inc List.391; - let List.395 : List U8 = CallByName List.49 List.391 List.565; - let List.564 : U64 = CallByName Num.20 List.393 List.394; - let List.555 : {U64, U64} = Struct {List.564, List.394}; - let List.396 : List U8 = CallByName List.49 List.391 List.555; - let List.554 : {List U8, List U8} = Struct {List.395, List.396}; - ret List.554; + let List.395 : List U8 = CallByName List.49 List.391 List.564; + let List.563 : U64 = CallByName Num.20 List.393 List.394; + let List.554 : {U64, U64} = Struct {List.563, List.394}; + let List.396 : List U8 = CallByName List.49 List.391 List.554; + let List.553 : {List U8, List U8} = Struct {List.395, List.396}; + ret List.553; in - let List.569 : Int1 = CallByName Num.24 List.393 List.392; - if List.569 then - jump List.568 List.392; + let List.568 : Int1 = CallByName Num.24 List.393 List.392; + if List.568 then + jump List.567 List.392; else - jump List.568 List.393; + jump List.567 List.393; procedure List.6 (#Attr.2): - let List.534 : U64 = lowlevel ListLen #Attr.2; - ret List.534; + let List.533 : U64 = lowlevel ListLen #Attr.2; + ret List.533; procedure List.66 (#Attr.2, #Attr.3): - let List.551 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.551; + let List.550 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.550; procedure List.68 (#Attr.2): - let List.532 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.532; + let List.531 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.531; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.559 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.559; + let List.558 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.558; procedure List.8 (#Attr.2, #Attr.3): - let List.530 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.530; - -procedure List.80 (List.598, List.599, List.600, List.601, List.602): - joinpoint List.541 List.439 List.440 List.441 List.442 List.443: - let List.543 : Int1 = CallByName Num.22 List.442 List.443; - if List.543 then - let List.550 : U8 = CallByName List.66 List.439 List.442; - let List.544 : List U8 = CallByName List.145 List.440 List.550 List.441; - let List.547 : U64 = 1i64; - let List.546 : U64 = CallByName Num.19 List.442 List.547; - jump List.541 List.439 List.544 List.441 List.546 List.443; + let List.529 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.529; + +procedure List.80 (#Derived_gen.3, #Derived_gen.4, #Derived_gen.5, #Derived_gen.6, #Derived_gen.7): + joinpoint List.578 List.439 List.440 List.441 List.442 List.443: + let List.580 : Int1 = CallByName Num.22 List.442 List.443; + if List.580 then + let List.589 : U8 = CallByName List.66 List.439 List.442; + let List.581 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.589; + let List.586 : U8 = 1i64; + let List.587 : U8 = GetTagId List.581; + let List.588 : Int1 = lowlevel Eq List.586 List.587; + if List.588 then + let List.444 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.581; + let List.584 : U64 = 1i64; + let List.583 : U64 = CallByName Num.19 List.442 List.584; + jump List.578 List.439 List.444 List.441 List.583 List.443; + else + dec List.439; + let List.445 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.581; + let List.585 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.445; + ret List.585; else dec List.439; - ret List.440; + let List.579 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.440; + ret List.579; in - jump List.541 List.598 List.599 List.600 List.601 List.602; - -procedure List.80 (List.621, List.622, List.623, List.624, List.625): - joinpoint List.579 List.439 List.440 List.441 List.442 List.443: - let List.581 : Int1 = CallByName Num.22 List.442 List.443; - if List.581 then - let List.590 : U8 = CallByName List.66 List.439 List.442; - let List.582 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.590; - let List.587 : U8 = 1i64; - let List.588 : U8 = GetTagId List.582; - let List.589 : Int1 = lowlevel Eq List.587 List.588; - if List.589 then - let List.444 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.582; - let List.585 : U64 = 1i64; - let List.584 : U64 = CallByName Num.19 List.442 List.585; - jump List.579 List.439 List.444 List.441 List.584 List.443; - else - dec List.439; - let List.445 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.582; - let List.586 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.445; - ret List.586; + jump List.578 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7; + +procedure List.80 (#Derived_gen.8, #Derived_gen.9, #Derived_gen.10, #Derived_gen.11, #Derived_gen.12): + joinpoint List.540 List.439 List.440 List.441 List.442 List.443: + let List.542 : Int1 = CallByName Num.22 List.442 List.443; + if List.542 then + let List.549 : U8 = CallByName List.66 List.439 List.442; + let List.543 : List U8 = CallByName List.145 List.440 List.549 List.441; + let List.546 : U64 = 1i64; + let List.545 : U64 = CallByName Num.19 List.442 List.546; + jump List.540 List.439 List.543 List.441 List.545 List.443; else dec List.439; - let List.580 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.440; - ret List.580; + ret List.440; in - jump List.579 List.621 List.622 List.623 List.624 List.625; + jump List.540 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12; procedure List.93 (List.436, List.437, List.438): - let List.539 : U64 = 0i64; - let List.540 : U64 = CallByName List.6 List.436; - let List.538 : List U8 = CallByName List.80 List.436 List.437 List.438 List.539 List.540; - ret List.538; + let List.538 : U64 = 0i64; + let List.539 : U64 = CallByName List.6 List.436; + let List.537 : List U8 = CallByName List.80 List.436 List.437 List.438 List.538 List.539; + ret List.537; procedure List.93 (List.436, List.437, List.438): - let List.577 : U64 = 0i64; - let List.578 : U64 = CallByName List.6 List.436; - let List.576 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.436 List.437 List.438 List.577 List.578; - ret List.576; + let List.576 : U64 = 0i64; + let List.577 : U64 = CallByName List.6 List.436; + let List.575 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.436 List.437 List.438 List.576 List.577; + ret List.575; procedure Num.19 (#Attr.2, #Attr.3): let Num.297 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; @@ -166,8 +166,8 @@ procedure Num.94 (#Attr.2, #Attr.3): ret Num.294; procedure Str.12 (#Attr.2): - let Str.312 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.312; + let Str.308 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.308; procedure Str.48 (#Attr.2, #Attr.3, #Attr.4): let Str.307 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; @@ -185,8 +185,8 @@ procedure Str.9 (Str.79): else let Str.300 : U8 = StructAtIndex 3 Str.80; let Str.301 : U64 = StructAtIndex 0 Str.80; - let #Derived_gen.0 : Str = StructAtIndex 1 Str.80; - dec #Derived_gen.0; + let #Derived_gen.13 : Str = StructAtIndex 1 Str.80; + dec #Derived_gen.13; let Str.299 : {U64, U8} = Struct {Str.301, Str.300}; let Str.298 : [C {U64, U8}, C Str] = TagId(0) Str.299; ret Str.298; diff --git a/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt b/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt index 1908d7dc0a7..8ec699d6a79 100644 --- a/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt @@ -31,12 +31,12 @@ procedure Encode.24 (Encode.99, Encode.107, Encode.101): ret Encode.111; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.118 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107; - ret Encode.118; + let Encode.113 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107; + ret Encode.113; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.121 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; - ret Encode.121; + let Encode.116 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; + ret Encode.116; procedure Encode.26 (Encode.105, Encode.106): let Encode.109 : List U8 = Array []; @@ -45,182 +45,182 @@ procedure Encode.26 (Encode.105, Encode.106): ret Encode.108; procedure List.145 (List.146, List.147, List.144): - let List.568 : {List U8, U64} = CallByName TotallyNotJson.267 List.146 List.147 List.144; - ret List.568; + let List.567 : {List U8, U64} = CallByName TotallyNotJson.267 List.146 List.147 List.144; + ret List.567; procedure List.145 (List.146, List.147, List.144): - let List.588 : List U8 = CallByName TotallyNotJson.215 List.146 List.147; - ret List.588; + let List.587 : List U8 = CallByName TotallyNotJson.215 List.146 List.147; + ret List.587; procedure List.18 (List.142, List.143, List.144): - let List.549 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; - ret List.549; + let List.548 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; + ret List.548; procedure List.18 (List.142, List.143, List.144): - let List.569 : List U8 = CallByName List.93 List.142 List.143 List.144; - ret List.569; + let List.568 : List U8 = CallByName List.93 List.142 List.143 List.144; + ret List.568; procedure List.26 (List.159, List.160, List.161): - let List.619 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.93 List.159 List.160 List.161; - let List.622 : U8 = 1i64; - let List.623 : U8 = GetTagId List.619; - let List.624 : Int1 = lowlevel Eq List.622 List.623; - if List.624 then - let List.162 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.619; + let List.618 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.93 List.159 List.160 List.161; + let List.621 : U8 = 1i64; + let List.622 : U8 = GetTagId List.618; + let List.623 : Int1 = lowlevel Eq List.621 List.622; + if List.623 then + let List.162 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.618; ret List.162; else - let List.163 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.619; + let List.163 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.618; ret List.163; procedure List.4 (List.113, List.114): - let List.548 : U64 = 1i64; - let List.547 : List U8 = CallByName List.70 List.113 List.548; - let List.546 : List U8 = CallByName List.71 List.547 List.114; - ret List.546; + let List.547 : U64 = 1i64; + let List.546 : List U8 = CallByName List.70 List.113 List.547; + let List.545 : List U8 = CallByName List.71 List.546 List.114; + ret List.545; procedure List.49 (List.376, List.377): - let List.611 : U64 = StructAtIndex 0 List.377; - let List.612 : U64 = 0i64; - let List.609 : Int1 = CallByName Bool.11 List.611 List.612; - if List.609 then + let List.610 : U64 = StructAtIndex 0 List.377; + let List.611 : U64 = 0i64; + let List.608 : Int1 = CallByName Bool.11 List.610 List.611; + if List.608 then dec List.376; - let List.610 : List U8 = Array []; - ret List.610; + let List.609 : List U8 = Array []; + ret List.609; else - let List.606 : U64 = StructAtIndex 1 List.377; - let List.607 : U64 = StructAtIndex 0 List.377; - let List.605 : List U8 = CallByName List.72 List.376 List.606 List.607; - ret List.605; + let List.605 : U64 = StructAtIndex 1 List.377; + let List.606 : U64 = StructAtIndex 0 List.377; + let List.604 : List U8 = CallByName List.72 List.376 List.605 List.606; + ret List.604; procedure List.52 (List.391, List.392): let List.393 : U64 = CallByName List.6 List.391; - joinpoint List.617 List.394: - let List.615 : U64 = 0i64; - let List.614 : {U64, U64} = Struct {List.394, List.615}; + joinpoint List.616 List.394: + let List.614 : U64 = 0i64; + let List.613 : {U64, U64} = Struct {List.394, List.614}; inc List.391; - let List.395 : List U8 = CallByName List.49 List.391 List.614; - let List.613 : U64 = CallByName Num.20 List.393 List.394; - let List.604 : {U64, U64} = Struct {List.613, List.394}; - let List.396 : List U8 = CallByName List.49 List.391 List.604; - let List.603 : {List U8, List U8} = Struct {List.395, List.396}; - ret List.603; + let List.395 : List U8 = CallByName List.49 List.391 List.613; + let List.612 : U64 = CallByName Num.20 List.393 List.394; + let List.603 : {U64, U64} = Struct {List.612, List.394}; + let List.396 : List U8 = CallByName List.49 List.391 List.603; + let List.602 : {List U8, List U8} = Struct {List.395, List.396}; + ret List.602; in - let List.618 : Int1 = CallByName Num.24 List.393 List.392; - if List.618 then - jump List.617 List.392; + let List.617 : Int1 = CallByName Num.24 List.393 List.392; + if List.617 then + jump List.616 List.392; else - jump List.617 List.393; + jump List.616 List.393; procedure List.6 (#Attr.2): - let List.589 : U64 = lowlevel ListLen #Attr.2; - ret List.589; + let List.588 : U64 = lowlevel ListLen #Attr.2; + ret List.588; procedure List.6 (#Attr.2): - let List.591 : U64 = lowlevel ListLen #Attr.2; - ret List.591; + let List.590 : U64 = lowlevel ListLen #Attr.2; + ret List.590; procedure List.66 (#Attr.2, #Attr.3): - let List.565 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.565; + let List.564 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.564; procedure List.66 (#Attr.2, #Attr.3): - let List.585 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.585; + let List.584 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.584; procedure List.68 (#Attr.2): - let List.602 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.602; + let List.601 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.601; procedure List.70 (#Attr.2, #Attr.3): - let List.527 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.527; + let List.526 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.526; procedure List.71 (#Attr.2, #Attr.3): - let List.525 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.525; + let List.524 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.524; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.608 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.608; + let List.607 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.607; procedure List.8 (#Attr.2, #Attr.3): - let List.600 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.600; - -procedure List.80 (List.649, List.650, List.651, List.652, List.653): - joinpoint List.555 List.439 List.440 List.441 List.442 List.443: - let List.557 : Int1 = CallByName Num.22 List.442 List.443; - if List.557 then - let List.564 : Str = CallByName List.66 List.439 List.442; - inc List.564; - let List.558 : {List U8, U64} = CallByName List.145 List.440 List.564 List.441; - let List.561 : U64 = 1i64; - let List.560 : U64 = CallByName Num.19 List.442 List.561; - jump List.555 List.439 List.558 List.441 List.560 List.443; + let List.599 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.599; + +procedure List.80 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): + joinpoint List.554 List.439 List.440 List.441 List.442 List.443: + let List.556 : Int1 = CallByName Num.22 List.442 List.443; + if List.556 then + let List.563 : Str = CallByName List.66 List.439 List.442; + inc List.563; + let List.557 : {List U8, U64} = CallByName List.145 List.440 List.563 List.441; + let List.560 : U64 = 1i64; + let List.559 : U64 = CallByName Num.19 List.442 List.560; + jump List.554 List.439 List.557 List.441 List.559 List.443; else dec List.439; ret List.440; in - jump List.555 List.649 List.650 List.651 List.652 List.653; - -procedure List.80 (List.666, List.667, List.668, List.669, List.670): - joinpoint List.575 List.439 List.440 List.441 List.442 List.443: - let List.577 : Int1 = CallByName Num.22 List.442 List.443; - if List.577 then - let List.584 : U8 = CallByName List.66 List.439 List.442; - let List.578 : List U8 = CallByName List.145 List.440 List.584 List.441; - let List.581 : U64 = 1i64; - let List.580 : U64 = CallByName Num.19 List.442 List.581; - jump List.575 List.439 List.578 List.441 List.580 List.443; + jump List.554 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; + +procedure List.80 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): + joinpoint List.574 List.439 List.440 List.441 List.442 List.443: + let List.576 : Int1 = CallByName Num.22 List.442 List.443; + if List.576 then + let List.583 : U8 = CallByName List.66 List.439 List.442; + let List.577 : List U8 = CallByName List.145 List.440 List.583 List.441; + let List.580 : U64 = 1i64; + let List.579 : U64 = CallByName Num.19 List.442 List.580; + jump List.574 List.439 List.577 List.441 List.579 List.443; else dec List.439; ret List.440; in - jump List.575 List.666 List.667 List.668 List.669 List.670; - -procedure List.80 (List.693, List.694, List.695, List.696, List.697): - joinpoint List.628 List.439 List.440 List.441 List.442 List.443: - let List.630 : Int1 = CallByName Num.22 List.442 List.443; - if List.630 then - let List.639 : U8 = CallByName List.66 List.439 List.442; - let List.631 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.639; - let List.636 : U8 = 1i64; - let List.637 : U8 = GetTagId List.631; - let List.638 : Int1 = lowlevel Eq List.636 List.637; - if List.638 then - let List.444 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.631; - let List.634 : U64 = 1i64; - let List.633 : U64 = CallByName Num.19 List.442 List.634; - jump List.628 List.439 List.444 List.441 List.633 List.443; + jump List.574 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; + +procedure List.80 (#Derived_gen.29, #Derived_gen.30, #Derived_gen.31, #Derived_gen.32, #Derived_gen.33): + joinpoint List.627 List.439 List.440 List.441 List.442 List.443: + let List.629 : Int1 = CallByName Num.22 List.442 List.443; + if List.629 then + let List.638 : U8 = CallByName List.66 List.439 List.442; + let List.630 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.638; + let List.635 : U8 = 1i64; + let List.636 : U8 = GetTagId List.630; + let List.637 : Int1 = lowlevel Eq List.635 List.636; + if List.637 then + let List.444 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.630; + let List.633 : U64 = 1i64; + let List.632 : U64 = CallByName Num.19 List.442 List.633; + jump List.627 List.439 List.444 List.441 List.632 List.443; else dec List.439; - let List.445 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.631; - let List.635 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.445; - ret List.635; + let List.445 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.630; + let List.634 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.445; + ret List.634; else dec List.439; - let List.629 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.440; - ret List.629; + let List.628 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.440; + ret List.628; in - jump List.628 List.693 List.694 List.695 List.696 List.697; + jump List.627 #Derived_gen.29 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33; procedure List.93 (List.436, List.437, List.438): - let List.553 : U64 = 0i64; - let List.554 : U64 = CallByName List.6 List.436; - let List.552 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.553 List.554; - ret List.552; + let List.552 : U64 = 0i64; + let List.553 : U64 = CallByName List.6 List.436; + let List.551 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.552 List.553; + ret List.551; procedure List.93 (List.436, List.437, List.438): - let List.573 : U64 = 0i64; - let List.574 : U64 = CallByName List.6 List.436; - let List.572 : List U8 = CallByName List.80 List.436 List.437 List.438 List.573 List.574; - ret List.572; + let List.572 : U64 = 0i64; + let List.573 : U64 = CallByName List.6 List.436; + let List.571 : List U8 = CallByName List.80 List.436 List.437 List.438 List.572 List.573; + ret List.571; procedure List.93 (List.436, List.437, List.438): - let List.626 : U64 = 0i64; - let List.627 : U64 = CallByName List.6 List.436; - let List.625 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.436 List.437 List.438 List.626 List.627; - ret List.625; + let List.625 : U64 = 0i64; + let List.626 : U64 = CallByName List.6 List.436; + let List.624 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.436 List.437 List.438 List.625 List.626; + ret List.624; procedure Num.127 (#Attr.2): let Num.299 : U8 = lowlevel NumIntCast #Attr.2; @@ -251,8 +251,8 @@ procedure Num.94 (#Attr.2, #Attr.3): ret Num.304; procedure Str.12 (#Attr.2): - let Str.313 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.313; + let Str.309 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.309; procedure Str.48 (#Attr.2, #Attr.3, #Attr.4): let Str.307 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; @@ -270,8 +270,8 @@ procedure Str.9 (Str.79): else let Str.300 : U8 = StructAtIndex 3 Str.80; let Str.301 : U64 = StructAtIndex 0 Str.80; - let #Derived_gen.14 : Str = StructAtIndex 1 Str.80; - dec #Derived_gen.14; + let #Derived_gen.34 : Str = StructAtIndex 1 Str.80; + dec #Derived_gen.34; let Str.299 : {U64, U8} = Struct {Str.301, Str.300}; let Str.298 : [C {U64, U8}, C Str] = TagId(0) Str.299; ret Str.298; diff --git a/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt b/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt index 147632f0945..c0ccba518fc 100644 --- a/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt @@ -34,12 +34,12 @@ procedure Encode.24 (Encode.99, Encode.107, Encode.101): ret Encode.111; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.118 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107; - ret Encode.118; + let Encode.113 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107; + ret Encode.113; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.122 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; - ret Encode.122; + let Encode.117 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; + ret Encode.117; procedure Encode.26 (Encode.105, Encode.106): let Encode.109 : List U8 = Array []; @@ -48,182 +48,182 @@ procedure Encode.26 (Encode.105, Encode.106): ret Encode.108; procedure List.145 (List.146, List.147, List.144): - let List.568 : {List U8, U64} = CallByName TotallyNotJson.267 List.146 List.147 List.144; - ret List.568; + let List.567 : {List U8, U64} = CallByName TotallyNotJson.267 List.146 List.147 List.144; + ret List.567; procedure List.145 (List.146, List.147, List.144): - let List.588 : List U8 = CallByName TotallyNotJson.215 List.146 List.147; - ret List.588; + let List.587 : List U8 = CallByName TotallyNotJson.215 List.146 List.147; + ret List.587; procedure List.18 (List.142, List.143, List.144): - let List.549 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; - ret List.549; + let List.548 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; + ret List.548; procedure List.18 (List.142, List.143, List.144): - let List.569 : List U8 = CallByName List.93 List.142 List.143 List.144; - ret List.569; + let List.568 : List U8 = CallByName List.93 List.142 List.143 List.144; + ret List.568; procedure List.26 (List.159, List.160, List.161): - let List.619 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.93 List.159 List.160 List.161; - let List.622 : U8 = 1i64; - let List.623 : U8 = GetTagId List.619; - let List.624 : Int1 = lowlevel Eq List.622 List.623; - if List.624 then - let List.162 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.619; + let List.618 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.93 List.159 List.160 List.161; + let List.621 : U8 = 1i64; + let List.622 : U8 = GetTagId List.618; + let List.623 : Int1 = lowlevel Eq List.621 List.622; + if List.623 then + let List.162 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.618; ret List.162; else - let List.163 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.619; + let List.163 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.618; ret List.163; procedure List.4 (List.113, List.114): - let List.548 : U64 = 1i64; - let List.547 : List U8 = CallByName List.70 List.113 List.548; - let List.546 : List U8 = CallByName List.71 List.547 List.114; - ret List.546; + let List.547 : U64 = 1i64; + let List.546 : List U8 = CallByName List.70 List.113 List.547; + let List.545 : List U8 = CallByName List.71 List.546 List.114; + ret List.545; procedure List.49 (List.376, List.377): - let List.611 : U64 = StructAtIndex 0 List.377; - let List.612 : U64 = 0i64; - let List.609 : Int1 = CallByName Bool.11 List.611 List.612; - if List.609 then + let List.610 : U64 = StructAtIndex 0 List.377; + let List.611 : U64 = 0i64; + let List.608 : Int1 = CallByName Bool.11 List.610 List.611; + if List.608 then dec List.376; - let List.610 : List U8 = Array []; - ret List.610; + let List.609 : List U8 = Array []; + ret List.609; else - let List.606 : U64 = StructAtIndex 1 List.377; - let List.607 : U64 = StructAtIndex 0 List.377; - let List.605 : List U8 = CallByName List.72 List.376 List.606 List.607; - ret List.605; + let List.605 : U64 = StructAtIndex 1 List.377; + let List.606 : U64 = StructAtIndex 0 List.377; + let List.604 : List U8 = CallByName List.72 List.376 List.605 List.606; + ret List.604; procedure List.52 (List.391, List.392): let List.393 : U64 = CallByName List.6 List.391; - joinpoint List.617 List.394: - let List.615 : U64 = 0i64; - let List.614 : {U64, U64} = Struct {List.394, List.615}; + joinpoint List.616 List.394: + let List.614 : U64 = 0i64; + let List.613 : {U64, U64} = Struct {List.394, List.614}; inc List.391; - let List.395 : List U8 = CallByName List.49 List.391 List.614; - let List.613 : U64 = CallByName Num.20 List.393 List.394; - let List.604 : {U64, U64} = Struct {List.613, List.394}; - let List.396 : List U8 = CallByName List.49 List.391 List.604; - let List.603 : {List U8, List U8} = Struct {List.395, List.396}; - ret List.603; + let List.395 : List U8 = CallByName List.49 List.391 List.613; + let List.612 : U64 = CallByName Num.20 List.393 List.394; + let List.603 : {U64, U64} = Struct {List.612, List.394}; + let List.396 : List U8 = CallByName List.49 List.391 List.603; + let List.602 : {List U8, List U8} = Struct {List.395, List.396}; + ret List.602; in - let List.618 : Int1 = CallByName Num.24 List.393 List.392; - if List.618 then - jump List.617 List.392; + let List.617 : Int1 = CallByName Num.24 List.393 List.392; + if List.617 then + jump List.616 List.392; else - jump List.617 List.393; + jump List.616 List.393; procedure List.6 (#Attr.2): - let List.589 : U64 = lowlevel ListLen #Attr.2; - ret List.589; + let List.588 : U64 = lowlevel ListLen #Attr.2; + ret List.588; procedure List.6 (#Attr.2): - let List.591 : U64 = lowlevel ListLen #Attr.2; - ret List.591; + let List.590 : U64 = lowlevel ListLen #Attr.2; + ret List.590; procedure List.66 (#Attr.2, #Attr.3): - let List.565 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.565; + let List.564 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.564; procedure List.66 (#Attr.2, #Attr.3): - let List.585 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.585; + let List.584 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.584; procedure List.68 (#Attr.2): - let List.602 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.602; + let List.601 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.601; procedure List.70 (#Attr.2, #Attr.3): - let List.527 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.527; + let List.526 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.526; procedure List.71 (#Attr.2, #Attr.3): - let List.525 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.525; + let List.524 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.524; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.608 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.608; + let List.607 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.607; procedure List.8 (#Attr.2, #Attr.3): - let List.600 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.600; - -procedure List.80 (List.649, List.650, List.651, List.652, List.653): - joinpoint List.555 List.439 List.440 List.441 List.442 List.443: - let List.557 : Int1 = CallByName Num.22 List.442 List.443; - if List.557 then - let List.564 : Str = CallByName List.66 List.439 List.442; - inc List.564; - let List.558 : {List U8, U64} = CallByName List.145 List.440 List.564 List.441; - let List.561 : U64 = 1i64; - let List.560 : U64 = CallByName Num.19 List.442 List.561; - jump List.555 List.439 List.558 List.441 List.560 List.443; + let List.599 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.599; + +procedure List.80 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24): + joinpoint List.574 List.439 List.440 List.441 List.442 List.443: + let List.576 : Int1 = CallByName Num.22 List.442 List.443; + if List.576 then + let List.583 : U8 = CallByName List.66 List.439 List.442; + let List.577 : List U8 = CallByName List.145 List.440 List.583 List.441; + let List.580 : U64 = 1i64; + let List.579 : U64 = CallByName Num.19 List.442 List.580; + jump List.574 List.439 List.577 List.441 List.579 List.443; else dec List.439; ret List.440; in - jump List.555 List.649 List.650 List.651 List.652 List.653; - -procedure List.80 (List.666, List.667, List.668, List.669, List.670): - joinpoint List.575 List.439 List.440 List.441 List.442 List.443: - let List.577 : Int1 = CallByName Num.22 List.442 List.443; - if List.577 then - let List.584 : U8 = CallByName List.66 List.439 List.442; - let List.578 : List U8 = CallByName List.145 List.440 List.584 List.441; - let List.581 : U64 = 1i64; - let List.580 : U64 = CallByName Num.19 List.442 List.581; - jump List.575 List.439 List.578 List.441 List.580 List.443; + jump List.574 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24; + +procedure List.80 (#Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29): + joinpoint List.627 List.439 List.440 List.441 List.442 List.443: + let List.629 : Int1 = CallByName Num.22 List.442 List.443; + if List.629 then + let List.638 : U8 = CallByName List.66 List.439 List.442; + let List.630 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.638; + let List.635 : U8 = 1i64; + let List.636 : U8 = GetTagId List.630; + let List.637 : Int1 = lowlevel Eq List.635 List.636; + if List.637 then + let List.444 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.630; + let List.633 : U64 = 1i64; + let List.632 : U64 = CallByName Num.19 List.442 List.633; + jump List.627 List.439 List.444 List.441 List.632 List.443; + else + dec List.439; + let List.445 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.630; + let List.634 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.445; + ret List.634; else dec List.439; - ret List.440; + let List.628 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.440; + ret List.628; in - jump List.575 List.666 List.667 List.668 List.669 List.670; - -procedure List.80 (List.693, List.694, List.695, List.696, List.697): - joinpoint List.628 List.439 List.440 List.441 List.442 List.443: - let List.630 : Int1 = CallByName Num.22 List.442 List.443; - if List.630 then - let List.639 : U8 = CallByName List.66 List.439 List.442; - let List.631 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.189 List.440 List.639; - let List.636 : U8 = 1i64; - let List.637 : U8 = GetTagId List.631; - let List.638 : Int1 = lowlevel Eq List.636 List.637; - if List.638 then - let List.444 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.631; - let List.634 : U64 = 1i64; - let List.633 : U64 = CallByName Num.19 List.442 List.634; - jump List.628 List.439 List.444 List.441 List.633 List.443; - else - dec List.439; - let List.445 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.631; - let List.635 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.445; - ret List.635; + jump List.627 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29; + +procedure List.80 (#Derived_gen.30, #Derived_gen.31, #Derived_gen.32, #Derived_gen.33, #Derived_gen.34): + joinpoint List.554 List.439 List.440 List.441 List.442 List.443: + let List.556 : Int1 = CallByName Num.22 List.442 List.443; + if List.556 then + let List.563 : Str = CallByName List.66 List.439 List.442; + inc List.563; + let List.557 : {List U8, U64} = CallByName List.145 List.440 List.563 List.441; + let List.560 : U64 = 1i64; + let List.559 : U64 = CallByName Num.19 List.442 List.560; + jump List.554 List.439 List.557 List.441 List.559 List.443; else dec List.439; - let List.629 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.440; - ret List.629; + ret List.440; in - jump List.628 List.693 List.694 List.695 List.696 List.697; + jump List.554 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34; procedure List.93 (List.436, List.437, List.438): - let List.553 : U64 = 0i64; - let List.554 : U64 = CallByName List.6 List.436; - let List.552 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.553 List.554; - ret List.552; + let List.552 : U64 = 0i64; + let List.553 : U64 = CallByName List.6 List.436; + let List.551 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.552 List.553; + ret List.551; procedure List.93 (List.436, List.437, List.438): - let List.573 : U64 = 0i64; - let List.574 : U64 = CallByName List.6 List.436; - let List.572 : List U8 = CallByName List.80 List.436 List.437 List.438 List.573 List.574; - ret List.572; + let List.572 : U64 = 0i64; + let List.573 : U64 = CallByName List.6 List.436; + let List.571 : List U8 = CallByName List.80 List.436 List.437 List.438 List.572 List.573; + ret List.571; procedure List.93 (List.436, List.437, List.438): - let List.626 : U64 = 0i64; - let List.627 : U64 = CallByName List.6 List.436; - let List.625 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.436 List.437 List.438 List.626 List.627; - ret List.625; + let List.625 : U64 = 0i64; + let List.626 : U64 = CallByName List.6 List.436; + let List.624 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.436 List.437 List.438 List.625 List.626; + ret List.624; procedure Num.127 (#Attr.2): let Num.299 : U8 = lowlevel NumIntCast #Attr.2; @@ -254,8 +254,8 @@ procedure Num.94 (#Attr.2, #Attr.3): ret Num.304; procedure Str.12 (#Attr.2): - let Str.313 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.313; + let Str.309 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.309; procedure Str.48 (#Attr.2, #Attr.3, #Attr.4): let Str.307 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; @@ -273,8 +273,8 @@ procedure Str.9 (Str.79): else let Str.300 : U8 = StructAtIndex 3 Str.80; let Str.301 : U64 = StructAtIndex 0 Str.80; - let #Derived_gen.15 : Str = StructAtIndex 1 Str.80; - dec #Derived_gen.15; + let #Derived_gen.35 : Str = StructAtIndex 1 Str.80; + dec #Derived_gen.35; let Str.299 : {U64, U8} = Struct {Str.301, Str.300}; let Str.298 : [C {U64, U8}, C Str] = TagId(0) Str.299; ret Str.298; diff --git a/crates/compiler/test_mono/generated/factorial.txt b/crates/compiler/test_mono/generated/factorial.txt index bc43696252d..5b844fd3d9d 100644 --- a/crates/compiler/test_mono/generated/factorial.txt +++ b/crates/compiler/test_mono/generated/factorial.txt @@ -6,7 +6,7 @@ procedure Num.21 (#Attr.2, #Attr.3): let Num.292 : I64 = lowlevel NumMul #Attr.2 #Attr.3; ret Num.292; -procedure Test.1 (Test.15, Test.16): +procedure Test.1 (#Derived_gen.0, #Derived_gen.1): joinpoint Test.7 Test.2 Test.3: let Test.13 : I64 = 0i64; let Test.14 : Int1 = lowlevel Eq Test.13 Test.2; @@ -18,7 +18,7 @@ procedure Test.1 (Test.15, Test.16): let Test.11 : I64 = CallByName Num.21 Test.2 Test.3; jump Test.7 Test.10 Test.11; in - jump Test.7 Test.15 Test.16; + jump Test.7 #Derived_gen.0 #Derived_gen.1; procedure Test.0 (): let Test.5 : I64 = 10i64; diff --git a/crates/compiler/test_mono/generated/inline_return_joinpoints_in_bool_lambda_set.txt b/crates/compiler/test_mono/generated/inline_return_joinpoints_in_bool_lambda_set.txt index 16466af3715..6f8a56f0cbe 100644 --- a/crates/compiler/test_mono/generated/inline_return_joinpoints_in_bool_lambda_set.txt +++ b/crates/compiler/test_mono/generated/inline_return_joinpoints_in_bool_lambda_set.txt @@ -9,7 +9,7 @@ procedure Num.19 (#Attr.2, #Attr.3): procedure Test.3 (Test.4): ret Test.4; -procedure Test.0 (Test.14): +procedure Test.0 (#Derived_gen.0): joinpoint Test.5 Test.1: joinpoint Test.10 Test.2: let Test.8 : I64 = 1i64; @@ -31,4 +31,4 @@ procedure Test.0 (Test.14): let Test.9 : Int1 = true; jump Test.10 Test.9; in - jump Test.5 Test.14; + jump Test.5 #Derived_gen.0; diff --git a/crates/compiler/test_mono/generated/inline_return_joinpoints_in_enum_lambda_set.txt b/crates/compiler/test_mono/generated/inline_return_joinpoints_in_enum_lambda_set.txt index bf4dcfca155..5265cdc174d 100644 --- a/crates/compiler/test_mono/generated/inline_return_joinpoints_in_enum_lambda_set.txt +++ b/crates/compiler/test_mono/generated/inline_return_joinpoints_in_enum_lambda_set.txt @@ -34,7 +34,7 @@ procedure Test.8 (Test.9): let Test.23 : I64 = CallByName Num.19 Test.9 Test.24; ret Test.23; -procedure Test.0 (Test.30): +procedure Test.0 (#Derived_gen.0): joinpoint Test.11 Test.1: let Test.25 : I64 = 1i64; let Test.13 : I64 = CallByName Num.19 Test.1 Test.25; @@ -57,4 +57,4 @@ procedure Test.0 (Test.30): ret Test.12; in - jump Test.11 Test.30; + jump Test.11 #Derived_gen.0; diff --git a/crates/compiler/test_mono/generated/inline_return_joinpoints_in_union_lambda_set.txt b/crates/compiler/test_mono/generated/inline_return_joinpoints_in_union_lambda_set.txt index cc5f96b3e6c..6ab49274c59 100644 --- a/crates/compiler/test_mono/generated/inline_return_joinpoints_in_union_lambda_set.txt +++ b/crates/compiler/test_mono/generated/inline_return_joinpoints_in_union_lambda_set.txt @@ -17,7 +17,7 @@ procedure Test.4 (Test.5, #Attr.12): let Test.16 : I64 = CallByName Num.19 Test.5 Test.1; ret Test.16; -procedure Test.0 (Test.25): +procedure Test.0 (#Derived_gen.0): joinpoint Test.7 Test.1: let Test.20 : I64 = 1i64; let Test.9 : I64 = CallByName Num.19 Test.1 Test.20; @@ -33,4 +33,4 @@ procedure Test.0 (Test.25): ret Test.8; in - jump Test.7 Test.25; + jump Test.7 #Derived_gen.0; diff --git a/crates/compiler/test_mono/generated/issue_3669.txt b/crates/compiler/test_mono/generated/issue_3669.txt index fd2126b6c9e..03438ca1040 100644 --- a/crates/compiler/test_mono/generated/issue_3669.txt +++ b/crates/compiler/test_mono/generated/issue_3669.txt @@ -2,7 +2,7 @@ procedure Bool.11 (#Attr.2, #Attr.3): let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3; ret Bool.23; -procedure Test.2 (Test.19): +procedure Test.2 (#Derived_gen.0): joinpoint Test.13 Test.7: let Test.16 : U8 = 1i64; let Test.17 : U8 = GetTagId Test.7; @@ -13,8 +13,8 @@ procedure Test.2 (Test.19): ret Test.14; else let Test.5 : [, C *self] = UnionAtIndex (Id 0) (Index 0) Test.7; - let #Derived_gen.0 : Int1 = lowlevel RefCountIsUnique Test.7; - if #Derived_gen.0 then + let #Derived_gen.1 : Int1 = lowlevel RefCountIsUnique Test.7; + if #Derived_gen.1 then decref Test.7; jump Test.13 Test.5; else @@ -22,7 +22,7 @@ procedure Test.2 (Test.19): decref Test.7; jump Test.13 Test.5; in - jump Test.13 Test.19; + jump Test.13 #Derived_gen.0; procedure Test.0 (): let Test.12 : [, C *self] = TagId(1) ; diff --git a/crates/compiler/test_mono/generated/issue_4749.txt b/crates/compiler/test_mono/generated/issue_4749.txt index 82602e8a385..f43c0ae8dc4 100644 --- a/crates/compiler/test_mono/generated/issue_4749.txt +++ b/crates/compiler/test_mono/generated/issue_4749.txt @@ -1,30 +1,30 @@ procedure Bool.1 (): - let Bool.55 : Int1 = false; - ret Bool.55; + let Bool.51 : Int1 = false; + ret Bool.51; procedure Bool.11 (#Attr.2, #Attr.3): let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3; ret Bool.23; procedure Bool.11 (#Attr.2, #Attr.3): - let Bool.46 : Int1 = lowlevel Eq #Attr.2 #Attr.3; - ret Bool.46; + let Bool.42 : Int1 = lowlevel Eq #Attr.2 #Attr.3; + ret Bool.42; procedure Bool.11 (#Attr.2, #Attr.3): - let Bool.67 : Int1 = lowlevel Eq #Attr.2 #Attr.3; - ret Bool.67; + let Bool.57 : Int1 = lowlevel Eq #Attr.2 #Attr.3; + ret Bool.57; procedure Bool.2 (): - let Bool.54 : Int1 = true; - ret Bool.54; + let Bool.50 : Int1 = true; + ret Bool.50; procedure Bool.3 (#Attr.2, #Attr.3): - let Bool.37 : Int1 = lowlevel And #Attr.2 #Attr.3; - ret Bool.37; + let Bool.33 : Int1 = lowlevel And #Attr.2 #Attr.3; + ret Bool.33; procedure Bool.4 (#Attr.2, #Attr.3): - let Bool.57 : Int1 = lowlevel Or #Attr.2 #Attr.3; - ret Bool.57; + let Bool.53 : Int1 = lowlevel Or #Attr.2 #Attr.3; + ret Bool.53; procedure Decode.24 (Decode.101): ret Decode.101; @@ -65,151 +65,151 @@ procedure Decode.27 (Decode.107, Decode.108): ret Decode.123; procedure List.1 (List.96): - let List.590 : U64 = CallByName List.6 List.96; + let List.588 : U64 = CallByName List.6 List.96; dec List.96; - let List.591 : U64 = 0i64; - let List.589 : Int1 = CallByName Bool.11 List.590 List.591; - ret List.589; + let List.589 : U64 = 0i64; + let List.587 : Int1 = CallByName Bool.11 List.588 List.589; + ret List.587; procedure List.2 (List.97, List.98): - let List.573 : U64 = CallByName List.6 List.97; - let List.570 : Int1 = CallByName Num.22 List.98 List.573; - if List.570 then - let List.572 : U8 = CallByName List.66 List.97 List.98; + let List.571 : U64 = CallByName List.6 List.97; + let List.568 : Int1 = CallByName Num.22 List.98 List.571; + if List.568 then + let List.570 : U8 = CallByName List.66 List.97 List.98; dec List.97; - let List.571 : [C {}, C U8] = TagId(1) List.572; - ret List.571; + let List.569 : [C {}, C U8] = TagId(1) List.570; + ret List.569; else dec List.97; - let List.569 : {} = Struct {}; - let List.568 : [C {}, C U8] = TagId(0) List.569; - ret List.568; + let List.567 : {} = Struct {}; + let List.566 : [C {}, C U8] = TagId(0) List.567; + ret List.566; procedure List.26 (List.159, List.160, List.161): - let List.592 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName List.93 List.159 List.160 List.161; - let List.595 : U8 = 1i64; - let List.596 : U8 = GetTagId List.592; - let List.597 : Int1 = lowlevel Eq List.595 List.596; - if List.597 then - let List.162 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 1) (Index 0) List.592; + let List.590 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName List.93 List.159 List.160 List.161; + let List.593 : U8 = 1i64; + let List.594 : U8 = GetTagId List.590; + let List.595 : Int1 = lowlevel Eq List.593 List.594; + if List.595 then + let List.162 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 1) (Index 0) List.590; ret List.162; else - let List.163 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 0) (Index 0) List.592; + let List.163 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 0) (Index 0) List.590; ret List.163; procedure List.29 (List.304, List.305): - let List.547 : U64 = CallByName List.6 List.304; - let List.306 : U64 = CallByName Num.77 List.547 List.305; - let List.546 : List U8 = CallByName List.43 List.304 List.306; - ret List.546; + let List.545 : U64 = CallByName List.6 List.304; + let List.306 : U64 = CallByName Num.77 List.545 List.305; + let List.544 : List U8 = CallByName List.43 List.304 List.306; + ret List.544; procedure List.31 (#Attr.2, #Attr.3): - let List.560 : List U8 = lowlevel ListDropAt #Attr.2 #Attr.3; - ret List.560; + let List.558 : List U8 = lowlevel ListDropAt #Attr.2 #Attr.3; + ret List.558; procedure List.38 (List.298): - let List.559 : U64 = 0i64; - let List.558 : List U8 = CallByName List.31 List.298 List.559; - ret List.558; + let List.557 : U64 = 0i64; + let List.556 : List U8 = CallByName List.31 List.298 List.557; + ret List.556; procedure List.4 (List.113, List.114): - let List.557 : U64 = 1i64; - let List.556 : List U8 = CallByName List.70 List.113 List.557; - let List.555 : List U8 = CallByName List.71 List.556 List.114; - ret List.555; + let List.555 : U64 = 1i64; + let List.554 : List U8 = CallByName List.70 List.113 List.555; + let List.553 : List U8 = CallByName List.71 List.554 List.114; + ret List.553; procedure List.43 (List.302, List.303): - let List.539 : U64 = CallByName List.6 List.302; - let List.538 : U64 = CallByName Num.77 List.539 List.303; - let List.529 : {U64, U64} = Struct {List.303, List.538}; - let List.528 : List U8 = CallByName List.49 List.302 List.529; - ret List.528; + let List.537 : U64 = CallByName List.6 List.302; + let List.536 : U64 = CallByName Num.77 List.537 List.303; + let List.527 : {U64, U64} = Struct {List.303, List.536}; + let List.526 : List U8 = CallByName List.49 List.302 List.527; + ret List.526; procedure List.49 (List.376, List.377): - let List.586 : U64 = StructAtIndex 0 List.377; - let List.587 : U64 = 0i64; - let List.584 : Int1 = CallByName Bool.11 List.586 List.587; - if List.584 then + let List.584 : U64 = StructAtIndex 0 List.377; + let List.585 : U64 = 0i64; + let List.582 : Int1 = CallByName Bool.11 List.584 List.585; + if List.582 then dec List.376; - let List.585 : List U8 = Array []; - ret List.585; + let List.583 : List U8 = Array []; + ret List.583; else - let List.582 : U64 = StructAtIndex 1 List.377; - let List.583 : U64 = StructAtIndex 0 List.377; - let List.581 : List U8 = CallByName List.72 List.376 List.582 List.583; - ret List.581; + let List.580 : U64 = StructAtIndex 1 List.377; + let List.581 : U64 = StructAtIndex 0 List.377; + let List.579 : List U8 = CallByName List.72 List.376 List.580 List.581; + ret List.579; procedure List.6 (#Attr.2): - let List.650 : U64 = lowlevel ListLen #Attr.2; - ret List.650; + let List.611 : U64 = lowlevel ListLen #Attr.2; + ret List.611; procedure List.66 (#Attr.2, #Attr.3): - let List.566 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.566; + let List.564 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.564; procedure List.70 (#Attr.2, #Attr.3): - let List.554 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.554; + let List.552 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.552; procedure List.71 (#Attr.2, #Attr.3): - let List.552 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.552; + let List.550 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.550; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.533 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.533; + let List.531 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.531; procedure List.8 (#Attr.2, #Attr.3): - let List.549 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.549; - -procedure List.80 (List.642, List.643, List.644, List.645, List.646): - joinpoint List.601 List.439 List.440 List.441 List.442 List.443: - let List.603 : Int1 = CallByName Num.22 List.442 List.443; - if List.603 then - let List.612 : U8 = CallByName List.66 List.439 List.442; - let List.604 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName TotallyNotJson.62 List.440 List.612; - let List.609 : U8 = 1i64; - let List.610 : U8 = GetTagId List.604; - let List.611 : Int1 = lowlevel Eq List.609 List.610; - if List.611 then - let List.444 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 1) (Index 0) List.604; - let List.607 : U64 = 1i64; - let List.606 : U64 = CallByName Num.19 List.442 List.607; - jump List.601 List.439 List.444 List.441 List.606 List.443; + let List.547 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.547; + +procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): + joinpoint List.599 List.439 List.440 List.441 List.442 List.443: + let List.601 : Int1 = CallByName Num.22 List.442 List.443; + if List.601 then + let List.610 : U8 = CallByName List.66 List.439 List.442; + let List.602 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName TotallyNotJson.62 List.440 List.610; + let List.607 : U8 = 1i64; + let List.608 : U8 = GetTagId List.602; + let List.609 : Int1 = lowlevel Eq List.607 List.608; + if List.609 then + let List.444 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 1) (Index 0) List.602; + let List.605 : U64 = 1i64; + let List.604 : U64 = CallByName Num.19 List.442 List.605; + jump List.599 List.439 List.444 List.441 List.604 List.443; else dec List.439; - let List.445 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 0) (Index 0) List.604; - let List.608 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = TagId(0) List.445; - ret List.608; + let List.445 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 0) (Index 0) List.602; + let List.606 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = TagId(0) List.445; + ret List.606; else dec List.439; - let List.602 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = TagId(1) List.440; - ret List.602; + let List.600 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = TagId(1) List.440; + ret List.600; in - jump List.601 List.642 List.643 List.644 List.645 List.646; + jump List.599 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure List.93 (List.436, List.437, List.438): - let List.599 : U64 = 0i64; - let List.600 : U64 = CallByName List.6 List.436; - let List.598 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName List.80 List.436 List.437 List.438 List.599 List.600; - ret List.598; + let List.597 : U64 = 0i64; + let List.598 : U64 = CallByName List.6 List.436; + let List.596 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName List.80 List.436 List.437 List.438 List.597 List.598; + ret List.596; procedure Num.19 (#Attr.2, #Attr.3): let Num.295 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; ret Num.295; procedure Num.19 (#Attr.2, #Attr.3): - let Num.345 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.345; + let Num.329 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.329; procedure Num.20 (#Attr.2, #Attr.3): let Num.307 : U8 = lowlevel NumSub #Attr.2 #Attr.3; ret Num.307; procedure Num.22 (#Attr.2, #Attr.3): - let Num.344 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.344; + let Num.328 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.328; procedure Num.23 (#Attr.2, #Attr.3): let Num.313 : Int1 = lowlevel NumLte #Attr.2 #Attr.3; @@ -228,8 +228,8 @@ procedure Num.72 (#Attr.2, #Attr.3): ret Num.293; procedure Num.77 (#Attr.2, #Attr.3): - let Num.341 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; - ret Num.341; + let Num.325 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; + ret Num.325; procedure Str.48 (#Attr.2, #Attr.3, #Attr.4): let Str.307 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; @@ -247,8 +247,8 @@ procedure Str.9 (Str.79): else let Str.300 : U8 = StructAtIndex 3 Str.80; let Str.301 : U64 = StructAtIndex 0 Str.80; - let #Derived_gen.1 : Str = StructAtIndex 1 Str.80; - dec #Derived_gen.1; + let #Derived_gen.7 : Str = StructAtIndex 1 Str.80; + dec #Derived_gen.7; let Str.299 : {U64, U8} = Struct {Str.301, Str.300}; let Str.298 : [C {U64, U8}, C Str] = TagId(0) Str.299; ret Str.298; @@ -365,8 +365,8 @@ procedure TotallyNotJson.534 (TotallyNotJson.535): procedure TotallyNotJson.536 (TotallyNotJson.1192): let TotallyNotJson.1193 : List U8 = StructAtIndex 1 TotallyNotJson.1192; - let #Derived_gen.0 : List U8 = StructAtIndex 0 TotallyNotJson.1192; - dec #Derived_gen.0; + let #Derived_gen.6 : List U8 = StructAtIndex 0 TotallyNotJson.1192; + dec #Derived_gen.6; ret TotallyNotJson.1193; procedure TotallyNotJson.60 (): @@ -733,7 +733,7 @@ procedure TotallyNotJson.69 (): let TotallyNotJson.1247 : List U8 = CallByName TotallyNotJson.68 TotallyNotJson.1248 TotallyNotJson.1249 TotallyNotJson.1250 TotallyNotJson.1251; ret TotallyNotJson.1247; -procedure TotallyNotJson.70 (TotallyNotJson.1468): +procedure TotallyNotJson.70 (#Derived_gen.5): joinpoint TotallyNotJson.1198 TotallyNotJson.1166: let TotallyNotJson.600 : List U8 = StructAtIndex 0 TotallyNotJson.1166; inc 4 TotallyNotJson.600; @@ -834,4 +834,4 @@ procedure TotallyNotJson.70 (TotallyNotJson.1468): let TotallyNotJson.1276 : {List U8, List U8} = Struct {TotallyNotJson.600, TotallyNotJson.601}; ret TotallyNotJson.1276; in - jump TotallyNotJson.1198 TotallyNotJson.1468; + jump TotallyNotJson.1198 #Derived_gen.5; diff --git a/crates/compiler/test_mono/generated/issue_4770.txt b/crates/compiler/test_mono/generated/issue_4770.txt index 7c43ab26ff1..4f1d14165db 100644 --- a/crates/compiler/test_mono/generated/issue_4770.txt +++ b/crates/compiler/test_mono/generated/issue_4770.txt @@ -48,7 +48,7 @@ procedure List.66 (#Attr.2, #Attr.3): let List.549 : {[C I64, C List *self], [C I64, C List *self]} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; ret List.549; -procedure List.80 (List.561, List.562, List.563, List.564, List.565): +procedure List.80 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4, #Derived_gen.5): joinpoint List.537 List.439 List.440 List.441 List.442 List.443: let List.539 : Int1 = CallByName Num.22 List.442 List.443; if List.539 then @@ -73,7 +73,7 @@ procedure List.80 (List.561, List.562, List.563, List.564, List.565): let List.538 : [C {}, C {}] = TagId(1) List.440; ret List.538; in - jump List.537 List.561 List.562 List.563 List.564 List.565; + jump List.537 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; procedure List.93 (List.436, List.437, List.438): let List.535 : U64 = 0i64; @@ -93,7 +93,7 @@ procedure Num.22 (#Attr.2, #Attr.3): let Num.295 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; ret Num.295; -procedure Test.1 (Test.77): +procedure Test.1 (#Derived_gen.0): joinpoint Test.26 Test.6: let Test.65 : [C I64, C List *self] = StructAtIndex 1 Test.6; let Test.66 : U8 = 0i64; @@ -110,17 +110,17 @@ procedure Test.1 (Test.77): let Test.49 : [C I64, C List *self] = StructAtIndex 1 Test.6; dec Test.50; let Test.10 : I64 = UnionAtIndex (Id 0) (Index 0) Test.49; - joinpoint #Derived_gen.0: + joinpoint #Derived_gen.6: let Test.27 : Int1 = CallByName Num.22 Test.8 Test.10; ret Test.27; in - let #Derived_gen.1 : Int1 = lowlevel RefCountIsUnique Test.49; - if #Derived_gen.1 then + let #Derived_gen.7 : Int1 = lowlevel RefCountIsUnique Test.49; + if #Derived_gen.7 then decref Test.49; - jump #Derived_gen.0; + jump #Derived_gen.6; else decref Test.49; - jump #Derived_gen.0; + jump #Derived_gen.6; else let Test.39 : [C I64, C List *self] = StructAtIndex 0 Test.6; let Test.42 : [C I64, C List *self] = StructAtIndex 1 Test.6; @@ -141,7 +141,7 @@ procedure Test.1 (Test.77): dec Test.52; let Test.14 : List [C I64, C List *self] = UnionAtIndex (Id 1) (Index 0) Test.51; inc Test.14; - joinpoint #Derived_gen.2: + joinpoint #Derived_gen.8: let Test.35 : {} = Struct {}; let Test.33 : List {[C I64, C List *self], [C I64, C List *self]} = CallByName List.23 Test.12 Test.14 Test.35; let Test.34 : {} = Struct {}; @@ -159,14 +159,14 @@ procedure Test.1 (Test.77): let Test.28 : Int1 = CallByName Bool.1; ret Test.28; in - let #Derived_gen.3 : Int1 = lowlevel RefCountIsUnique Test.51; - if #Derived_gen.3 then + let #Derived_gen.9 : Int1 = lowlevel RefCountIsUnique Test.51; + if #Derived_gen.9 then decref Test.51; - jump #Derived_gen.2; + jump #Derived_gen.8; else inc Test.14; decref Test.51; - jump #Derived_gen.2; + jump #Derived_gen.8; else let Test.48 : [C I64, C List *self] = StructAtIndex 0 Test.6; let Test.47 : List [C I64, C List *self] = Array [Test.48]; @@ -175,7 +175,7 @@ procedure Test.1 (Test.77): let Test.44 : {[C I64, C List *self], [C I64, C List *self]} = Struct {Test.45, Test.46}; jump Test.26 Test.44; in - jump Test.26 Test.77; + jump Test.26 #Derived_gen.0; procedure Test.15 (Test.16, Test.17): let Test.36 : {[C I64, C List *self], [C I64, C List *self]} = Struct {Test.16, Test.17}; diff --git a/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt b/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt index d94e756d715..9e4b221fed2 100644 --- a/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt +++ b/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt @@ -1,30 +1,30 @@ procedure Bool.1 (): - let Bool.55 : Int1 = false; - ret Bool.55; + let Bool.51 : Int1 = false; + ret Bool.51; procedure Bool.11 (#Attr.2, #Attr.3): let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3; ret Bool.23; procedure Bool.11 (#Attr.2, #Attr.3): - let Bool.46 : Int1 = lowlevel Eq #Attr.2 #Attr.3; - ret Bool.46; + let Bool.42 : Int1 = lowlevel Eq #Attr.2 #Attr.3; + ret Bool.42; procedure Bool.11 (#Attr.2, #Attr.3): - let Bool.67 : Int1 = lowlevel Eq #Attr.2 #Attr.3; - ret Bool.67; + let Bool.57 : Int1 = lowlevel Eq #Attr.2 #Attr.3; + ret Bool.57; procedure Bool.2 (): - let Bool.54 : Int1 = true; - ret Bool.54; + let Bool.50 : Int1 = true; + ret Bool.50; procedure Bool.3 (#Attr.2, #Attr.3): - let Bool.37 : Int1 = lowlevel And #Attr.2 #Attr.3; - ret Bool.37; + let Bool.33 : Int1 = lowlevel And #Attr.2 #Attr.3; + ret Bool.33; procedure Bool.4 (#Attr.2, #Attr.3): - let Bool.57 : Int1 = lowlevel Or #Attr.2 #Attr.3; - ret Bool.57; + let Bool.53 : Int1 = lowlevel Or #Attr.2 #Attr.3; + ret Bool.53; procedure Decode.24 (Decode.101): ret Decode.101; @@ -114,8 +114,8 @@ procedure List.49 (List.376, List.377): ret List.575; procedure List.6 (#Attr.2): - let List.644 : U64 = lowlevel ListLen #Attr.2; - ret List.644; + let List.607 : U64 = lowlevel ListLen #Attr.2; + ret List.607; procedure List.66 (#Attr.2, #Attr.3): let List.560 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; @@ -137,7 +137,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.543 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.543; -procedure List.80 (List.636, List.637, List.638, List.639, List.640): +procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): joinpoint List.595 List.439 List.440 List.441 List.442 List.443: let List.597 : Int1 = CallByName Num.22 List.442 List.443; if List.597 then @@ -161,7 +161,7 @@ procedure List.80 (List.636, List.637, List.638, List.639, List.640): let List.596 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = TagId(1) List.440; ret List.596; in - jump List.595 List.636 List.637 List.638 List.639 List.640; + jump List.595 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure List.93 (List.436, List.437, List.438): let List.593 : U64 = 0i64; @@ -174,16 +174,16 @@ procedure Num.19 (#Attr.2, #Attr.3): ret Num.295; procedure Num.19 (#Attr.2, #Attr.3): - let Num.345 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.345; + let Num.329 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.329; procedure Num.20 (#Attr.2, #Attr.3): let Num.307 : U8 = lowlevel NumSub #Attr.2 #Attr.3; ret Num.307; procedure Num.22 (#Attr.2, #Attr.3): - let Num.344 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.344; + let Num.328 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.328; procedure Num.23 (#Attr.2, #Attr.3): let Num.313 : Int1 = lowlevel NumLte #Attr.2 #Attr.3; @@ -202,8 +202,8 @@ procedure Num.72 (#Attr.2, #Attr.3): ret Num.293; procedure Num.77 (#Attr.2, #Attr.3): - let Num.341 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; - ret Num.341; + let Num.325 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; + ret Num.325; procedure Str.12 (#Attr.2): let Str.307 : List U8 = lowlevel StrToUtf8 #Attr.2; @@ -218,8 +218,8 @@ procedure Str.47 (#Attr.2): ret Str.306; procedure Str.48 (#Attr.2, #Attr.3, #Attr.4): - let Str.321 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.321; + let Str.317 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.317; procedure Str.72 (Str.244): let Str.245 : {I64, U8} = CallByName Str.47 Str.244; @@ -237,22 +237,22 @@ procedure Str.72 (Str.244): ret Str.299; procedure Str.9 (Str.79): - let Str.319 : U64 = 0i64; - let Str.320 : U64 = CallByName List.6 Str.79; - let Str.80 : {U64, Str, Int1, U8} = CallByName Str.48 Str.79 Str.319 Str.320; - let Str.316 : Int1 = StructAtIndex 2 Str.80; - if Str.316 then - let Str.318 : Str = StructAtIndex 1 Str.80; - let Str.317 : [C {U64, U8}, C Str] = TagId(1) Str.318; - ret Str.317; + let Str.315 : U64 = 0i64; + let Str.316 : U64 = CallByName List.6 Str.79; + let Str.80 : {U64, Str, Int1, U8} = CallByName Str.48 Str.79 Str.315 Str.316; + let Str.312 : Int1 = StructAtIndex 2 Str.80; + if Str.312 then + let Str.314 : Str = StructAtIndex 1 Str.80; + let Str.313 : [C {U64, U8}, C Str] = TagId(1) Str.314; + ret Str.313; else - let Str.314 : U8 = StructAtIndex 3 Str.80; - let Str.315 : U64 = StructAtIndex 0 Str.80; - let #Derived_gen.0 : Str = StructAtIndex 1 Str.80; - dec #Derived_gen.0; - let Str.313 : {U64, U8} = Struct {Str.315, Str.314}; - let Str.312 : [C {U64, U8}, C Str] = TagId(0) Str.313; - ret Str.312; + let Str.310 : U8 = StructAtIndex 3 Str.80; + let Str.311 : U64 = StructAtIndex 0 Str.80; + let #Derived_gen.6 : Str = StructAtIndex 1 Str.80; + dec #Derived_gen.6; + let Str.309 : {U64, U8} = Struct {Str.311, Str.310}; + let Str.308 : [C {U64, U8}, C Str] = TagId(0) Str.309; + ret Str.308; procedure Test.0 (): let Test.37 : Str = "-1234"; @@ -397,8 +397,8 @@ procedure TotallyNotJson.534 (TotallyNotJson.535): procedure TotallyNotJson.536 (TotallyNotJson.1192): let TotallyNotJson.1193 : List U8 = StructAtIndex 1 TotallyNotJson.1192; - let #Derived_gen.1 : List U8 = StructAtIndex 0 TotallyNotJson.1192; - dec #Derived_gen.1; + let #Derived_gen.7 : List U8 = StructAtIndex 0 TotallyNotJson.1192; + dec #Derived_gen.7; ret TotallyNotJson.1193; procedure TotallyNotJson.60 (): @@ -765,7 +765,7 @@ procedure TotallyNotJson.69 (): let TotallyNotJson.1247 : List U8 = CallByName TotallyNotJson.68 TotallyNotJson.1248 TotallyNotJson.1249 TotallyNotJson.1250 TotallyNotJson.1251; ret TotallyNotJson.1247; -procedure TotallyNotJson.70 (TotallyNotJson.1468): +procedure TotallyNotJson.70 (#Derived_gen.5): joinpoint TotallyNotJson.1198 TotallyNotJson.1166: let TotallyNotJson.600 : List U8 = StructAtIndex 0 TotallyNotJson.1166; inc 4 TotallyNotJson.600; @@ -866,4 +866,4 @@ procedure TotallyNotJson.70 (TotallyNotJson.1468): let TotallyNotJson.1276 : {List U8, List U8} = Struct {TotallyNotJson.600, TotallyNotJson.601}; ret TotallyNotJson.1276; in - jump TotallyNotJson.1198 TotallyNotJson.1468; + jump TotallyNotJson.1198 #Derived_gen.5; diff --git a/crates/compiler/test_mono/generated/layout_cache_structure_with_multiple_recursive_structures.txt b/crates/compiler/test_mono/generated/layout_cache_structure_with_multiple_recursive_structures.txt index 96ce04fefab..d94a1b57be2 100644 --- a/crates/compiler/test_mono/generated/layout_cache_structure_with_multiple_recursive_structures.txt +++ b/crates/compiler/test_mono/generated/layout_cache_structure_with_multiple_recursive_structures.txt @@ -14,7 +14,7 @@ procedure List.66 (#Attr.2, #Attr.3): let List.537 : [C *self, ] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; ret List.537; -procedure List.80 (List.544, List.545, List.546, List.547, List.548): +procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): joinpoint List.527 List.439 List.440 List.441 List.442 List.443: let List.529 : Int1 = CallByName Num.22 List.442 List.443; if List.529 then @@ -28,7 +28,7 @@ procedure List.80 (List.544, List.545, List.546, List.547, List.548): dec List.439; ret List.440; in - jump List.527 List.544 List.545 List.546 List.547 List.548; + jump List.527 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure List.93 (List.436, List.437, List.438): let List.525 : U64 = 0i64; diff --git a/crates/compiler/test_mono/generated/linked_list_filter.txt b/crates/compiler/test_mono/generated/linked_list_filter.txt new file mode 100644 index 00000000000..e7120f4e91c --- /dev/null +++ b/crates/compiler/test_mono/generated/linked_list_filter.txt @@ -0,0 +1,57 @@ +procedure Num.31 (Num.234): + let Num.293 : I64 = 2i64; + let Num.292 : Int1 = CallByName Num.86 Num.234 Num.293; + ret Num.292; + +procedure Num.86 (#Attr.2, #Attr.3): + let Num.294 : Int1 = lowlevel NumIsMultipleOf #Attr.2 #Attr.3; + ret Num.294; + +procedure Test.2 (#Derived_gen.0, #Derived_gen.1): + let #Derived_gen.3 : [, C I64 *self] = NullPointer; + let #Derived_gen.2 : Ptr([, C I64 *self]) = lowlevel Alloca #Derived_gen.3; + joinpoint #Derived_gen.4 Test.4 Test.5 #Derived_gen.5 #Derived_gen.6: + let Test.22 : U8 = 1i64; + let Test.23 : U8 = GetTagId Test.4; + let Test.24 : Int1 = lowlevel Eq Test.22 Test.23; + if Test.24 then + let Test.17 : [, C I64 *self] = TagId(1) ; + let #Derived_gen.8 : {} = lowlevel PtrStore #Derived_gen.5 Test.17; + let #Derived_gen.7 : [, C I64 *self] = lowlevel PtrLoad #Derived_gen.6; + ret #Derived_gen.7; + else + let Test.7 : I64 = UnionAtIndex (Id 0) (Index 0) Test.4; + let Test.8 : [, C I64 *self] = UnionAtIndex (Id 0) (Index 1) Test.4; + joinpoint #Derived_gen.12 #Derived_gen.15: + let Test.19 : Int1 = CallByName Num.31 Test.7; + if Test.19 then + let #Derived_gen.9 : [, C I64 *self] = NullPointer; + let Test.20 : [, C I64 *self] = Reuse #Derived_gen.15 UpdateModeId { id: 1 } TagId(0) Test.7 #Derived_gen.9; + let #Derived_gen.10 : Ptr([, C I64 *self]) = UnionFieldPtrAtIndex (Id 0) (Index 1) Test.20; + let #Derived_gen.11 : {} = lowlevel PtrStore #Derived_gen.5 Test.20; + jump #Derived_gen.4 Test.8 Test.5 #Derived_gen.10 #Derived_gen.6; + else + decref #Derived_gen.15; + jump #Derived_gen.4 Test.8 Test.5 #Derived_gen.5 #Derived_gen.6; + in + let #Derived_gen.13 : Int1 = lowlevel RefCountIsUnique Test.4; + if #Derived_gen.13 then + let #Derived_gen.16 : [, C I64 *self] = ResetRef { symbol: Test.4, id: UpdateModeId { id: 2 } }; + jump #Derived_gen.12 #Derived_gen.16; + else + inc Test.8; + decref Test.4; + let #Derived_gen.17 : [, C I64 *self] = NullPointer; + jump #Derived_gen.12 #Derived_gen.17; + in + jump #Derived_gen.4 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.2; + +procedure Test.0 (): + let Test.25 : I64 = 1i64; + let Test.27 : I64 = 2i64; + let Test.28 : [, C I64 *self] = TagId(1) ; + let Test.26 : [, C I64 *self] = TagId(0) Test.27 Test.28; + let Test.14 : [, C I64 *self] = TagId(0) Test.25 Test.26; + let Test.15 : {} = Struct {}; + let Test.13 : [, C I64 *self] = CallByName Test.2 Test.14 Test.15; + ret Test.13; diff --git a/crates/compiler/test_mono/generated/linked_list_map.txt b/crates/compiler/test_mono/generated/linked_list_map.txt new file mode 100644 index 00000000000..9626e531966 --- /dev/null +++ b/crates/compiler/test_mono/generated/linked_list_map.txt @@ -0,0 +1,51 @@ +procedure Num.19 (#Attr.2, #Attr.3): + let Num.292 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.292; + +procedure Test.10 (Test.11): + let Test.28 : I64 = 1i64; + let Test.27 : I64 = CallByName Num.19 Test.11 Test.28; + ret Test.27; + +procedure Test.2 (#Derived_gen.0, #Derived_gen.1): + let #Derived_gen.3 : [, C I64 *self] = NullPointer; + let #Derived_gen.2 : Ptr([, C I64 *self]) = lowlevel Alloca #Derived_gen.3; + joinpoint #Derived_gen.4 Test.4 Test.5 #Derived_gen.5 #Derived_gen.6: + let Test.22 : U8 = 1i64; + let Test.23 : U8 = GetTagId Test.5; + let Test.24 : Int1 = lowlevel Eq Test.22 Test.23; + if Test.24 then + let Test.18 : [, C I64 *self] = TagId(1) ; + let #Derived_gen.8 : {} = lowlevel PtrStore #Derived_gen.5 Test.18; + let #Derived_gen.7 : [, C I64 *self] = lowlevel PtrLoad #Derived_gen.6; + ret #Derived_gen.7; + else + let Test.7 : I64 = UnionAtIndex (Id 0) (Index 0) Test.5; + let Test.8 : [, C I64 *self] = UnionAtIndex (Id 0) (Index 1) Test.5; + joinpoint #Derived_gen.12 #Derived_gen.15: + let Test.20 : I64 = CallByName Test.10 Test.7; + let #Derived_gen.9 : [, C I64 *self] = NullPointer; + let Test.19 : [, C I64 *self] = Reuse #Derived_gen.15 UpdateModeId { id: 1 } TagId(0) Test.20 #Derived_gen.9; + let #Derived_gen.10 : Ptr([, C I64 *self]) = UnionFieldPtrAtIndex (Id 0) (Index 1) Test.19; + let #Derived_gen.11 : {} = lowlevel PtrStore #Derived_gen.5 Test.19; + jump #Derived_gen.4 Test.4 Test.8 #Derived_gen.10 #Derived_gen.6; + in + let #Derived_gen.13 : Int1 = lowlevel RefCountIsUnique Test.5; + if #Derived_gen.13 then + let #Derived_gen.16 : [, C I64 *self] = ResetRef { symbol: Test.5, id: UpdateModeId { id: 2 } }; + jump #Derived_gen.12 #Derived_gen.16; + else + inc Test.8; + decref Test.5; + let #Derived_gen.17 : [, C I64 *self] = NullPointer; + jump #Derived_gen.12 #Derived_gen.17; + in + jump #Derived_gen.4 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.2; + +procedure Test.0 (): + let Test.15 : {} = Struct {}; + let Test.25 : I64 = 42i64; + let Test.26 : [, C I64 *self] = TagId(1) ; + let Test.16 : [, C I64 *self] = TagId(0) Test.25 Test.26; + let Test.14 : [, C I64 *self] = CallByName Test.2 Test.15 Test.16; + ret Test.14; diff --git a/crates/compiler/test_mono/generated/linked_list_reverse.txt b/crates/compiler/test_mono/generated/linked_list_reverse.txt new file mode 100644 index 00000000000..00461392a9b --- /dev/null +++ b/crates/compiler/test_mono/generated/linked_list_reverse.txt @@ -0,0 +1,37 @@ +procedure Test.2 (Test.5): + let Test.17 : [, C I64 *self] = TagId(1) ; + let Test.16 : [, C I64 *self] = CallByName Test.3 Test.17 Test.5; + ret Test.16; + +procedure Test.3 (#Derived_gen.0, #Derived_gen.1): + joinpoint Test.18 Test.7 Test.8: + let Test.22 : U8 = 1i64; + let Test.23 : U8 = GetTagId Test.8; + let Test.24 : Int1 = lowlevel Eq Test.22 Test.23; + if Test.24 then + ret Test.7; + else + let Test.9 : I64 = UnionAtIndex (Id 0) (Index 0) Test.8; + let Test.10 : [, C I64 *self] = UnionAtIndex (Id 0) (Index 1) Test.8; + joinpoint #Derived_gen.2 #Derived_gen.5: + let Test.21 : [, C I64 *self] = Reuse #Derived_gen.5 UpdateModeId { id: 1 } TagId(0) Test.9 Test.7; + jump Test.18 Test.21 Test.10; + in + let #Derived_gen.3 : Int1 = lowlevel RefCountIsUnique Test.8; + if #Derived_gen.3 then + let #Derived_gen.6 : [, C I64 *self] = ResetRef { symbol: Test.8, id: UpdateModeId { id: 2 } }; + jump #Derived_gen.2 #Derived_gen.6; + else + inc Test.10; + decref Test.8; + let #Derived_gen.7 : [, C I64 *self] = NullPointer; + jump #Derived_gen.2 #Derived_gen.7; + in + jump Test.18 #Derived_gen.0 #Derived_gen.1; + +procedure Test.0 (): + let Test.25 : I64 = 42i64; + let Test.26 : [, C I64 *self] = TagId(1) ; + let Test.15 : [, C I64 *self] = TagId(0) Test.25 Test.26; + let Test.14 : [, C I64 *self] = CallByName Test.2 Test.15; + ret Test.14; diff --git a/crates/compiler/test_mono/generated/quicksort_help.txt b/crates/compiler/test_mono/generated/quicksort_help.txt index 9afb51dda4f..8f8eb676946 100644 --- a/crates/compiler/test_mono/generated/quicksort_help.txt +++ b/crates/compiler/test_mono/generated/quicksort_help.txt @@ -10,7 +10,7 @@ procedure Num.22 (#Attr.2, #Attr.3): let Num.294 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; ret Num.294; -procedure Test.1 (Test.24, Test.25, Test.26): +procedure Test.1 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2): joinpoint Test.12 Test.2 Test.3 Test.4: let Test.14 : Int1 = CallByName Num.22 Test.3 Test.4; if Test.14 then @@ -29,7 +29,7 @@ procedure Test.1 (Test.24, Test.25, Test.26): else ret Test.2; in - jump Test.12 Test.24 Test.25 Test.26; + jump Test.12 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2; procedure Test.0 (): let Test.9 : List I64 = Array []; diff --git a/crates/compiler/test_mono/generated/rb_tree_fbip.txt b/crates/compiler/test_mono/generated/rb_tree_fbip.txt index 5a6b8aed152..e2db544d2d9 100644 --- a/crates/compiler/test_mono/generated/rb_tree_fbip.txt +++ b/crates/compiler/test_mono/generated/rb_tree_fbip.txt @@ -6,415 +6,450 @@ procedure Num.24 (#Attr.2, #Attr.3): let Num.293 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; ret Num.293; -procedure Test.3 (Test.9, Test.10, Test.11): - let Test.254 : U8 = 0i64; - let Test.255 : U8 = GetTagId Test.9; - let Test.256 : Int1 = lowlevel Eq Test.254 Test.255; - if Test.256 then - let Test.113 : [C *self I64 *self I32 Int1, ] = TagId(0) ; - let Test.114 : [C *self I64 *self I32 Int1, ] = TagId(0) ; - let Test.112 : Int1 = true; - let Test.111 : [C *self I64 *self I32 Int1, ] = TagId(1) Test.113 Test.11 Test.114 Test.10 Test.112; - ret Test.111; - else - let Test.251 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.9; - let Test.252 : Int1 = false; - let Test.253 : Int1 = lowlevel Eq Test.252 Test.251; - if Test.253 then - let Test.16 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.9; - let Test.18 : I64 = UnionAtIndex (Id 1) (Index 1) Test.9; - let Test.19 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.9; - let Test.17 : I32 = UnionAtIndex (Id 1) (Index 3) Test.9; - joinpoint #Derived_gen.72 #Derived_gen.77: - let Test.179 : Int1 = CallByName Num.22 Test.10 Test.17; - if Test.179 then - joinpoint Test.238 #Derived_gen.139: - let Test.233 : [C *self I64 *self I32 Int1, ] = CallByName Test.3 Test.16 Test.10 Test.11; - let Test.232 : Int1 = false; - let Test.231 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.139 UpdateModeId { id: 56 } TagId(1) Test.233 Test.18 Test.19 Test.17 Test.232; - ret Test.231; - in - let Test.236 : U8 = 1i64; - let Test.237 : U8 = GetTagId Test.16; - let Test.240 : Int1 = lowlevel Eq Test.236 Test.237; - if Test.240 then - let Test.234 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.16; - let Test.235 : Int1 = true; - let Test.239 : Int1 = lowlevel Eq Test.235 Test.234; - if Test.239 then - let Test.180 : [C *self I64 *self I32 Int1, ] = CallByName Test.3 Test.16 Test.10 Test.11; - joinpoint Test.199 #Derived_gen.166: - let Test.198 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; - let Test.20 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.198; - inc Test.20; - let Test.22 : I64 = UnionAtIndex (Id 1) (Index 1) Test.198; - let Test.23 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.198; - inc Test.23; - let Test.21 : I32 = UnionAtIndex (Id 1) (Index 3) Test.198; - let Test.25 : I64 = UnionAtIndex (Id 1) (Index 1) Test.180; - let Test.26 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.180; - let Test.24 : I32 = UnionAtIndex (Id 1) (Index 3) Test.180; - joinpoint #Derived_gen.30 #Derived_gen.169 #Derived_gen.170 #Derived_gen.171: - let Test.186 : Int1 = false; - let Test.183 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.171 UpdateModeId { id: 85 } TagId(1) Test.20 Test.22 Test.23 Test.21 Test.186; - let Test.185 : Int1 = false; - let Test.184 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.170 UpdateModeId { id: 84 } TagId(1) Test.26 Test.18 Test.19 Test.17 Test.185; - let Test.182 : Int1 = true; - let Test.181 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.169 UpdateModeId { id: 83 } TagId(1) Test.183 Test.25 Test.184 Test.24 Test.182; - ret Test.181; - in - let #Derived_gen.31 : Int1 = lowlevel RefCountIsUnique Test.180; - if #Derived_gen.31 then - let #Derived_gen.172 : [C *self I64 *self I32 Int1, ] = Reset { symbol: Test.198, id: UpdateModeId { id: 86 } }; - let #Derived_gen.173 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.180, id: UpdateModeId { id: 87 } }; - jump #Derived_gen.30 #Derived_gen.166 #Derived_gen.172 #Derived_gen.173; - else - inc Test.26; - decref Test.180; - let #Derived_gen.174 : [C *self I64 *self I32 Int1, ] = NullPointer; - jump #Derived_gen.30 #Derived_gen.174 #Derived_gen.174 #Derived_gen.166; - in - let Test.228 : U8 = 1i64; - let Test.229 : U8 = GetTagId Test.180; - let Test.230 : Int1 = lowlevel Eq Test.228 Test.229; - if Test.230 then - joinpoint Test.225 #Derived_gen.184: - joinpoint Test.216 #Derived_gen.185: - let Test.46 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; - let Test.48 : I64 = UnionAtIndex (Id 1) (Index 1) Test.180; - let Test.49 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.180; - let Test.47 : I32 = UnionAtIndex (Id 1) (Index 3) Test.180; - joinpoint #Derived_gen.24 #Derived_gen.187 #Derived_gen.188: - let Test.196 : Int1 = true; - let Test.195 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.188 UpdateModeId { id: 100 } TagId(1) Test.46 Test.48 Test.49 Test.47 Test.196; - let Test.194 : Int1 = false; - let Test.193 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.187 UpdateModeId { id: 99 } TagId(1) Test.195 Test.18 Test.19 Test.17 Test.194; - ret Test.193; - in - let #Derived_gen.25 : Int1 = lowlevel RefCountIsUnique Test.180; - if #Derived_gen.25 then - let #Derived_gen.189 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.180, id: UpdateModeId { id: 101 } }; - jump #Derived_gen.24 #Derived_gen.185 #Derived_gen.189; - else - inc Test.46; - inc Test.49; - decref Test.180; - let #Derived_gen.190 : [C *self I64 *self I32 Int1, ] = NullPointer; - jump #Derived_gen.24 #Derived_gen.190 #Derived_gen.185; +procedure Test.3 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2): + let #Derived_gen.4 : [C *self I64 *self I32 Int1, ] = NullPointer; + let #Derived_gen.3 : Ptr([C *self I64 *self I32 Int1, ]) = lowlevel Alloca #Derived_gen.4; + joinpoint #Derived_gen.5 Test.9 Test.10 Test.11 #Derived_gen.6 #Derived_gen.7: + let Test.254 : U8 = 0i64; + let Test.255 : U8 = GetTagId Test.9; + let Test.256 : Int1 = lowlevel Eq Test.254 Test.255; + if Test.256 then + let Test.113 : [C *self I64 *self I32 Int1, ] = TagId(0) ; + let Test.114 : [C *self I64 *self I32 Int1, ] = TagId(0) ; + let Test.112 : Int1 = true; + let Test.111 : [C *self I64 *self I32 Int1, ] = TagId(1) Test.113 Test.11 Test.114 Test.10 Test.112; + let #Derived_gen.9 : {} = lowlevel PtrStore #Derived_gen.6 Test.111; + let #Derived_gen.8 : [C *self I64 *self I32 Int1, ] = lowlevel PtrLoad #Derived_gen.7; + ret #Derived_gen.8; + else + let Test.251 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.9; + let Test.252 : Int1 = false; + let Test.253 : Int1 = lowlevel Eq Test.252 Test.251; + if Test.253 then + let Test.16 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.9; + let Test.18 : I64 = UnionAtIndex (Id 1) (Index 1) Test.9; + let Test.19 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.9; + let Test.17 : I32 = UnionAtIndex (Id 1) (Index 3) Test.9; + joinpoint #Derived_gen.114 #Derived_gen.119: + let Test.179 : Int1 = CallByName Num.22 Test.10 Test.17; + if Test.179 then + joinpoint Test.238 #Derived_gen.181: + let Test.232 : Int1 = false; + let #Derived_gen.10 : [C *self I64 *self I32 Int1, ] = NullPointer; + let Test.231 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.181 UpdateModeId { id: 56 } TagId(1) #Derived_gen.10 Test.18 Test.19 Test.17 Test.232; + let #Derived_gen.11 : Ptr([C *self I64 *self I32 Int1, ]) = UnionFieldPtrAtIndex (Id 1) (Index 0) Test.231; + let #Derived_gen.12 : {} = lowlevel PtrStore #Derived_gen.6 Test.231; + jump #Derived_gen.5 Test.16 Test.10 Test.11 #Derived_gen.11 #Derived_gen.7; + in + let Test.236 : U8 = 1i64; + let Test.237 : U8 = GetTagId Test.16; + let Test.240 : Int1 = lowlevel Eq Test.236 Test.237; + if Test.240 then + let Test.234 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.16; + let Test.235 : Int1 = true; + let Test.239 : Int1 = lowlevel Eq Test.235 Test.234; + if Test.239 then + let Test.180 : [C *self I64 *self I32 Int1, ] = CallByName Test.3 Test.16 Test.10 Test.11; + joinpoint Test.199 #Derived_gen.208: + let Test.198 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; + let Test.20 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.198; + inc Test.20; + let Test.22 : I64 = UnionAtIndex (Id 1) (Index 1) Test.198; + let Test.23 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.198; + inc Test.23; + let Test.21 : I32 = UnionAtIndex (Id 1) (Index 3) Test.198; + let Test.25 : I64 = UnionAtIndex (Id 1) (Index 1) Test.180; + let Test.26 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.180; + let Test.24 : I32 = UnionAtIndex (Id 1) (Index 3) Test.180; + joinpoint #Derived_gen.72 #Derived_gen.211 #Derived_gen.212 #Derived_gen.213: + let Test.186 : Int1 = false; + let Test.183 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.213 UpdateModeId { id: 85 } TagId(1) Test.20 Test.22 Test.23 Test.21 Test.186; + let Test.185 : Int1 = false; + let Test.184 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.212 UpdateModeId { id: 84 } TagId(1) Test.26 Test.18 Test.19 Test.17 Test.185; + let Test.182 : Int1 = true; + let Test.181 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.211 UpdateModeId { id: 83 } TagId(1) Test.183 Test.25 Test.184 Test.24 Test.182; + let #Derived_gen.14 : {} = lowlevel PtrStore #Derived_gen.6 Test.181; + let #Derived_gen.13 : [C *self I64 *self I32 Int1, ] = lowlevel PtrLoad #Derived_gen.7; + ret #Derived_gen.13; in - let Test.213 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; - let Test.214 : U8 = 1i64; - let Test.215 : U8 = GetTagId Test.213; - let Test.218 : Int1 = lowlevel Eq Test.214 Test.215; - if Test.218 then - let Test.210 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; - let Test.211 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.210; - let Test.212 : Int1 = true; - let Test.217 : Int1 = lowlevel Eq Test.212 Test.211; - if Test.217 then - jump Test.199 #Derived_gen.184; - else - jump Test.216 #Derived_gen.184; + let #Derived_gen.73 : Int1 = lowlevel RefCountIsUnique Test.180; + if #Derived_gen.73 then + let #Derived_gen.214 : [C *self I64 *self I32 Int1, ] = Reset { symbol: Test.198, id: UpdateModeId { id: 86 } }; + let #Derived_gen.215 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.180, id: UpdateModeId { id: 87 } }; + jump #Derived_gen.72 #Derived_gen.208 #Derived_gen.214 #Derived_gen.215; else - jump Test.216 #Derived_gen.184; + inc Test.26; + decref Test.180; + let #Derived_gen.216 : [C *self I64 *self I32 Int1, ] = NullPointer; + jump #Derived_gen.72 #Derived_gen.216 #Derived_gen.216 #Derived_gen.208; in - let Test.222 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.180; - let Test.223 : U8 = 1i64; - let Test.224 : U8 = GetTagId Test.222; - let Test.227 : Int1 = lowlevel Eq Test.223 Test.224; - if Test.227 then - let Test.219 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.180; - let Test.220 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.219; - let Test.221 : Int1 = true; - let Test.226 : Int1 = lowlevel Eq Test.221 Test.220; - if Test.226 then - joinpoint Test.207 #Derived_gen.191: - let Test.33 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; - let Test.35 : I64 = UnionAtIndex (Id 1) (Index 1) Test.180; - let Test.200 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.180; - let Test.36 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.200; - inc Test.36; - let Test.38 : I64 = UnionAtIndex (Id 1) (Index 1) Test.200; - let Test.39 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.200; - inc Test.39; - let Test.37 : I32 = UnionAtIndex (Id 1) (Index 3) Test.200; - let Test.34 : I32 = UnionAtIndex (Id 1) (Index 3) Test.180; - joinpoint #Derived_gen.28 #Derived_gen.194 #Derived_gen.195 #Derived_gen.196: - let Test.192 : Int1 = false; - let Test.189 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.196 UpdateModeId { id: 107 } TagId(1) Test.33 Test.35 Test.36 Test.34 Test.192; - let Test.191 : Int1 = false; - let Test.190 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.195 UpdateModeId { id: 106 } TagId(1) Test.39 Test.18 Test.19 Test.17 Test.191; - let Test.188 : Int1 = true; - let Test.187 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.194 UpdateModeId { id: 105 } TagId(1) Test.189 Test.38 Test.190 Test.37 Test.188; - ret Test.187; + let Test.228 : U8 = 1i64; + let Test.229 : U8 = GetTagId Test.180; + let Test.230 : Int1 = lowlevel Eq Test.228 Test.229; + if Test.230 then + joinpoint Test.225 #Derived_gen.226: + joinpoint Test.216 #Derived_gen.227: + let Test.46 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; + let Test.48 : I64 = UnionAtIndex (Id 1) (Index 1) Test.180; + let Test.49 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.180; + let Test.47 : I32 = UnionAtIndex (Id 1) (Index 3) Test.180; + joinpoint #Derived_gen.66 #Derived_gen.229 #Derived_gen.230: + let Test.196 : Int1 = true; + let Test.195 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.230 UpdateModeId { id: 100 } TagId(1) Test.46 Test.48 Test.49 Test.47 Test.196; + let Test.194 : Int1 = false; + let Test.193 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.229 UpdateModeId { id: 99 } TagId(1) Test.195 Test.18 Test.19 Test.17 Test.194; + let #Derived_gen.16 : {} = lowlevel PtrStore #Derived_gen.6 Test.193; + let #Derived_gen.15 : [C *self I64 *self I32 Int1, ] = lowlevel PtrLoad #Derived_gen.7; + ret #Derived_gen.15; in - let #Derived_gen.29 : Int1 = lowlevel RefCountIsUnique Test.180; - if #Derived_gen.29 then - let #Derived_gen.197 : [C *self I64 *self I32 Int1, ] = Reset { symbol: Test.200, id: UpdateModeId { id: 108 } }; - let #Derived_gen.198 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.180, id: UpdateModeId { id: 109 } }; - jump #Derived_gen.28 #Derived_gen.191 #Derived_gen.197 #Derived_gen.198; + let #Derived_gen.67 : Int1 = lowlevel RefCountIsUnique Test.180; + if #Derived_gen.67 then + let #Derived_gen.231 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.180, id: UpdateModeId { id: 101 } }; + jump #Derived_gen.66 #Derived_gen.227 #Derived_gen.231; else - inc Test.33; + inc Test.46; + inc Test.49; decref Test.180; - let #Derived_gen.199 : [C *self I64 *self I32 Int1, ] = NullPointer; - jump #Derived_gen.28 #Derived_gen.199 #Derived_gen.199 #Derived_gen.191; + let #Derived_gen.232 : [C *self I64 *self I32 Int1, ] = NullPointer; + jump #Derived_gen.66 #Derived_gen.232 #Derived_gen.227; in - let Test.204 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; - let Test.205 : U8 = 1i64; - let Test.206 : U8 = GetTagId Test.204; - let Test.209 : Int1 = lowlevel Eq Test.205 Test.206; - if Test.209 then - let Test.201 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; - let Test.202 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.201; - let Test.203 : Int1 = true; - let Test.208 : Int1 = lowlevel Eq Test.203 Test.202; - if Test.208 then - jump Test.199 #Derived_gen.77; + let Test.213 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; + let Test.214 : U8 = 1i64; + let Test.215 : U8 = GetTagId Test.213; + let Test.218 : Int1 = lowlevel Eq Test.214 Test.215; + if Test.218 then + let Test.210 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; + let Test.211 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.210; + let Test.212 : Int1 = true; + let Test.217 : Int1 = lowlevel Eq Test.212 Test.211; + if Test.217 then + jump Test.199 #Derived_gen.226; + else + jump Test.216 #Derived_gen.226; + else + jump Test.216 #Derived_gen.226; + in + let Test.222 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.180; + let Test.223 : U8 = 1i64; + let Test.224 : U8 = GetTagId Test.222; + let Test.227 : Int1 = lowlevel Eq Test.223 Test.224; + if Test.227 then + let Test.219 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.180; + let Test.220 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.219; + let Test.221 : Int1 = true; + let Test.226 : Int1 = lowlevel Eq Test.221 Test.220; + if Test.226 then + joinpoint Test.207 #Derived_gen.233: + let Test.33 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; + let Test.35 : I64 = UnionAtIndex (Id 1) (Index 1) Test.180; + let Test.200 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.180; + let Test.36 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.200; + inc Test.36; + let Test.38 : I64 = UnionAtIndex (Id 1) (Index 1) Test.200; + let Test.39 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.200; + inc Test.39; + let Test.37 : I32 = UnionAtIndex (Id 1) (Index 3) Test.200; + let Test.34 : I32 = UnionAtIndex (Id 1) (Index 3) Test.180; + joinpoint #Derived_gen.70 #Derived_gen.236 #Derived_gen.237 #Derived_gen.238: + let Test.192 : Int1 = false; + let Test.189 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.238 UpdateModeId { id: 107 } TagId(1) Test.33 Test.35 Test.36 Test.34 Test.192; + let Test.191 : Int1 = false; + let Test.190 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.237 UpdateModeId { id: 106 } TagId(1) Test.39 Test.18 Test.19 Test.17 Test.191; + let Test.188 : Int1 = true; + let Test.187 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.236 UpdateModeId { id: 105 } TagId(1) Test.189 Test.38 Test.190 Test.37 Test.188; + let #Derived_gen.18 : {} = lowlevel PtrStore #Derived_gen.6 Test.187; + let #Derived_gen.17 : [C *self I64 *self I32 Int1, ] = lowlevel PtrLoad #Derived_gen.7; + ret #Derived_gen.17; + in + let #Derived_gen.71 : Int1 = lowlevel RefCountIsUnique Test.180; + if #Derived_gen.71 then + let #Derived_gen.239 : [C *self I64 *self I32 Int1, ] = Reset { symbol: Test.200, id: UpdateModeId { id: 108 } }; + let #Derived_gen.240 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.180, id: UpdateModeId { id: 109 } }; + jump #Derived_gen.70 #Derived_gen.233 #Derived_gen.239 #Derived_gen.240; + else + inc Test.33; + decref Test.180; + let #Derived_gen.241 : [C *self I64 *self I32 Int1, ] = NullPointer; + jump #Derived_gen.70 #Derived_gen.241 #Derived_gen.241 #Derived_gen.233; + in + let Test.204 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; + let Test.205 : U8 = 1i64; + let Test.206 : U8 = GetTagId Test.204; + let Test.209 : Int1 = lowlevel Eq Test.205 Test.206; + if Test.209 then + let Test.201 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.180; + let Test.202 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.201; + let Test.203 : Int1 = true; + let Test.208 : Int1 = lowlevel Eq Test.203 Test.202; + if Test.208 then + jump Test.199 #Derived_gen.119; + else + jump Test.207 #Derived_gen.119; else - jump Test.207 #Derived_gen.77; + jump Test.207 #Derived_gen.119; else - jump Test.207 #Derived_gen.77; + jump Test.225 #Derived_gen.119; else - jump Test.225 #Derived_gen.77; + jump Test.225 #Derived_gen.119; else - jump Test.225 #Derived_gen.77; + decref #Derived_gen.119; + dec Test.19; + let Test.197 : [C *self I64 *self I32 Int1, ] = TagId(0) ; + let #Derived_gen.20 : {} = lowlevel PtrStore #Derived_gen.6 Test.197; + let #Derived_gen.19 : [C *self I64 *self I32 Int1, ] = lowlevel PtrLoad #Derived_gen.7; + ret #Derived_gen.19; else - decref #Derived_gen.77; - dec Test.19; - let Test.197 : [C *self I64 *self I32 Int1, ] = TagId(0) ; - ret Test.197; + jump Test.238 #Derived_gen.119; else - jump Test.238 #Derived_gen.77; + jump Test.238 #Derived_gen.119; else - jump Test.238 #Derived_gen.77; - else - let Test.117 : Int1 = CallByName Num.24 Test.10 Test.17; - if Test.117 then - joinpoint Test.176 #Derived_gen.291: - let Test.171 : [C *self I64 *self I32 Int1, ] = CallByName Test.3 Test.19 Test.10 Test.11; - let Test.170 : Int1 = false; - let Test.169 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.291 UpdateModeId { id: 196 } TagId(1) Test.16 Test.18 Test.171 Test.17 Test.170; - ret Test.169; - in - let Test.174 : U8 = 1i64; - let Test.175 : U8 = GetTagId Test.19; - let Test.178 : Int1 = lowlevel Eq Test.174 Test.175; - if Test.178 then - let Test.172 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.19; - let Test.173 : Int1 = true; - let Test.177 : Int1 = lowlevel Eq Test.173 Test.172; - if Test.177 then - inc Test.19; - let #Derived_gen.292 : [C *self I64 *self I32 Int1, ] = Reset { symbol: Test.16, id: UpdateModeId { id: 197 } }; - let Test.118 : [C *self I64 *self I32 Int1, ] = CallByName Test.3 Test.19 Test.10 Test.11; - joinpoint Test.137 #Derived_gen.332 #Derived_gen.333: - let Test.136 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; - let Test.57 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.136; - inc Test.57; - let Test.59 : I64 = UnionAtIndex (Id 1) (Index 1) Test.136; - let Test.60 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.136; - inc Test.60; - let Test.58 : I32 = UnionAtIndex (Id 1) (Index 3) Test.136; - let Test.62 : I64 = UnionAtIndex (Id 1) (Index 1) Test.118; - let Test.63 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.118; - let Test.61 : I32 = UnionAtIndex (Id 1) (Index 3) Test.118; - joinpoint #Derived_gen.70 #Derived_gen.337 #Derived_gen.338 #Derived_gen.339: - let Test.124 : Int1 = false; - let Test.121 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.339 UpdateModeId { id: 242 } TagId(1) Test.57 Test.59 Test.60 Test.58 Test.124; - let Test.123 : Int1 = false; - let Test.122 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.338 UpdateModeId { id: 241 } TagId(1) Test.63 Test.18 Test.19 Test.17 Test.123; - let Test.120 : Int1 = true; - let Test.119 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.337 UpdateModeId { id: 240 } TagId(1) Test.121 Test.62 Test.122 Test.61 Test.120; - ret Test.119; - in - let #Derived_gen.71 : Int1 = lowlevel RefCountIsUnique Test.118; - if #Derived_gen.71 then - decref #Derived_gen.332; - let #Derived_gen.340 : [C *self I64 *self I32 Int1, ] = Reset { symbol: Test.136, id: UpdateModeId { id: 243 } }; - let #Derived_gen.341 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.118, id: UpdateModeId { id: 244 } }; - jump #Derived_gen.70 #Derived_gen.333 #Derived_gen.340 #Derived_gen.341; - else - inc Test.63; - decref Test.118; - let #Derived_gen.342 : [C *self I64 *self I32 Int1, ] = NullPointer; - jump #Derived_gen.70 #Derived_gen.342 #Derived_gen.332 #Derived_gen.333; - in - let Test.166 : U8 = 1i64; - let Test.167 : U8 = GetTagId Test.118; - let Test.168 : Int1 = lowlevel Eq Test.166 Test.167; - if Test.168 then - joinpoint Test.163 #Derived_gen.354 #Derived_gen.355: - joinpoint Test.154 #Derived_gen.356 #Derived_gen.357: - let Test.83 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; - let Test.85 : I64 = UnionAtIndex (Id 1) (Index 1) Test.118; - let Test.86 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.118; - let Test.84 : I32 = UnionAtIndex (Id 1) (Index 3) Test.118; - joinpoint #Derived_gen.60 #Derived_gen.360 #Derived_gen.361: - let Test.134 : Int1 = true; - let Test.133 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.361 UpdateModeId { id: 262 } TagId(1) Test.83 Test.85 Test.86 Test.84 Test.134; - let Test.132 : Int1 = false; - let Test.131 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.360 UpdateModeId { id: 261 } TagId(1) Test.133 Test.18 Test.19 Test.17 Test.132; - ret Test.131; - in - let #Derived_gen.61 : Int1 = lowlevel RefCountIsUnique Test.118; - if #Derived_gen.61 then - decref #Derived_gen.356; - let #Derived_gen.362 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.118, id: UpdateModeId { id: 263 } }; - jump #Derived_gen.60 #Derived_gen.357 #Derived_gen.362; - else - inc Test.83; - inc Test.86; - decref Test.118; - jump #Derived_gen.60 #Derived_gen.356 #Derived_gen.357; + let Test.117 : Int1 = CallByName Num.24 Test.10 Test.17; + if Test.117 then + joinpoint Test.176 #Derived_gen.333: + let Test.170 : Int1 = false; + let #Derived_gen.21 : [C *self I64 *self I32 Int1, ] = NullPointer; + let Test.169 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.333 UpdateModeId { id: 196 } TagId(1) Test.16 Test.18 #Derived_gen.21 Test.17 Test.170; + let #Derived_gen.22 : Ptr([C *self I64 *self I32 Int1, ]) = UnionFieldPtrAtIndex (Id 1) (Index 2) Test.169; + let #Derived_gen.23 : {} = lowlevel PtrStore #Derived_gen.6 Test.169; + jump #Derived_gen.5 Test.19 Test.10 Test.11 #Derived_gen.22 #Derived_gen.7; + in + let Test.174 : U8 = 1i64; + let Test.175 : U8 = GetTagId Test.19; + let Test.178 : Int1 = lowlevel Eq Test.174 Test.175; + if Test.178 then + let Test.172 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.19; + let Test.173 : Int1 = true; + let Test.177 : Int1 = lowlevel Eq Test.173 Test.172; + if Test.177 then + inc Test.19; + let #Derived_gen.334 : [C *self I64 *self I32 Int1, ] = Reset { symbol: Test.16, id: UpdateModeId { id: 197 } }; + let Test.118 : [C *self I64 *self I32 Int1, ] = CallByName Test.3 Test.19 Test.10 Test.11; + joinpoint Test.137 #Derived_gen.374 #Derived_gen.375: + let Test.136 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; + let Test.57 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.136; + inc Test.57; + let Test.59 : I64 = UnionAtIndex (Id 1) (Index 1) Test.136; + let Test.60 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.136; + inc Test.60; + let Test.58 : I32 = UnionAtIndex (Id 1) (Index 3) Test.136; + let Test.62 : I64 = UnionAtIndex (Id 1) (Index 1) Test.118; + let Test.63 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.118; + let Test.61 : I32 = UnionAtIndex (Id 1) (Index 3) Test.118; + joinpoint #Derived_gen.112 #Derived_gen.379 #Derived_gen.380 #Derived_gen.381: + let Test.124 : Int1 = false; + let Test.121 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.381 UpdateModeId { id: 242 } TagId(1) Test.57 Test.59 Test.60 Test.58 Test.124; + let Test.123 : Int1 = false; + let Test.122 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.380 UpdateModeId { id: 241 } TagId(1) Test.63 Test.18 Test.19 Test.17 Test.123; + let Test.120 : Int1 = true; + let Test.119 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.379 UpdateModeId { id: 240 } TagId(1) Test.121 Test.62 Test.122 Test.61 Test.120; + let #Derived_gen.25 : {} = lowlevel PtrStore #Derived_gen.6 Test.119; + let #Derived_gen.24 : [C *self I64 *self I32 Int1, ] = lowlevel PtrLoad #Derived_gen.7; + ret #Derived_gen.24; in - let Test.151 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; - let Test.152 : U8 = 1i64; - let Test.153 : U8 = GetTagId Test.151; - let Test.156 : Int1 = lowlevel Eq Test.152 Test.153; - if Test.156 then - let Test.148 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; - let Test.149 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.148; - let Test.150 : Int1 = true; - let Test.155 : Int1 = lowlevel Eq Test.150 Test.149; - if Test.155 then - jump Test.137 #Derived_gen.354 #Derived_gen.355; - else - jump Test.154 #Derived_gen.354 #Derived_gen.355; + let #Derived_gen.113 : Int1 = lowlevel RefCountIsUnique Test.118; + if #Derived_gen.113 then + decref #Derived_gen.374; + let #Derived_gen.382 : [C *self I64 *self I32 Int1, ] = Reset { symbol: Test.136, id: UpdateModeId { id: 243 } }; + let #Derived_gen.383 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.118, id: UpdateModeId { id: 244 } }; + jump #Derived_gen.112 #Derived_gen.375 #Derived_gen.382 #Derived_gen.383; else - jump Test.154 #Derived_gen.354 #Derived_gen.355; + inc Test.63; + decref Test.118; + let #Derived_gen.384 : [C *self I64 *self I32 Int1, ] = NullPointer; + jump #Derived_gen.112 #Derived_gen.384 #Derived_gen.374 #Derived_gen.375; in - let Test.160 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.118; - let Test.161 : U8 = 1i64; - let Test.162 : U8 = GetTagId Test.160; - let Test.165 : Int1 = lowlevel Eq Test.161 Test.162; - if Test.165 then - let Test.157 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.118; - let Test.158 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.157; - let Test.159 : Int1 = true; - let Test.164 : Int1 = lowlevel Eq Test.159 Test.158; - if Test.164 then - joinpoint Test.145 #Derived_gen.363 #Derived_gen.364: - let Test.70 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; - let Test.72 : I64 = UnionAtIndex (Id 1) (Index 1) Test.118; - let Test.138 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.118; - let Test.73 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.138; - inc Test.73; - let Test.75 : I64 = UnionAtIndex (Id 1) (Index 1) Test.138; - let Test.76 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.138; - inc Test.76; - let Test.74 : I32 = UnionAtIndex (Id 1) (Index 3) Test.138; - let Test.71 : I32 = UnionAtIndex (Id 1) (Index 3) Test.118; - joinpoint #Derived_gen.64 #Derived_gen.368 #Derived_gen.369 #Derived_gen.370: - let Test.130 : Int1 = false; - let Test.127 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.370 UpdateModeId { id: 271 } TagId(1) Test.70 Test.72 Test.73 Test.71 Test.130; - let Test.129 : Int1 = false; - let Test.128 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.369 UpdateModeId { id: 270 } TagId(1) Test.76 Test.18 Test.19 Test.17 Test.129; - let Test.126 : Int1 = true; - let Test.125 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.368 UpdateModeId { id: 269 } TagId(1) Test.127 Test.75 Test.128 Test.74 Test.126; - ret Test.125; + let Test.166 : U8 = 1i64; + let Test.167 : U8 = GetTagId Test.118; + let Test.168 : Int1 = lowlevel Eq Test.166 Test.167; + if Test.168 then + joinpoint Test.163 #Derived_gen.396 #Derived_gen.397: + joinpoint Test.154 #Derived_gen.398 #Derived_gen.399: + let Test.83 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; + let Test.85 : I64 = UnionAtIndex (Id 1) (Index 1) Test.118; + let Test.86 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.118; + let Test.84 : I32 = UnionAtIndex (Id 1) (Index 3) Test.118; + joinpoint #Derived_gen.102 #Derived_gen.402 #Derived_gen.403: + let Test.134 : Int1 = true; + let Test.133 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.403 UpdateModeId { id: 262 } TagId(1) Test.83 Test.85 Test.86 Test.84 Test.134; + let Test.132 : Int1 = false; + let Test.131 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.402 UpdateModeId { id: 261 } TagId(1) Test.133 Test.18 Test.19 Test.17 Test.132; + let #Derived_gen.27 : {} = lowlevel PtrStore #Derived_gen.6 Test.131; + let #Derived_gen.26 : [C *self I64 *self I32 Int1, ] = lowlevel PtrLoad #Derived_gen.7; + ret #Derived_gen.26; in - let #Derived_gen.65 : Int1 = lowlevel RefCountIsUnique Test.118; - if #Derived_gen.65 then - decref #Derived_gen.363; - let #Derived_gen.371 : [C *self I64 *self I32 Int1, ] = Reset { symbol: Test.138, id: UpdateModeId { id: 272 } }; - let #Derived_gen.372 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.118, id: UpdateModeId { id: 273 } }; - jump #Derived_gen.64 #Derived_gen.364 #Derived_gen.371 #Derived_gen.372; + let #Derived_gen.103 : Int1 = lowlevel RefCountIsUnique Test.118; + if #Derived_gen.103 then + decref #Derived_gen.398; + let #Derived_gen.404 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.118, id: UpdateModeId { id: 263 } }; + jump #Derived_gen.102 #Derived_gen.399 #Derived_gen.404; else - inc Test.70; + inc Test.83; + inc Test.86; decref Test.118; - let #Derived_gen.373 : [C *self I64 *self I32 Int1, ] = NullPointer; - jump #Derived_gen.64 #Derived_gen.373 #Derived_gen.363 #Derived_gen.364; + jump #Derived_gen.102 #Derived_gen.398 #Derived_gen.399; in - let Test.142 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; - let Test.143 : U8 = 1i64; - let Test.144 : U8 = GetTagId Test.142; - let Test.147 : Int1 = lowlevel Eq Test.143 Test.144; - if Test.147 then - let Test.139 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; - let Test.140 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.139; - let Test.141 : Int1 = true; - let Test.146 : Int1 = lowlevel Eq Test.141 Test.140; - if Test.146 then - jump Test.137 #Derived_gen.77 #Derived_gen.292; + let Test.151 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; + let Test.152 : U8 = 1i64; + let Test.153 : U8 = GetTagId Test.151; + let Test.156 : Int1 = lowlevel Eq Test.152 Test.153; + if Test.156 then + let Test.148 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; + let Test.149 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.148; + let Test.150 : Int1 = true; + let Test.155 : Int1 = lowlevel Eq Test.150 Test.149; + if Test.155 then + jump Test.137 #Derived_gen.396 #Derived_gen.397; + else + jump Test.154 #Derived_gen.396 #Derived_gen.397; + else + jump Test.154 #Derived_gen.396 #Derived_gen.397; + in + let Test.160 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.118; + let Test.161 : U8 = 1i64; + let Test.162 : U8 = GetTagId Test.160; + let Test.165 : Int1 = lowlevel Eq Test.161 Test.162; + if Test.165 then + let Test.157 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.118; + let Test.158 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.157; + let Test.159 : Int1 = true; + let Test.164 : Int1 = lowlevel Eq Test.159 Test.158; + if Test.164 then + joinpoint Test.145 #Derived_gen.405 #Derived_gen.406: + let Test.70 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; + let Test.72 : I64 = UnionAtIndex (Id 1) (Index 1) Test.118; + let Test.138 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.118; + let Test.73 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.138; + inc Test.73; + let Test.75 : I64 = UnionAtIndex (Id 1) (Index 1) Test.138; + let Test.76 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.138; + inc Test.76; + let Test.74 : I32 = UnionAtIndex (Id 1) (Index 3) Test.138; + let Test.71 : I32 = UnionAtIndex (Id 1) (Index 3) Test.118; + joinpoint #Derived_gen.106 #Derived_gen.410 #Derived_gen.411 #Derived_gen.412: + let Test.130 : Int1 = false; + let Test.127 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.412 UpdateModeId { id: 271 } TagId(1) Test.70 Test.72 Test.73 Test.71 Test.130; + let Test.129 : Int1 = false; + let Test.128 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.411 UpdateModeId { id: 270 } TagId(1) Test.76 Test.18 Test.19 Test.17 Test.129; + let Test.126 : Int1 = true; + let Test.125 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.410 UpdateModeId { id: 269 } TagId(1) Test.127 Test.75 Test.128 Test.74 Test.126; + let #Derived_gen.29 : {} = lowlevel PtrStore #Derived_gen.6 Test.125; + let #Derived_gen.28 : [C *self I64 *self I32 Int1, ] = lowlevel PtrLoad #Derived_gen.7; + ret #Derived_gen.28; + in + let #Derived_gen.107 : Int1 = lowlevel RefCountIsUnique Test.118; + if #Derived_gen.107 then + decref #Derived_gen.405; + let #Derived_gen.413 : [C *self I64 *self I32 Int1, ] = Reset { symbol: Test.138, id: UpdateModeId { id: 272 } }; + let #Derived_gen.414 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.118, id: UpdateModeId { id: 273 } }; + jump #Derived_gen.106 #Derived_gen.406 #Derived_gen.413 #Derived_gen.414; + else + inc Test.70; + decref Test.118; + let #Derived_gen.415 : [C *self I64 *self I32 Int1, ] = NullPointer; + jump #Derived_gen.106 #Derived_gen.415 #Derived_gen.405 #Derived_gen.406; + in + let Test.142 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; + let Test.143 : U8 = 1i64; + let Test.144 : U8 = GetTagId Test.142; + let Test.147 : Int1 = lowlevel Eq Test.143 Test.144; + if Test.147 then + let Test.139 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.118; + let Test.140 : Int1 = UnionAtIndex (Id 1) (Index 4) Test.139; + let Test.141 : Int1 = true; + let Test.146 : Int1 = lowlevel Eq Test.141 Test.140; + if Test.146 then + jump Test.137 #Derived_gen.119 #Derived_gen.334; + else + jump Test.145 #Derived_gen.119 #Derived_gen.334; else - jump Test.145 #Derived_gen.77 #Derived_gen.292; + jump Test.145 #Derived_gen.119 #Derived_gen.334; else - jump Test.145 #Derived_gen.77 #Derived_gen.292; + jump Test.163 #Derived_gen.119 #Derived_gen.334; else - jump Test.163 #Derived_gen.77 #Derived_gen.292; + jump Test.163 #Derived_gen.119 #Derived_gen.334; else - jump Test.163 #Derived_gen.77 #Derived_gen.292; + decref #Derived_gen.334; + decref #Derived_gen.119; + joinpoint #Derived_gen.108: + let Test.135 : [C *self I64 *self I32 Int1, ] = TagId(0) ; + let #Derived_gen.31 : {} = lowlevel PtrStore #Derived_gen.6 Test.135; + let #Derived_gen.30 : [C *self I64 *self I32 Int1, ] = lowlevel PtrLoad #Derived_gen.7; + ret #Derived_gen.30; + in + let #Derived_gen.111 : Int1 = lowlevel RefCountIsUnique Test.19; + if #Derived_gen.111 then + let #Derived_gen.110 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.19; + dec #Derived_gen.110; + let #Derived_gen.109 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.19; + dec #Derived_gen.109; + decref Test.19; + jump #Derived_gen.108; + else + decref Test.19; + jump #Derived_gen.108; else - decref #Derived_gen.292; - decref #Derived_gen.77; - joinpoint #Derived_gen.66: - let Test.135 : [C *self I64 *self I32 Int1, ] = TagId(0) ; - ret Test.135; - in - let #Derived_gen.69 : Int1 = lowlevel RefCountIsUnique Test.19; - if #Derived_gen.69 then - let #Derived_gen.68 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.19; - dec #Derived_gen.68; - let #Derived_gen.67 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.19; - dec #Derived_gen.67; - decref Test.19; - jump #Derived_gen.66; - else - decref Test.19; - jump #Derived_gen.66; + jump Test.176 #Derived_gen.119; else - jump Test.176 #Derived_gen.77; + jump Test.176 #Derived_gen.119; else - jump Test.176 #Derived_gen.77; - else - let Test.116 : Int1 = false; - let Test.115 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.77 UpdateModeId { id: 1 } TagId(1) Test.16 Test.11 Test.19 Test.10 Test.116; - ret Test.115; - in - let #Derived_gen.73 : Int1 = lowlevel RefCountIsUnique Test.9; - if #Derived_gen.73 then - let #Derived_gen.382 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.9, id: UpdateModeId { id: 282 } }; - jump #Derived_gen.72 #Derived_gen.382; - else - inc Test.16; - inc Test.19; - decref Test.9; - let #Derived_gen.383 : [C *self I64 *self I32 Int1, ] = NullPointer; - jump #Derived_gen.72 #Derived_gen.383; - else - let Test.96 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.9; - let Test.98 : I64 = UnionAtIndex (Id 1) (Index 1) Test.9; - let Test.99 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.9; - let Test.97 : I32 = UnionAtIndex (Id 1) (Index 3) Test.9; - joinpoint #Derived_gen.74 #Derived_gen.385: - let Test.247 : Int1 = CallByName Num.22 Test.10 Test.97; - if Test.247 then - let Test.250 : [C *self I64 *self I32 Int1, ] = CallByName Test.3 Test.96 Test.10 Test.11; - let Test.249 : Int1 = true; - let Test.248 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.385 UpdateModeId { id: 284 } TagId(1) Test.250 Test.98 Test.99 Test.97 Test.249; - ret Test.248; + let Test.116 : Int1 = false; + let Test.115 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.119 UpdateModeId { id: 1 } TagId(1) Test.16 Test.11 Test.19 Test.10 Test.116; + let #Derived_gen.33 : {} = lowlevel PtrStore #Derived_gen.6 Test.115; + let #Derived_gen.32 : [C *self I64 *self I32 Int1, ] = lowlevel PtrLoad #Derived_gen.7; + ret #Derived_gen.32; + in + let #Derived_gen.115 : Int1 = lowlevel RefCountIsUnique Test.9; + if #Derived_gen.115 then + let #Derived_gen.424 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.9, id: UpdateModeId { id: 282 } }; + jump #Derived_gen.114 #Derived_gen.424; else - let Test.243 : Int1 = CallByName Num.24 Test.10 Test.97; - if Test.243 then - let Test.246 : [C *self I64 *self I32 Int1, ] = CallByName Test.3 Test.99 Test.10 Test.11; - let Test.245 : Int1 = true; - let Test.244 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.385 UpdateModeId { id: 284 } TagId(1) Test.96 Test.98 Test.246 Test.97 Test.245; - ret Test.244; - else - let Test.242 : Int1 = true; - let Test.241 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.385 UpdateModeId { id: 284 } TagId(1) Test.96 Test.11 Test.99 Test.10 Test.242; - ret Test.241; - in - let #Derived_gen.75 : Int1 = lowlevel RefCountIsUnique Test.9; - if #Derived_gen.75 then - let #Derived_gen.386 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.9, id: UpdateModeId { id: 285 } }; - jump #Derived_gen.74 #Derived_gen.386; + inc Test.16; + inc Test.19; + decref Test.9; + let #Derived_gen.425 : [C *self I64 *self I32 Int1, ] = NullPointer; + jump #Derived_gen.114 #Derived_gen.425; else - inc Test.96; - inc Test.99; - decref Test.9; - let #Derived_gen.387 : [C *self I64 *self I32 Int1, ] = NullPointer; - jump #Derived_gen.74 #Derived_gen.387; + let Test.96 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 0) Test.9; + let Test.98 : I64 = UnionAtIndex (Id 1) (Index 1) Test.9; + let Test.99 : [C *self I64 *self I32 Int1, ] = UnionAtIndex (Id 1) (Index 2) Test.9; + let Test.97 : I32 = UnionAtIndex (Id 1) (Index 3) Test.9; + joinpoint #Derived_gen.116 #Derived_gen.427: + let Test.247 : Int1 = CallByName Num.22 Test.10 Test.97; + if Test.247 then + let Test.249 : Int1 = true; + let #Derived_gen.34 : [C *self I64 *self I32 Int1, ] = NullPointer; + let Test.248 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.427 UpdateModeId { id: 284 } TagId(1) #Derived_gen.34 Test.98 Test.99 Test.97 Test.249; + let #Derived_gen.35 : Ptr([C *self I64 *self I32 Int1, ]) = UnionFieldPtrAtIndex (Id 1) (Index 0) Test.248; + let #Derived_gen.36 : {} = lowlevel PtrStore #Derived_gen.6 Test.248; + jump #Derived_gen.5 Test.96 Test.10 Test.11 #Derived_gen.35 #Derived_gen.7; + else + let Test.243 : Int1 = CallByName Num.24 Test.10 Test.97; + if Test.243 then + let Test.245 : Int1 = true; + let #Derived_gen.37 : [C *self I64 *self I32 Int1, ] = NullPointer; + let Test.244 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.427 UpdateModeId { id: 284 } TagId(1) Test.96 Test.98 #Derived_gen.37 Test.97 Test.245; + let #Derived_gen.38 : Ptr([C *self I64 *self I32 Int1, ]) = UnionFieldPtrAtIndex (Id 1) (Index 2) Test.244; + let #Derived_gen.39 : {} = lowlevel PtrStore #Derived_gen.6 Test.244; + jump #Derived_gen.5 Test.99 Test.10 Test.11 #Derived_gen.38 #Derived_gen.7; + else + let Test.242 : Int1 = true; + let Test.241 : [C *self I64 *self I32 Int1, ] = Reuse #Derived_gen.427 UpdateModeId { id: 284 } TagId(1) Test.96 Test.11 Test.99 Test.10 Test.242; + let #Derived_gen.41 : {} = lowlevel PtrStore #Derived_gen.6 Test.241; + let #Derived_gen.40 : [C *self I64 *self I32 Int1, ] = lowlevel PtrLoad #Derived_gen.7; + ret #Derived_gen.40; + in + let #Derived_gen.117 : Int1 = lowlevel RefCountIsUnique Test.9; + if #Derived_gen.117 then + let #Derived_gen.428 : [C *self I64 *self I32 Int1, ] = ResetRef { symbol: Test.9, id: UpdateModeId { id: 285 } }; + jump #Derived_gen.116 #Derived_gen.428; + else + inc Test.96; + inc Test.99; + decref Test.9; + let #Derived_gen.429 : [C *self I64 *self I32 Int1, ] = NullPointer; + jump #Derived_gen.116 #Derived_gen.429; + in + jump #Derived_gen.5 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.3; procedure Test.0 (): let Test.281 : [C *self I64 *self I32 Int1, ] = TagId(0) ; diff --git a/crates/compiler/test_mono/generated/recursive_call_capturing_function.txt b/crates/compiler/test_mono/generated/recursive_call_capturing_function.txt index 333be0ae754..44abe4f94b7 100644 --- a/crates/compiler/test_mono/generated/recursive_call_capturing_function.txt +++ b/crates/compiler/test_mono/generated/recursive_call_capturing_function.txt @@ -11,7 +11,7 @@ procedure Test.1 (Test.2): let Test.7 : U32 = CallByName Test.3 Test.8 Test.2; ret Test.7; -procedure Test.3 (Test.17, Test.18): +procedure Test.3 (#Derived_gen.0, #Derived_gen.1): joinpoint Test.9 Test.4 Test.2: let Test.13 : Int1 = CallByName Bool.2; if Test.13 then @@ -20,7 +20,7 @@ procedure Test.3 (Test.17, Test.18): let Test.11 : U32 = CallByName Num.19 Test.4 Test.2; jump Test.9 Test.11 Test.2; in - jump Test.9 Test.17 Test.18; + jump Test.9 #Derived_gen.0 #Derived_gen.1; procedure Test.0 (): let Test.6 : U32 = 6i64; diff --git a/crates/compiler/test_mono/generated/recursive_function_and_union_with_inference_hole.txt b/crates/compiler/test_mono/generated/recursive_function_and_union_with_inference_hole.txt index 341384e835f..32b22743616 100644 --- a/crates/compiler/test_mono/generated/recursive_function_and_union_with_inference_hole.txt +++ b/crates/compiler/test_mono/generated/recursive_function_and_union_with_inference_hole.txt @@ -6,10 +6,10 @@ procedure List.5 (#Attr.2, #Attr.3): procedure Test.2 (Test.5): let Test.6 : List [C List *self] = UnionAtIndex (Id 0) (Index 0) Test.5; inc Test.6; - let #Derived_gen.0 : [C List *self] = Reset { symbol: Test.5, id: UpdateModeId { id: 0 } }; + let #Derived_gen.1 : [C List *self] = Reset { symbol: Test.5, id: UpdateModeId { id: 0 } }; let Test.15 : {} = Struct {}; let Test.7 : List [C List *self] = CallByName List.5 Test.6 Test.15; - let Test.14 : [C List *self] = Reuse #Derived_gen.0 UpdateModeId { id: 0 } TagId(0) Test.7; + let Test.14 : [C List *self] = Reuse #Derived_gen.1 UpdateModeId { id: 0 } TagId(0) Test.7; ret Test.14; procedure Test.0 (): diff --git a/crates/compiler/test_mono/generated/recursive_lambda_set_has_nested_non_recursive_lambda_sets_issue_5026.txt b/crates/compiler/test_mono/generated/recursive_lambda_set_has_nested_non_recursive_lambda_sets_issue_5026.txt index 858df4d18a7..3e08cd465da 100644 --- a/crates/compiler/test_mono/generated/recursive_lambda_set_has_nested_non_recursive_lambda_sets_issue_5026.txt +++ b/crates/compiler/test_mono/generated/recursive_lambda_set_has_nested_non_recursive_lambda_sets_issue_5026.txt @@ -26,7 +26,7 @@ procedure Test.3 (Test.7): procedure Test.6 (Test.16, #Attr.12): let Test.5 : {} = UnionAtIndex (Id 0) (Index 0) #Attr.12; - joinpoint #Derived_gen.0: + joinpoint #Derived_gen.2: let Test.19 : {} = Struct {}; let Test.22 : Str = "foobar"; let Test.20 : [, C {}] = CallByName Test.8 Test.22 Test.5; @@ -42,13 +42,13 @@ procedure Test.6 (Test.16, #Attr.12): ret Test.18; in - let #Derived_gen.1 : Int1 = lowlevel RefCountIsUnique #Attr.12; - if #Derived_gen.1 then + let #Derived_gen.3 : Int1 = lowlevel RefCountIsUnique #Attr.12; + if #Derived_gen.3 then decref #Attr.12; - jump #Derived_gen.0; + jump #Derived_gen.2; else decref #Attr.12; - jump #Derived_gen.0; + jump #Derived_gen.2; procedure Test.8 (Test.9, Test.7): let Test.24 : [, C {}] = CallByName Test.10 Test.9; diff --git a/crates/compiler/test_mono/generated/recursive_lambda_set_resolved_only_upon_specialization.txt b/crates/compiler/test_mono/generated/recursive_lambda_set_resolved_only_upon_specialization.txt index e46d5fb2253..f053cf0a19c 100644 --- a/crates/compiler/test_mono/generated/recursive_lambda_set_resolved_only_upon_specialization.txt +++ b/crates/compiler/test_mono/generated/recursive_lambda_set_resolved_only_upon_specialization.txt @@ -10,7 +10,7 @@ procedure Num.21 (#Attr.2, #Attr.3): let Num.292 : U8 = lowlevel NumMul #Attr.2 #Attr.3; ret Num.292; -procedure Test.1 (Test.26, Test.27): +procedure Test.1 (#Derived_gen.0, #Derived_gen.1): joinpoint Test.11 Test.2 Test.3: let Test.24 : U8 = 0i64; let Test.20 : Int1 = CallByName Bool.11 Test.2 Test.24; @@ -33,13 +33,13 @@ procedure Test.1 (Test.26, Test.27): let Test.14 : [, C *self U8] = TagId(0) Test.3 Test.2; jump Test.11 Test.13 Test.14; in - jump Test.11 Test.26 Test.27; + jump Test.11 #Derived_gen.0 #Derived_gen.1; -procedure Test.4 (Test.28, Test.29): +procedure Test.4 (#Derived_gen.2, #Derived_gen.3): joinpoint Test.15 Test.5 #Attr.12: let Test.2 : U8 = UnionAtIndex (Id 0) (Index 1) #Attr.12; let Test.3 : [, C *self U8] = UnionAtIndex (Id 0) (Index 0) #Attr.12; - joinpoint #Derived_gen.0: + joinpoint #Derived_gen.4: let Test.17 : U8 = CallByName Num.21 Test.2 Test.5; let Test.18 : U8 = GetTagId Test.3; switch Test.18: @@ -52,16 +52,16 @@ procedure Test.4 (Test.28, Test.29): ret Test.16; in - let #Derived_gen.1 : Int1 = lowlevel RefCountIsUnique #Attr.12; - if #Derived_gen.1 then + let #Derived_gen.5 : Int1 = lowlevel RefCountIsUnique #Attr.12; + if #Derived_gen.5 then decref #Attr.12; - jump #Derived_gen.0; + jump #Derived_gen.4; else inc Test.3; decref #Attr.12; - jump #Derived_gen.0; + jump #Derived_gen.4; in - jump Test.15 Test.28 Test.29; + jump Test.15 #Derived_gen.2 #Derived_gen.3; procedure Test.6 (Test.7): ret Test.7; diff --git a/crates/compiler/test_mono/generated/recursively_build_effect.txt b/crates/compiler/test_mono/generated/recursively_build_effect.txt index 5e4853903c6..72edafead47 100644 --- a/crates/compiler/test_mono/generated/recursively_build_effect.txt +++ b/crates/compiler/test_mono/generated/recursively_build_effect.txt @@ -8,8 +8,8 @@ procedure Str.3 (#Attr.2, #Attr.3): procedure Test.11 (Test.29, #Attr.12): let Test.10 : {} = UnionAtIndex (Id 0) (Index 0) #Attr.12; - let #Derived_gen.0 : Int1 = lowlevel RefCountIsUnique #Attr.12; - if #Derived_gen.0 then + let #Derived_gen.9 : Int1 = lowlevel RefCountIsUnique #Attr.12; + if #Derived_gen.9 then decref #Attr.12; ret Test.10; else @@ -19,11 +19,11 @@ procedure Test.11 (Test.29, #Attr.12): procedure Test.11 (Test.29, Test.10): ret Test.10; -procedure Test.14 (Test.62, Test.63): +procedure Test.14 (#Derived_gen.2, #Derived_gen.3): joinpoint Test.37 Test.36 #Attr.12: let Test.12 : {} = UnionAtIndex (Id 1) (Index 1) #Attr.12; let Test.13 : I64 = UnionAtIndex (Id 1) (Index 0) #Attr.12; - joinpoint #Derived_gen.1: + joinpoint #Derived_gen.10: let Test.43 : {} = Struct {}; let Test.42 : {} = CallByName Test.11 Test.43 Test.12; let Test.38 : [C {}, C I64 {}] = CallByName Test.9 Test.42 Test.13; @@ -38,15 +38,15 @@ procedure Test.14 (Test.62, Test.63): jump Test.37 Test.40 Test.38; in - let #Derived_gen.2 : Int1 = lowlevel RefCountIsUnique #Attr.12; - if #Derived_gen.2 then + let #Derived_gen.11 : Int1 = lowlevel RefCountIsUnique #Attr.12; + if #Derived_gen.11 then decref #Attr.12; - jump #Derived_gen.1; + jump #Derived_gen.10; else decref #Attr.12; - jump #Derived_gen.1; + jump #Derived_gen.10; in - jump Test.37 Test.62 Test.63; + jump Test.37 #Derived_gen.2 #Derived_gen.3; procedure Test.2 (): let Test.6 : Str = "Hello"; diff --git a/crates/compiler/test_mono/generated/specialize_after_match.txt b/crates/compiler/test_mono/generated/specialize_after_match.txt index d64d3bbf985..7dd9c9c5eb0 100644 --- a/crates/compiler/test_mono/generated/specialize_after_match.txt +++ b/crates/compiler/test_mono/generated/specialize_after_match.txt @@ -23,7 +23,7 @@ procedure Test.2 (Test.9, Test.10): let Test.29 : U64 = CallByName Test.3 Test.9; ret Test.29; else - joinpoint #Derived_gen.3: + joinpoint #Derived_gen.4: let Test.13 : Str = UnionAtIndex (Id 0) (Index 0) Test.10; let Test.14 : [, C Str *self] = UnionAtIndex (Id 0) (Index 1) Test.10; let Test.33 : U64 = CallByName Test.3 Test.12; @@ -36,15 +36,15 @@ procedure Test.2 (Test.9, Test.10): else ret Test.16; in - let #Derived_gen.4 : Int1 = lowlevel RefCountIsUnique Test.9; - if #Derived_gen.4 then + let #Derived_gen.5 : Int1 = lowlevel RefCountIsUnique Test.9; + if #Derived_gen.5 then dec Test.11; decref Test.9; - jump #Derived_gen.3; + jump #Derived_gen.4; else inc Test.12; decref Test.9; - jump #Derived_gen.3; + jump #Derived_gen.4; procedure Test.3 (Test.17): let Test.26 : U8 = 1i64; @@ -55,22 +55,22 @@ procedure Test.3 (Test.17): ret Test.22; else let Test.18 : [, C Str *self] = UnionAtIndex (Id 0) (Index 1) Test.17; - joinpoint #Derived_gen.0: + joinpoint #Derived_gen.1: let Test.24 : U64 = 1i64; let Test.25 : U64 = CallByName Test.3 Test.18; let Test.23 : U64 = CallByName Num.19 Test.24 Test.25; ret Test.23; in - let #Derived_gen.2 : Int1 = lowlevel RefCountIsUnique Test.17; - if #Derived_gen.2 then - let #Derived_gen.1 : Str = UnionAtIndex (Id 0) (Index 0) Test.17; - dec #Derived_gen.1; + let #Derived_gen.3 : Int1 = lowlevel RefCountIsUnique Test.17; + if #Derived_gen.3 then + let #Derived_gen.2 : Str = UnionAtIndex (Id 0) (Index 0) Test.17; + dec #Derived_gen.2; decref Test.17; - jump #Derived_gen.0; + jump #Derived_gen.1; else inc Test.18; decref Test.17; - jump #Derived_gen.0; + jump #Derived_gen.1; procedure Test.0 (): let Test.5 : [, C Str *self] = TagId(1) ; diff --git a/crates/compiler/test_mono/generated/tail_call_elimination.txt b/crates/compiler/test_mono/generated/tail_call_elimination.txt index ede33bf2bcf..798de03e174 100644 --- a/crates/compiler/test_mono/generated/tail_call_elimination.txt +++ b/crates/compiler/test_mono/generated/tail_call_elimination.txt @@ -6,7 +6,7 @@ procedure Num.20 (#Attr.2, #Attr.3): let Num.293 : I64 = lowlevel NumSub #Attr.2 #Attr.3; ret Num.293; -procedure Test.1 (Test.15, Test.16): +procedure Test.1 (#Derived_gen.0, #Derived_gen.1): joinpoint Test.7 Test.2 Test.3: let Test.13 : I64 = 0i64; let Test.14 : Int1 = lowlevel Eq Test.13 Test.2; @@ -18,7 +18,7 @@ procedure Test.1 (Test.15, Test.16): let Test.11 : I64 = CallByName Num.19 Test.2 Test.3; jump Test.7 Test.10 Test.11; in - jump Test.7 Test.15 Test.16; + jump Test.7 #Derived_gen.0 #Derived_gen.1; procedure Test.0 (): let Test.5 : I64 = 1000000i64; diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt index 14474338b6e..1bc8990f43f 100644 --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt @@ -20,12 +20,12 @@ procedure Encode.24 (Encode.99, Encode.107, Encode.101): ret Encode.111; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.118 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107; - ret Encode.118; + let Encode.113 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107; + ret Encode.113; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.123 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; - ret Encode.123; + let Encode.118 : List U8 = CallByName TotallyNotJson.182 Encode.99 Encode.101 Encode.107; + ret Encode.118; procedure Encode.26 (Encode.105, Encode.106): let Encode.109 : List U8 = Array []; @@ -136,23 +136,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.598 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.598; -procedure List.80 (List.647, List.648, List.649, List.650, List.651): - joinpoint List.553 List.439 List.440 List.441 List.442 List.443: - let List.555 : Int1 = CallByName Num.22 List.442 List.443; - if List.555 then - let List.562 : Str = CallByName List.66 List.439 List.442; - inc List.562; - let List.556 : {List U8, U64} = CallByName List.145 List.440 List.562 List.441; - let List.559 : U64 = 1i64; - let List.558 : U64 = CallByName Num.19 List.442 List.559; - jump List.553 List.439 List.556 List.441 List.558 List.443; - else - dec List.439; - ret List.440; - in - jump List.553 List.647 List.648 List.649 List.650 List.651; - -procedure List.80 (List.664, List.665, List.666, List.667, List.668): +procedure List.80 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14, #Derived_gen.15): joinpoint List.573 List.439 List.440 List.441 List.442 List.443: let List.575 : Int1 = CallByName Num.22 List.442 List.443; if List.575 then @@ -165,9 +149,9 @@ procedure List.80 (List.664, List.665, List.666, List.667, List.668): dec List.439; ret List.440; in - jump List.573 List.664 List.665 List.666 List.667 List.668; + jump List.573 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15; -procedure List.80 (List.691, List.692, List.693, List.694, List.695): +procedure List.80 (#Derived_gen.16, #Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20): joinpoint List.626 List.439 List.440 List.441 List.442 List.443: let List.628 : Int1 = CallByName Num.22 List.442 List.443; if List.628 then @@ -191,7 +175,23 @@ procedure List.80 (List.691, List.692, List.693, List.694, List.695): let List.627 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.440; ret List.627; in - jump List.626 List.691 List.692 List.693 List.694 List.695; + jump List.626 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20; + +procedure List.80 (#Derived_gen.6, #Derived_gen.7, #Derived_gen.8, #Derived_gen.9, #Derived_gen.10): + joinpoint List.553 List.439 List.440 List.441 List.442 List.443: + let List.555 : Int1 = CallByName Num.22 List.442 List.443; + if List.555 then + let List.562 : Str = CallByName List.66 List.439 List.442; + inc List.562; + let List.556 : {List U8, U64} = CallByName List.145 List.440 List.562 List.441; + let List.559 : U64 = 1i64; + let List.558 : U64 = CallByName Num.19 List.442 List.559; + jump List.553 List.439 List.556 List.441 List.558 List.443; + else + dec List.439; + ret List.440; + in + jump List.553 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10; procedure List.93 (List.436, List.437, List.438): let List.551 : U64 = 0i64; @@ -262,8 +262,8 @@ procedure Test.5 (Test.6, Test.7, Test.4): if Test.25 then let Test.26 : Str = "A"; let Test.29 : Str = StructAtIndex 0 Test.4; - let #Derived_gen.0 : Str = StructAtIndex 1 Test.4; - dec #Derived_gen.0; + let #Derived_gen.24 : Str = StructAtIndex 1 Test.4; + dec #Derived_gen.24; let Test.28 : Str = CallByName TotallyNotJson.25 Test.29; let Test.27 : List Str = Array [Test.28]; let Test.19 : {Str, List Str} = CallByName TotallyNotJson.32 Test.26 Test.27; @@ -271,8 +271,8 @@ procedure Test.5 (Test.6, Test.7, Test.4): else let Test.21 : Str = "B"; let Test.24 : Str = StructAtIndex 1 Test.4; - let #Derived_gen.1 : Str = StructAtIndex 0 Test.4; - dec #Derived_gen.1; + let #Derived_gen.25 : Str = StructAtIndex 0 Test.4; + dec #Derived_gen.25; let Test.23 : Str = CallByName TotallyNotJson.25 Test.24; let Test.22 : List Str = Array [Test.23]; let Test.19 : {Str, List Str} = CallByName TotallyNotJson.32 Test.21 Test.22; diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification.txt index a71c0661a45..f81285c492c 100644 --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification.txt @@ -59,8 +59,8 @@ procedure Test.43 (Test.44, Test.42): jump Test.62 Test.61; else let Test.69 : U8 = StructAtIndex 1 Test.42; - let #Derived_gen.0 : Str = StructAtIndex 0 Test.42; - dec #Derived_gen.0; + let #Derived_gen.5 : Str = StructAtIndex 0 Test.42; + dec #Derived_gen.5; let Test.63 : Int1 = CallByName Test.15 Test.69; let Test.61 : Int1 = CallByName Test.14 Test.63; jump Test.62 Test.61; diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt index 8b07ca09815..f61f2ffa113 100644 --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt @@ -48,32 +48,32 @@ procedure Encode.23 (Encode.98): procedure Encode.24 (Encode.99, Encode.107, Encode.101): dec Encode.99; - let Encode.138 : Str = "a Lambda Set is empty. Most likely there is a type error in your program."; - Crash Encode.138 + let Encode.125 : Str = "a Lambda Set is empty. Most likely there is a type error in your program."; + Crash Encode.125 procedure Encode.24 (Encode.99, Encode.107, Encode.101): let Encode.111 : List U8 = CallByName Test.5 Encode.99 Encode.101 Encode.107; ret Encode.111; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.118 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107; - ret Encode.118; + let Encode.113 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107; + ret Encode.113; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.122 : U8 = GetTagId Encode.107; - switch Encode.122: + let Encode.117 : U8 = GetTagId Encode.107; + switch Encode.117: case 0: - let Encode.121 : List U8 = CallByName #Derived.2 Encode.99 Encode.101 Encode.107; - ret Encode.121; + let Encode.116 : List U8 = CallByName #Derived.2 Encode.99 Encode.101 Encode.107; + ret Encode.116; default: - let Encode.121 : List U8 = CallByName #Derived.7 Encode.99 Encode.101 Encode.107; - ret Encode.121; + let Encode.116 : List U8 = CallByName #Derived.7 Encode.99 Encode.101 Encode.107; + ret Encode.116; procedure Encode.24 (Encode.99, Encode.107, Encode.101): - let Encode.134 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107; - ret Encode.134; + let Encode.121 : List U8 = CallByName TotallyNotJson.264 Encode.99 Encode.101 Encode.107; + ret Encode.121; procedure Encode.26 (Encode.105, Encode.106): let Encode.109 : List U8 = Array []; @@ -86,52 +86,67 @@ procedure List.145 (List.146, List.147, List.144): ret List.566; procedure List.145 (List.146, List.147, List.144): - let List.639 : {List U8, U64} = CallByName TotallyNotJson.267 List.146 List.147 List.144; - ret List.639; + let List.614 : {List U8, U64} = CallByName TotallyNotJson.267 List.146 List.147 List.144; + ret List.614; procedure List.18 (List.142, List.143, List.144): let List.547 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; ret List.547; procedure List.18 (List.142, List.143, List.144): - let List.620 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; - ret List.620; + let List.595 : {List U8, U64} = CallByName List.93 List.142 List.143 List.144; + ret List.595; procedure List.4 (List.113, List.114): - let List.619 : U64 = 1i64; - let List.618 : List U8 = CallByName List.70 List.113 List.619; - let List.617 : List U8 = CallByName List.71 List.618 List.114; - ret List.617; + let List.594 : U64 = 1i64; + let List.593 : List U8 = CallByName List.70 List.113 List.594; + let List.592 : List U8 = CallByName List.71 List.593 List.114; + ret List.592; procedure List.6 (#Attr.2): let List.567 : U64 = lowlevel ListLen #Attr.2; ret List.567; procedure List.6 (#Attr.2): - let List.640 : U64 = lowlevel ListLen #Attr.2; - ret List.640; + let List.615 : U64 = lowlevel ListLen #Attr.2; + ret List.615; procedure List.66 (#Attr.2, #Attr.3): let List.563 : [C {}, C {}] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; ret List.563; procedure List.66 (#Attr.2, #Attr.3): - let List.636 : [] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.636; + let List.611 : [] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.611; procedure List.70 (#Attr.2, #Attr.3): - let List.598 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.598; + let List.573 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.573; procedure List.71 (#Attr.2, #Attr.3): - let List.596 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.596; + let List.571 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.571; procedure List.8 (#Attr.2, #Attr.3): - let List.641 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.641; + let List.616 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.616; + +procedure List.80 (#Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24, #Derived_gen.25): + joinpoint List.601 List.439 List.440 List.441 List.442 List.443: + let List.603 : Int1 = CallByName Num.22 List.442 List.443; + if List.603 then + let List.610 : [] = CallByName List.66 List.439 List.442; + let List.604 : {List U8, U64} = CallByName List.145 List.440 List.610 List.441; + let List.607 : U64 = 1i64; + let List.606 : U64 = CallByName Num.19 List.442 List.607; + jump List.601 List.439 List.604 List.441 List.606 List.443; + else + dec List.439; + ret List.440; + in + jump List.601 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25; -procedure List.80 (List.578, List.579, List.580, List.581, List.582): +procedure List.80 (#Derived_gen.29, #Derived_gen.30, #Derived_gen.31, #Derived_gen.32, #Derived_gen.33): joinpoint List.553 List.439 List.440 List.441 List.442 List.443: let List.555 : Int1 = CallByName Num.22 List.442 List.443; if List.555 then @@ -144,22 +159,7 @@ procedure List.80 (List.578, List.579, List.580, List.581, List.582): dec List.439; ret List.440; in - jump List.553 List.578 List.579 List.580 List.581 List.582; - -procedure List.80 (List.651, List.652, List.653, List.654, List.655): - joinpoint List.626 List.439 List.440 List.441 List.442 List.443: - let List.628 : Int1 = CallByName Num.22 List.442 List.443; - if List.628 then - let List.635 : [] = CallByName List.66 List.439 List.442; - let List.629 : {List U8, U64} = CallByName List.145 List.440 List.635 List.441; - let List.632 : U64 = 1i64; - let List.631 : U64 = CallByName Num.19 List.442 List.632; - jump List.626 List.439 List.629 List.441 List.631 List.443; - else - dec List.439; - ret List.440; - in - jump List.626 List.651 List.652 List.653 List.654 List.655; + jump List.553 #Derived_gen.29 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33; procedure List.93 (List.436, List.437, List.438): let List.551 : U64 = 0i64; @@ -168,34 +168,34 @@ procedure List.93 (List.436, List.437, List.438): ret List.550; procedure List.93 (List.436, List.437, List.438): - let List.624 : U64 = 0i64; - let List.625 : U64 = CallByName List.6 List.436; - let List.623 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.624 List.625; - ret List.623; + let List.599 : U64 = 0i64; + let List.600 : U64 = CallByName List.6 List.436; + let List.598 : {List U8, U64} = CallByName List.80 List.436 List.437 List.438 List.599 List.600; + ret List.598; procedure Num.127 (#Attr.2): - let Num.320 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.320; + let Num.311 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.311; procedure Num.19 (#Attr.2, #Attr.3): - let Num.323 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.323; + let Num.314 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.314; procedure Num.20 (#Attr.2, #Attr.3): - let Num.321 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.321; + let Num.312 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.312; procedure Num.22 (#Attr.2, #Attr.3): - let Num.324 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.324; + let Num.315 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.315; procedure Num.24 (#Attr.2, #Attr.3): - let Num.322 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.322; + let Num.313 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.313; procedure Str.12 (#Attr.2): - let Str.300 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.300; + let Str.299 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.299; procedure Test.2 (Test.11): let Test.18 : {{}, {}} = CallByName Encode.23 Test.11; @@ -267,34 +267,34 @@ procedure TotallyNotJson.264 (TotallyNotJson.265, TotallyNotJson.1175, #Attr.12) procedure TotallyNotJson.264 (TotallyNotJson.265, TotallyNotJson.1175, #Attr.12): let TotallyNotJson.263 : List [] = StructAtIndex 1 #Attr.12; let TotallyNotJson.262 : Str = StructAtIndex 0 #Attr.12; - let TotallyNotJson.1264 : I64 = 123i64; - let TotallyNotJson.1263 : U8 = CallByName Num.127 TotallyNotJson.1264; - let TotallyNotJson.1260 : List U8 = CallByName List.4 TotallyNotJson.265 TotallyNotJson.1263; - let TotallyNotJson.1262 : I64 = 34i64; - let TotallyNotJson.1261 : U8 = CallByName Num.127 TotallyNotJson.1262; - let TotallyNotJson.1258 : List U8 = CallByName List.4 TotallyNotJson.1260 TotallyNotJson.1261; - let TotallyNotJson.1259 : List U8 = CallByName Str.12 TotallyNotJson.262; - let TotallyNotJson.1255 : List U8 = CallByName List.8 TotallyNotJson.1258 TotallyNotJson.1259; - let TotallyNotJson.1257 : I64 = 34i64; - let TotallyNotJson.1256 : U8 = CallByName Num.127 TotallyNotJson.1257; - let TotallyNotJson.1252 : List U8 = CallByName List.4 TotallyNotJson.1255 TotallyNotJson.1256; - let TotallyNotJson.1254 : I64 = 58i64; + let TotallyNotJson.1256 : I64 = 123i64; + let TotallyNotJson.1255 : U8 = CallByName Num.127 TotallyNotJson.1256; + let TotallyNotJson.1252 : List U8 = CallByName List.4 TotallyNotJson.265 TotallyNotJson.1255; + let TotallyNotJson.1254 : I64 = 34i64; let TotallyNotJson.1253 : U8 = CallByName Num.127 TotallyNotJson.1254; - let TotallyNotJson.1249 : List U8 = CallByName List.4 TotallyNotJson.1252 TotallyNotJson.1253; - let TotallyNotJson.1251 : I64 = 91i64; - let TotallyNotJson.1250 : U8 = CallByName Num.127 TotallyNotJson.1251; - let TotallyNotJson.268 : List U8 = CallByName List.4 TotallyNotJson.1249 TotallyNotJson.1250; - let TotallyNotJson.1248 : U64 = CallByName List.6 TotallyNotJson.263; - let TotallyNotJson.1236 : {List U8, U64} = Struct {TotallyNotJson.268, TotallyNotJson.1248}; - let TotallyNotJson.1235 : {List U8, U64} = CallByName List.18 TotallyNotJson.263 TotallyNotJson.1236 TotallyNotJson.1175; - let TotallyNotJson.270 : List U8 = StructAtIndex 0 TotallyNotJson.1235; - let TotallyNotJson.1234 : I64 = 93i64; - let TotallyNotJson.1233 : U8 = CallByName Num.127 TotallyNotJson.1234; - let TotallyNotJson.1230 : List U8 = CallByName List.4 TotallyNotJson.270 TotallyNotJson.1233; - let TotallyNotJson.1232 : I64 = 125i64; - let TotallyNotJson.1231 : U8 = CallByName Num.127 TotallyNotJson.1232; - let TotallyNotJson.1229 : List U8 = CallByName List.4 TotallyNotJson.1230 TotallyNotJson.1231; - ret TotallyNotJson.1229; + let TotallyNotJson.1250 : List U8 = CallByName List.4 TotallyNotJson.1252 TotallyNotJson.1253; + let TotallyNotJson.1251 : List U8 = CallByName Str.12 TotallyNotJson.262; + let TotallyNotJson.1247 : List U8 = CallByName List.8 TotallyNotJson.1250 TotallyNotJson.1251; + let TotallyNotJson.1249 : I64 = 34i64; + let TotallyNotJson.1248 : U8 = CallByName Num.127 TotallyNotJson.1249; + let TotallyNotJson.1244 : List U8 = CallByName List.4 TotallyNotJson.1247 TotallyNotJson.1248; + let TotallyNotJson.1246 : I64 = 58i64; + let TotallyNotJson.1245 : U8 = CallByName Num.127 TotallyNotJson.1246; + let TotallyNotJson.1241 : List U8 = CallByName List.4 TotallyNotJson.1244 TotallyNotJson.1245; + let TotallyNotJson.1243 : I64 = 91i64; + let TotallyNotJson.1242 : U8 = CallByName Num.127 TotallyNotJson.1243; + let TotallyNotJson.268 : List U8 = CallByName List.4 TotallyNotJson.1241 TotallyNotJson.1242; + let TotallyNotJson.1240 : U64 = CallByName List.6 TotallyNotJson.263; + let TotallyNotJson.1228 : {List U8, U64} = Struct {TotallyNotJson.268, TotallyNotJson.1240}; + let TotallyNotJson.1227 : {List U8, U64} = CallByName List.18 TotallyNotJson.263 TotallyNotJson.1228 TotallyNotJson.1175; + let TotallyNotJson.270 : List U8 = StructAtIndex 0 TotallyNotJson.1227; + let TotallyNotJson.1226 : I64 = 93i64; + let TotallyNotJson.1225 : U8 = CallByName Num.127 TotallyNotJson.1226; + let TotallyNotJson.1222 : List U8 = CallByName List.4 TotallyNotJson.270 TotallyNotJson.1225; + let TotallyNotJson.1224 : I64 = 125i64; + let TotallyNotJson.1223 : U8 = CallByName Num.127 TotallyNotJson.1224; + let TotallyNotJson.1221 : List U8 = CallByName List.4 TotallyNotJson.1222 TotallyNotJson.1223; + ret TotallyNotJson.1221; procedure TotallyNotJson.267 (TotallyNotJson.1177, TotallyNotJson.273, TotallyNotJson.266): let TotallyNotJson.271 : List U8 = StructAtIndex 0 TotallyNotJson.1177; @@ -320,21 +320,21 @@ procedure TotallyNotJson.267 (TotallyNotJson.1177, TotallyNotJson.273, TotallyNo let TotallyNotJson.271 : List U8 = StructAtIndex 0 TotallyNotJson.1177; let TotallyNotJson.272 : U64 = StructAtIndex 1 TotallyNotJson.1177; let TotallyNotJson.274 : List U8 = CallByName Encode.24 TotallyNotJson.271 TotallyNotJson.273 TotallyNotJson.266; - joinpoint TotallyNotJson.1242 TotallyNotJson.275: - let TotallyNotJson.1240 : U64 = 1i64; - let TotallyNotJson.1239 : U64 = CallByName Num.20 TotallyNotJson.272 TotallyNotJson.1240; - let TotallyNotJson.1238 : {List U8, U64} = Struct {TotallyNotJson.275, TotallyNotJson.1239}; - ret TotallyNotJson.1238; + joinpoint TotallyNotJson.1234 TotallyNotJson.275: + let TotallyNotJson.1232 : U64 = 1i64; + let TotallyNotJson.1231 : U64 = CallByName Num.20 TotallyNotJson.272 TotallyNotJson.1232; + let TotallyNotJson.1230 : {List U8, U64} = Struct {TotallyNotJson.275, TotallyNotJson.1231}; + ret TotallyNotJson.1230; in - let TotallyNotJson.1246 : U64 = 1i64; - let TotallyNotJson.1243 : Int1 = CallByName Num.24 TotallyNotJson.272 TotallyNotJson.1246; - if TotallyNotJson.1243 then - let TotallyNotJson.1245 : I64 = 44i64; - let TotallyNotJson.1244 : U8 = CallByName Num.127 TotallyNotJson.1245; - let TotallyNotJson.1241 : List U8 = CallByName List.4 TotallyNotJson.274 TotallyNotJson.1244; - jump TotallyNotJson.1242 TotallyNotJson.1241; + let TotallyNotJson.1238 : U64 = 1i64; + let TotallyNotJson.1235 : Int1 = CallByName Num.24 TotallyNotJson.272 TotallyNotJson.1238; + if TotallyNotJson.1235 then + let TotallyNotJson.1237 : I64 = 44i64; + let TotallyNotJson.1236 : U8 = CallByName Num.127 TotallyNotJson.1237; + let TotallyNotJson.1233 : List U8 = CallByName List.4 TotallyNotJson.274 TotallyNotJson.1236; + jump TotallyNotJson.1234 TotallyNotJson.1233; else - jump TotallyNotJson.1242 TotallyNotJson.274; + jump TotallyNotJson.1234 TotallyNotJson.274; procedure TotallyNotJson.32 (TotallyNotJson.262, TotallyNotJson.263): let TotallyNotJson.1215 : {Str, List [C {}, C {}]} = Struct {TotallyNotJson.262, TotallyNotJson.263}; @@ -342,9 +342,9 @@ procedure TotallyNotJson.32 (TotallyNotJson.262, TotallyNotJson.263): ret TotallyNotJson.1214; procedure TotallyNotJson.32 (TotallyNotJson.262, TotallyNotJson.263): - let TotallyNotJson.1266 : {Str, List []} = Struct {TotallyNotJson.262, TotallyNotJson.263}; - let TotallyNotJson.1265 : {Str, List []} = CallByName Encode.23 TotallyNotJson.1266; - ret TotallyNotJson.1265; + let TotallyNotJson.1258 : {Str, List []} = Struct {TotallyNotJson.262, TotallyNotJson.263}; + let TotallyNotJson.1257 : {Str, List []} = CallByName Encode.23 TotallyNotJson.1258; + ret TotallyNotJson.1257; procedure Test.0 (): let Test.13 : {{}, {}} = CallByName Test.3; diff --git a/crates/compiler/test_mono/generated/weakening_avoids_overspecialization.txt b/crates/compiler/test_mono/generated/weakening_avoids_overspecialization.txt index 151d18ae6dd..1396a444e32 100644 --- a/crates/compiler/test_mono/generated/weakening_avoids_overspecialization.txt +++ b/crates/compiler/test_mono/generated/weakening_avoids_overspecialization.txt @@ -53,7 +53,7 @@ procedure List.72 (#Attr.2, #Attr.3, #Attr.4): let List.527 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; ret List.527; -procedure List.80 (List.571, List.572, List.573, List.574, List.575): +procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): joinpoint List.545 List.439 List.440 List.441 List.442 List.443: let List.547 : Int1 = CallByName Num.22 List.442 List.443; if List.547 then @@ -77,7 +77,7 @@ procedure List.80 (List.571, List.572, List.573, List.574, List.575): let List.546 : [C U64, C U64] = TagId(1) List.440; ret List.546; in - jump List.545 List.571 List.572 List.573 List.574 List.575; + jump List.545 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure List.93 (List.436, List.437, List.438): let List.543 : U64 = 0i64; diff --git a/crates/compiler/test_mono/src/tests.rs b/crates/compiler/test_mono/src/tests.rs index 1ea7bb17461..71064f8baf3 100644 --- a/crates/compiler/test_mono/src/tests.rs +++ b/crates/compiler/test_mono/src/tests.rs @@ -146,7 +146,9 @@ fn compiles_to_ir(test_name: &str, src: &str, mode: &str, allow_type_errors: boo println!("Ignoring {} canonicalization problems", can_problems.len()); } - assert!(allow_type_errors || type_problems.is_empty()); + if !(allow_type_errors || type_problems.is_empty()) { + panic!("mono test has type problems:\n\n{:#?}", type_problems); + } let main_fn_symbol = exposed_to_host.top_level_values.keys().copied().next(); @@ -2873,11 +2875,11 @@ fn layout_cache_structure_with_multiple_recursive_structures() { LinkedList : [Nil, Cons { first : Chain, rest : LinkedList }] main = - base : LinkedList + base : LinkedList base = Nil walker : LinkedList, Chain -> LinkedList - walker = \rest, first -> Cons { first, rest } + walker = \rest, first -> Cons { first, rest } list : List Chain list = [] @@ -3004,7 +3006,7 @@ fn rb_tree_fbip() { if k < kx then Node Red (ins l k v) kx vx r else - if k > kx + if k > kx then Node Red l kx vx (ins r k v) else Node Red l k v r "# @@ -3017,10 +3019,10 @@ fn specialize_after_match() { r#" app "test" provides [main] to "./platform" - main = + main = listA : LinkedList Str listA = Nil - + listB : LinkedList Str listB = Nil @@ -3033,13 +3035,13 @@ fn specialize_after_match() { Nil -> linkedListLength listB Cons a aa -> when listB is Nil -> linkedListLength listA - Cons b bb -> + Cons b bb -> lengthA = (linkedListLength aa) + 1 lengthB = linkedListLength listB if lengthA > lengthB then lengthA else lengthB - + linkedListLength : LinkedList a -> Nat linkedListLength = \list -> when list is Nil -> 0 @@ -3088,7 +3090,7 @@ fn drop_specialize_after_jump() { v = "value" t = { left: { left: v, right: v }, right: v } tupleItem t - + tupleItem = \t -> true = Bool.true l = t.left @@ -3146,3 +3148,71 @@ fn dbg_str_followed_by_number() { "# ) } + +#[mono_test] +fn linked_list_reverse() { + indoc!( + r#" + app "test" provides [main] to "./platform" + + LinkedList a : [Nil, Cons a (LinkedList a)] + + reverse : LinkedList a -> LinkedList a + reverse = \list -> reverseHelp Nil list + + reverseHelp : LinkedList a, LinkedList a -> LinkedList a + reverseHelp = \accum, list -> + when list is + Nil -> accum + Cons first rest -> reverseHelp (Cons first accum) rest + + main : LinkedList I64 + main = reverse (Cons 42 Nil) + "# + ) +} + +#[mono_test] +fn linked_list_map() { + indoc!( + r#" + app "test" provides [main] to "./platform" + + LinkedList a : [Nil, Cons a (LinkedList a)] + + map : (a -> b), LinkedList a -> LinkedList b + map = \f, list -> + when list is + Nil -> Nil + Cons x xs -> Cons (f x) (map f xs) + + main : LinkedList I64 + main = map (\x -> x + 1i64) (Cons 42 Nil) + "# + ) +} + +#[mono_test] +fn linked_list_filter() { + indoc!( + r#" + app "test" provides [main] to "./platform" + + LinkedList a : [Nil, Cons a (LinkedList a)] + + filter : LinkedList a, (a -> Bool) -> LinkedList a + filter = \list, predicate -> + when list is + Nil -> Nil + Cons x xs -> + if predicate x then + Cons x (filter xs predicate) + else + filter xs predicate + + + main : LinkedList I64 + main = filter (Cons 1 (Cons 2 Nil)) Num.isEven + "# + ) +} diff --git a/crates/glue/src/types.rs b/crates/glue/src/types.rs index 7b66d5ed7dd..d5b6b79fd84 100644 --- a/crates/glue/src/types.rs +++ b/crates/glue/src/types.rs @@ -2085,6 +2085,7 @@ fn tag_union_type_from_layout<'a>( }, } } + LayoutRepr::Ptr(_) => unreachable!("Ptr values are never publicly exposed"), LayoutRepr::Boxed(elem_layout) => { let (tag_name, payload_fields) = single_tag_payload_fields(env, union_tags, subs, layout, &[elem_layout], types); diff --git a/crates/repl_eval/src/eval.rs b/crates/repl_eval/src/eval.rs index 9b053198cd2..1afadb66466 100644 --- a/crates/repl_eval/src/eval.rs +++ b/crates/repl_eval/src/eval.rs @@ -534,6 +534,9 @@ fn jit_to_ast_help<'a, A: ReplApp<'a>>( LayoutRepr::RecursivePointer(_) => { unreachable!("RecursivePointers can only be inside structures") } + LayoutRepr::Ptr(_) => { + unreachable!("Ptr will never be visible to users") + } LayoutRepr::LambdaSet(_) => OPAQUE_FUNCTION, LayoutRepr::Boxed(_) => { let size = env.layout_cache.interner.stack_size(layout); @@ -918,6 +921,9 @@ fn addr_to_ast<'a, M: ReplAppMemory>( (_, LayoutRepr::Boxed(_)) => { unreachable!("Box layouts can only be behind a `Box.Box` application") } + (_, LayoutRepr::Ptr(_)) => { + unreachable!("Ptr layouts are never available in user code") + } }; apply_newtypes(env, newtype_containers.into_bump_slice(), expr) } diff --git a/www/public/repl/index.html b/www/public/repl/index.html index b71fc2c87b7..fdb8c971a65 100644 --- a/www/public/repl/index.html +++ b/www/public/repl/index.html @@ -33,6 +33,7 @@

The rockin' Roc REPL

> +

⚠️ This web REPL misses some features that are available in the CLI (roc repl) like defining variables without a final expression, which will result in the "Missing Final Expression" error.