From 26ed3fedbc2a5e7d1bdb852d5daff60f25601c1b Mon Sep 17 00:00:00 2001 From: Sergei Zharinov Date: Thu, 8 Jan 2026 20:16:18 -0300 Subject: [PATCH] feat: Cache line alignment for all instructions with padding visualization --- crates/plotnik-lib/src/bytecode/dump.rs | 33 ++++ crates/plotnik-lib/src/bytecode/format.rs | 3 + .../plotnik-lib/src/bytecode/instructions.rs | 6 + crates/plotnik-lib/src/emit/layout.rs | 29 ++-- crates/plotnik-lib/src/emit/layout_tests.rs | 159 ++++++++++++++---- ...it__emit_tests__alternations_captured.snap | 11 +- ...t_tests__alternations_captured_tagged.snap | 13 +- ...mit_tests__alternations_in_quantifier.snap | 41 ++--- ...mit__emit_tests__alternations_labeled.snap | 13 +- ...it_tests__alternations_null_injection.snap | 13 +- ...ternations_tagged_in_field_constraint.snap | 9 +- ...ternations_tagged_with_definition_ref.snap | 31 ++-- ...t__emit_tests__alternations_unlabeled.snap | 13 +- ...lib__emit__emit_tests__captures_basic.snap | 17 +- ...t__emit_tests__captures_deeply_nested.snap | 15 +- ...s__captures_enum_with_type_annotation.snap | 13 +- ...mit__emit_tests__captures_nested_flat.snap | 13 +- ...sts__captures_optional_wrapper_struct.snap | 28 +-- ...it__emit_tests__captures_struct_scope.snap | 13 +- ..._captures_struct_with_type_annotation.snap | 11 +- ...emit_tests__captures_with_type_custom.snap | 17 +- ...emit_tests__captures_with_type_string.snap | 17 +- ...__emit_tests__captures_wrapper_struct.snap | 41 ++--- ...tests__comprehensive_multi_definition.snap | 33 ++-- ...mit__emit_tests__definitions_multiple.snap | 15 +- ...mit_tests__definitions_nested_capture.snap | 40 ++--- ...it__emit_tests__definitions_reference.snap | 21 +-- ..._emit__emit_tests__definitions_single.snap | 17 +- ..._emit__emit_tests__fields_alternation.snap | 9 +- ...lib__emit__emit_tests__fields_negated.snap | 11 +- ...ik_lib__emit__emit_tests__nodes_error.snap | 17 +- ..._lib__emit__emit_tests__nodes_missing.snap | 17 +- ...ik_lib__emit__emit_tests__nodes_named.snap | 17 +- ...mit__emit_tests__optional_first_child.snap | 24 +-- ...__emit_tests__optional_null_injection.snap | 17 +- ..._tests__quantifiers_first_child_array.snap | 29 ++-- ...mit__emit_tests__quantifiers_optional.snap | 17 +- ...tests__quantifiers_optional_nongreedy.snap | 17 +- ...b__emit__emit_tests__quantifiers_plus.snap | 27 +-- ...mit_tests__quantifiers_plus_nongreedy.snap | 27 +-- ..._tests__quantifiers_repeat_navigation.snap | 29 ++-- ...s__quantifiers_sequence_in_called_def.snap | 63 +++---- ...b__emit__emit_tests__quantifiers_star.snap | 31 ++-- ...mit_tests__quantifiers_star_nongreedy.snap | 31 ++-- ..._emit_tests__quantifiers_struct_array.snap | 37 ++-- ...b__emit__emit_tests__recursion_simple.snap | 23 +-- ...sts__recursion_with_structured_result.snap | 35 ++-- ...__emit_tests__sequences_in_quantifier.snap | 32 ++-- crates/plotnik-lib/src/engine/trace.rs | 40 +++++ 49 files changed, 737 insertions(+), 498 deletions(-) diff --git a/crates/plotnik-lib/src/bytecode/dump.rs b/crates/plotnik-lib/src/bytecode/dump.rs index df9e9b8e..df549b3b 100644 --- a/crates/plotnik-lib/src/bytecode/dump.rs +++ b/crates/plotnik-lib/src/bytecode/dump.rs @@ -12,6 +12,7 @@ use super::ids::TypeId; use super::instructions::StepId; use super::ir::NodeTypeIR; use super::module::{Instruction, Module}; +use super::nav::Nav; use super::type_meta::{TypeData, TypeKind}; use super::{Call, Match, Return, Trampoline}; @@ -364,6 +365,30 @@ fn dump_entrypoints(out: &mut String, module: &Module, ctx: &DumpContext) { out.push('\n'); } +/// Check if an instruction is padding (all-zeros Match8). +/// +/// Padding slots contain zero bytes which decode as terminal epsilon Match8 +/// with Any node type, no field constraint, and next=0. +fn is_padding(instr: &Instruction) -> bool { + match instr { + Instruction::Match(m) => { + m.is_match8() + && m.nav == Nav::Epsilon + && matches!(m.node_type, NodeTypeIR::Any) + && m.node_field.is_none() + && m.is_terminal() + } + _ => false, + } +} + +/// Format a single padding step line. +/// +/// Output: ` 07 ... ` (step number and " ... " in symbol column) +fn format_padding_step(step: u16, step_width: usize) -> String { + LineBuilder::new(step_width).instruction_prefix(step, Symbol::PADDING) +} + fn dump_code(out: &mut String, module: &Module, ctx: &DumpContext) { let c = &ctx.colors; let header = module.header(); @@ -386,6 +411,14 @@ fn dump_code(out: &mut String, module: &Module, ctx: &DumpContext) { } let instr = module.decode_step(step); + + // Check for padding (all-zeros Match8 instruction) + if is_padding(&instr) { + writeln!(out, "{}", format_padding_step(step, step_width)).unwrap(); + step += 1; + continue; + } + let line = format_instruction(step, &instr, module, ctx, step_width); out.push_str(&line); out.push('\n'); diff --git a/crates/plotnik-lib/src/bytecode/format.rs b/crates/plotnik-lib/src/bytecode/format.rs index a6b34cc5..503bb532 100644 --- a/crates/plotnik-lib/src/bytecode/format.rs +++ b/crates/plotnik-lib/src/bytecode/format.rs @@ -62,6 +62,9 @@ impl Symbol { /// Epsilon symbol for unconditional transitions. pub const EPSILON: Symbol = Symbol::new(" ", "ε", " "); + /// Padding indicator (centered "..." in 5-char column). + pub const PADDING: Symbol = Symbol::new(" ", "...", " "); + /// Format as a 5-character string. pub fn format(&self) -> String { format!("{}{}{}", self.left, self.center, self.right) diff --git a/crates/plotnik-lib/src/bytecode/instructions.rs b/crates/plotnik-lib/src/bytecode/instructions.rs index af5ae71a..1bd85a0a 100644 --- a/crates/plotnik-lib/src/bytecode/instructions.rs +++ b/crates/plotnik-lib/src/bytecode/instructions.rs @@ -216,6 +216,12 @@ impl<'a> Match<'a> { self.nav == Nav::Epsilon } + /// Check if this is a Match8 (8-byte fast-path instruction). + #[inline] + pub fn is_match8(&self) -> bool { + self.is_match8 + } + /// Number of successors. #[inline] pub fn succ_count(&self) -> usize { diff --git a/crates/plotnik-lib/src/emit/layout.rs b/crates/plotnik-lib/src/emit/layout.rs index 11cc88ba..bbbc8338 100644 --- a/crates/plotnik-lib/src/emit/layout.rs +++ b/crates/plotnik-lib/src/emit/layout.rs @@ -1,7 +1,7 @@ //! Cache-aligned instruction layout. //! -//! Uses Pettis-Hansen inspired greedy chain extraction to place -//! hot paths contiguously and avoid cache line straddling. +//! Extracts linear chains from the control flow graph and places them +//! contiguously. Pads instructions to prevent cache line straddling. use std::collections::{BTreeMap, HashSet}; @@ -161,18 +161,23 @@ fn assign_step_ids( }; let size = instr.size(); - // Cache line alignment for large instructions - if size >= 48 { - let line_offset = current_offset % CACHE_LINE; - if line_offset + size > CACHE_LINE { - // Would straddle cache line - pad to next line - let padding_bytes = CACHE_LINE - line_offset; - let padding_steps = (padding_bytes / STEP_SIZE) as u16; - current_step += padding_steps; - current_offset += padding_bytes; - } + // Pad if instruction would straddle cache line boundary + let line_offset = current_offset % CACHE_LINE; + if line_offset + size > CACHE_LINE { + let padding_bytes = CACHE_LINE - line_offset; + let padding_steps = (padding_bytes / STEP_SIZE) as u16; + current_step += padding_steps; + current_offset += padding_bytes; } + // Invariant: instruction must not straddle cache line + assert!( + current_offset % CACHE_LINE + size <= CACHE_LINE, + "instruction at offset {} with size {} straddles 64-byte cache line", + current_offset, + size + ); + mapping.insert(label, current_step); let step_count = (size / STEP_SIZE) as u16; current_step += step_count; diff --git a/crates/plotnik-lib/src/emit/layout_tests.rs b/crates/plotnik-lib/src/emit/layout_tests.rs index adde9e2b..9387b473 100644 --- a/crates/plotnik-lib/src/emit/layout_tests.rs +++ b/crates/plotnik-lib/src/emit/layout_tests.rs @@ -113,45 +113,132 @@ fn layout_branch() { } #[test] -fn layout_large_instruction_cache_alignment() { - // Large instruction (Match48 = 48 bytes = 6 steps) near cache line boundary - // Start at step 5 (offset 40), would straddle - should pad - let large_match = MatchIR::at(Label(1)) - .nav(Nav::Down) - .node_type(NodeTypeIR::Named(NonZeroU16::new(10))) - .pre_effect(EffectIR::start_obj()) - .pre_effect(EffectIR::start_obj()) - .pre_effect(EffectIR::start_obj()) - .post_effect(EffectIR::node()) - .post_effect(EffectIR::end_obj()) - .post_effect(EffectIR::end_obj()) - .post_effect(EffectIR::end_obj()) - .next_many(vec![ - Label(100), - Label(101), - Label(102), - Label(103), - Label(104), - Label(105), - Label(106), - Label(107), - ]); - - // Verify it's large enough to trigger alignment - assert!(large_match.size() >= 48); +fn layout_match16_cache_alignment() { + // Match16 (16 bytes, 2 steps) at offset 56 would straddle (56+16=72 > 64) + // Place 7 Match8s (7 steps = 56 bytes) before Match16 + // Expected: Match16 gets padded to step 8 (offset 64) + let mut instructions = Vec::new(); + + // 7 Match8 instructions in a chain: Label(0) -> Label(1) -> ... -> Label(6) -> Label(7) + for i in 0..7 { + instructions.push( + MatchIR::at(Label(i)) + .nav(Nav::Down) + .next(Label(i + 1)) + .into(), + ); + } + + // Match16 at Label(7): needs 2+ successors to become Match16 + instructions.push( + MatchIR::at(Label(7)) + .nav(Nav::Down) + .next_many(vec![Label(100), Label(101)]) + .into(), + ); - let instructions = vec![ - // Small instruction first - MatchIR::epsilon(Label(0), Label(1)).into(), - large_match.into(), - ]; + let result = CacheAligned::layout(&instructions, &[Label(0)]); + + // Labels 0-6 should be at steps 0-6 (no padding needed) + for i in 0..7 { + assert_eq!( + result.label_to_step.get(&Label(i)), + Some(&(i as u16)), + "Label({i}) should be at step {i}" + ); + } + + // Label(7) would be at step 7 (offset 56) without padding + // But Match16 at offset 56 straddles (56+16=72 > 64), so it must be padded + // After padding: step 8 (offset 64) + let step7 = *result.label_to_step.get(&Label(7)).unwrap(); + assert_eq!(step7, 8, "Match16 should be padded to step 8 (offset 64)"); + + // Total steps: 8 (padding at step 7) + 2 (Match16) = 10 + assert_eq!(result.total_steps, 10); +} + +#[test] +fn layout_match8_no_padding_needed() { + // Match8 (8 bytes) never straddles: max offset 56, 56+8=64 <= 64 + // Place 7 Match8s, then another Match8 - should NOT need padding + let mut instructions = Vec::new(); + + for i in 0..8 { + if i < 7 { + instructions.push( + MatchIR::at(Label(i)) + .nav(Nav::Down) + .next(Label(i + 1)) + .into(), + ); + } else { + instructions.push(MatchIR::terminal(Label(i)).nav(Nav::Down).into()); + } + } let result = CacheAligned::layout(&instructions, &[Label(0)]); - // Label 0 at step 0 (offset 0) - assert_eq!(result.label_to_step.get(&Label(0)), Some(&0u16)); + // All 8 Match8s should be contiguous: steps 0-7 + for i in 0..8 { + assert_eq!( + result.label_to_step.get(&Label(i)), + Some(&(i as u16)), + "Label({i}) should be at step {i} (no padding)" + ); + } + + // Total steps: 8 (no padding) + assert_eq!(result.total_steps, 8); +} + +#[test] +fn layout_match32_cache_alignment() { + // Match32 (32 bytes, 4 steps) at offset 40 would straddle (40+32=72 > 64) + // Place 5 Match8s (5 steps = 40 bytes) before Match32 + // Expected: Match32 gets padded to step 8 (offset 64) + let mut instructions: Vec = Vec::new(); + + // 5 Match8 instructions: Label(0) -> ... -> Label(4) -> Label(5) + for i in 0..5 { + instructions.push( + MatchIR::at(Label(i)) + .nav(Nav::Down) + .next(Label(i + 1)) + .into(), + ); + } + + // Match32 at Label(5): needs enough payload to become Match32 (9-12 slots) + // 3 pre + 3 post + 4 successors = 10 slots -> Match32 + instructions.push( + MatchIR::at(Label(5)) + .nav(Nav::Down) + .pre_effect(EffectIR::start_obj()) + .pre_effect(EffectIR::start_obj()) + .pre_effect(EffectIR::start_obj()) + .post_effect(EffectIR::end_obj()) + .post_effect(EffectIR::end_obj()) + .post_effect(EffectIR::end_obj()) + .next_many(vec![Label(100), Label(101), Label(102), Label(103)]) + .into(), + ); + + // Verify it's Match32 (32 bytes) + assert_eq!(instructions.last().unwrap().size(), 32); + + let result = CacheAligned::layout(&instructions, &[Label(0)]); + + // Labels 0-4 at steps 0-4 + for i in 0..5 { + assert_eq!(result.label_to_step.get(&Label(i)), Some(&(i as u16))); + } + + // Label(5) would be at step 5 (offset 40) without padding + // Match32 at offset 40 straddles (40+32=72 > 64), so padded to step 8 + let step5 = *result.label_to_step.get(&Label(5)).unwrap(); + assert_eq!(step5, 8, "Match32 should be padded to step 8 (offset 64)"); - // Label 1 should be aligned - either at step 1 or padded to cache line - let step1 = *result.label_to_step.get(&Label(1)).unwrap(); - assert!(step1 >= 1); + // Total steps: 8 (3 padding steps at 5,6,7) + 4 (Match32) = 12 + assert_eq!(result.total_steps, 12); } diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_captured.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_captured.snap index 5f5bc17c..ea65a0c8 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_captured.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_captured.snap @@ -34,8 +34,9 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε 10, 12 - 09 ▶ - 10 ! (identifier) [Node Set(M0)] 09 - 12 ! (number) [Node Set(M0)] 09 + 06 ε 08 + 07 ... + 08 ε 11, 13 + 10 ▶ + 11 ! (identifier) [Node Set(M0)] 10 + 13 ! (number) [Node Set(M0)] 10 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_captured_tagged.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_captured_tagged.snap index bc6517fe..632a8b12 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_captured_tagged.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_captured_tagged.snap @@ -45,9 +45,10 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε 12, 15 - 09 ▶ - 10 ε [Set(M4)] 09 - 12 ! [Enum(M2)] (identifier) [Node Set(M0) EndEnum] 10 - 15 ! [Enum(M3)] (number) [Node Set(M1) EndEnum] 10 + 06 ε 08 + 07 ... + 08 ε 13, 16 + 10 ▶ + 11 ε [Set(M4)] 10 + 13 ! [Enum(M2)] (identifier) [Node Set(M0) EndEnum] 11 + 16 ! [Enum(M3)] (number) [Node Set(M1) EndEnum] 11 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_in_quantifier.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_in_quantifier.snap index 0388a543..ee2b9fa8 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_in_quantifier.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_in_quantifier.snap @@ -53,23 +53,26 @@ Test: 06 ε 07 07 ! (object) 08 08 ε [Arr] 10 - 10 ε 39, 20 + 10 ε 42, 21 12 ε [EndArr Set(M5)] 14 - 14 △ _ 19 - 15 ε [EndObj Push] 17 - 17 ε 45, 12 - 19 ▶ - 20 ε [EndArr Set(M5)] 19 - 22 ε [Set(M4)] 15 - 24 ! [Enum(M2)] (pair) [Node Set(M0) EndEnum] 22 - 27 ! [Enum(M3)] (shorthand_property_identifier) [Node Set(M1) EndEnum] 22 - 30 ε 24, 27 - 32 ε [Obj] 30 - 34 ▷ _ 37 - 35 ε 34, 12 - 37 ε 32, 35 - 39 ▽ _ 37 - 40 ▷ _ 43 - 41 ε 40, 12 - 43 ε 32, 41 - 45 ▷ _ 43 + 14 △ _ 20 + 15 ... + 16 ε [EndObj Push] 18 + 18 ε 48, 12 + 20 ▶ + 21 ε [EndArr Set(M5)] 20 + 23 ... + 24 ε [Set(M4)] 16 + 26 ! [Enum(M2)] (pair) [Node Set(M0) EndEnum] 24 + 29 ! [Enum(M3)] (shorthand_property_identifier) [Node Set(M1) EndEnum] 24 + 32 ε 26, 29 + 34 ε [Obj] 32 + 36 ▷ _ 40 + 37 ε 36, 12 + 39 ... + 40 ε 34, 37 + 42 ▽ _ 40 + 43 ▷ _ 46 + 44 ε 43, 12 + 46 ε 34, 44 + 48 ▷ _ 46 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_labeled.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_labeled.snap index f9833499..656a2351 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_labeled.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_labeled.snap @@ -45,8 +45,11 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε 10, 13 - 09 ▶ - 10 ! [Enum(M2)] (identifier) [Node Set(M0) EndEnum] 09 - 13 ! [Enum(M3)] (number) [Node Set(M1) EndEnum] 09 + 06 ε 08 + 07 ... + 08 ε 11, 16 + 10 ▶ + 11 ! [Enum(M2)] (identifier) [Node Set(M0) EndEnum] 10 + 14 ... + 15 ... + 16 ! [Enum(M3)] (number) [Node Set(M1) EndEnum] 10 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_null_injection.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_null_injection.snap index 9f3a1127..f9573612 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_null_injection.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_null_injection.snap @@ -41,8 +41,11 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε 10, 13 - 09 ▶ - 10 ! [Null Set(M1)] (identifier) [Node Set(M0)] 09 - 13 ! [Null Set(M0)] (number) [Node Set(M1)] 09 + 06 ε 08 + 07 ... + 08 ε 11, 16 + 10 ▶ + 11 ! [Null Set(M1)] (identifier) [Node Set(M0)] 10 + 14 ... + 15 ... + 16 ! [Null Set(M0)] (number) [Node Set(M1)] 10 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_tagged_in_field_constraint.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_tagged_in_field_constraint.snap index bc6ca767..4ba37aac 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_tagged_in_field_constraint.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_tagged_in_field_constraint.snap @@ -48,8 +48,9 @@ Test: 06 ε 07 07 ! (foo) 08 08 ▽ field: _ 09 - 09 ε 12, 15 + 09 ε 12, 16 11 ▶ - 12 ! [Enum(M1)] (x) [Node Set(M0) EndEnum Set(M3)] 17 - 15 ! [Enum(M2)] (y) [EndEnum Set(M3)] 17 - 17 △ _ 11 + 12 ! [Enum(M1)] (x) [Node Set(M0) EndEnum Set(M3)] 18 + 15 ... + 16 ! [Enum(M2)] (y) [EndEnum Set(M3)] 18 + 18 △ _ 11 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_tagged_with_definition_ref.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_tagged_with_definition_ref.snap index 67684563..d32afb65 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_tagged_with_definition_ref.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_tagged_with_definition_ref.snap @@ -39,7 +39,7 @@ N1: S7 → T4 ; Test [entrypoints] Inner = 06 :: T1 -Test = 10 :: T4 +Test = 11 :: T4 [transitions] _ObjWrap: @@ -49,18 +49,21 @@ _ObjWrap: 05 ▶ Inner: - 06 ε 07 - 07 ! (identifier) [Node Set(M0)] 09 - 09 ▶ + 06 ε 08 + 07 ... + 08 ! (identifier) [Node Set(M0)] 10 + 10 ▶ Test: - 10 ε 11 - 11 ε 23, 25 - 13 ▶ - 14 ε [Set(M4)] 13 - 16 ε [EndEnum] 14 - 18 ε [EndObj] 16 - 20 ! (Inner) 06 : 18 - 21 ε [Obj] 20 - 23 ε [Enum(M2)] 21 - 25 ! [Enum(M3)] (number) [Node Set(M1) EndEnum] 14 + 11 ε 12 + 12 ε 26, 28 + 14 ▶ + 15 ... + 16 ε [Set(M4)] 14 + 18 ε [EndEnum] 16 + 20 ε [EndObj] 18 + 22 ! (Inner) 06 : 20 + 23 ... + 24 ε [Obj] 22 + 26 ε [Enum(M2)] 24 + 28 ! [Enum(M3)] (number) [Node Set(M1) EndEnum] 16 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_unlabeled.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_unlabeled.snap index 06cf3926..434a0b5f 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_unlabeled.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__alternations_unlabeled.snap @@ -41,8 +41,11 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε 10, 13 - 09 ▶ - 10 ! [Null Set(M1)] (identifier) [Node Set(M0)] 09 - 13 ! [Null Set(M0)] (string) [Node Set(M1)] 09 + 06 ε 08 + 07 ... + 08 ε 11, 16 + 10 ▶ + 11 ! [Null Set(M1)] (identifier) [Node Set(M0)] 10 + 14 ... + 15 ... + 16 ! [Null Set(M0)] (string) [Node Set(M1)] 10 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_basic.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_basic.snap index c01fac16..34873c58 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_basic.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_basic.snap @@ -23,16 +23,17 @@ M0: S1 → T0 ; name: N0: S2 → T1 ; Test [entrypoints] -Test = 6 :: T1 +Test = 06 :: T1 [transitions] _ObjWrap: - 0 ε [Obj] 2 - 2 Trampoline 3 - 3 ε [EndObj] 5 - 5 ▶ + 00 ε [Obj] 02 + 02 Trampoline 03 + 03 ε [EndObj] 05 + 05 ▶ Test: - 6 ε 7 - 7 ! (identifier) [Node Set(M0)] 9 - 9 ▶ + 06 ε 08 + 07 ... + 08 ! (identifier) [Node Set(M0)] 10 + 10 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_deeply_nested.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_deeply_nested.snap index 956f2679..f2b47184 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_deeply_nested.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_deeply_nested.snap @@ -47,12 +47,13 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ! (a) [Node Set(M0)] 09 - 09 ▽ (b) [Node Set(M1)] 11 - 11 ▽ (c) [Node Set(M2)] 13 - 13 ▽ (d) [Node Set(M3)] 15 - 15 △ _ 16 + 06 ε 08 + 07 ... + 08 ! (a) [Node Set(M0)] 10 + 10 ▽ (b) [Node Set(M1)] 12 + 12 ▽ (c) [Node Set(M2)] 14 + 14 ▽ (d) [Node Set(M3)] 16 16 △ _ 17 17 △ _ 18 - 18 ▶ + 18 △ _ 19 + 19 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_enum_with_type_annotation.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_enum_with_type_annotation.snap index 6f1f4744..341bf07c 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_enum_with_type_annotation.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_enum_with_type_annotation.snap @@ -47,9 +47,10 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε 12, 15 - 09 ▶ - 10 ε [Set(M4)] 09 - 12 ! [Enum(M2)] (identifier) [Node Set(M0) EndEnum] 10 - 15 ! [Enum(M3)] (number) [Node Set(M1) EndEnum] 10 + 06 ε 08 + 07 ... + 08 ε 13, 16 + 10 ▶ + 11 ε [Set(M4)] 10 + 13 ! [Enum(M2)] (identifier) [Node Set(M0) EndEnum] 11 + 16 ! [Enum(M3)] (number) [Node Set(M1) EndEnum] 11 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_nested_flat.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_nested_flat.snap index 4915ad64..efdd49bb 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_nested_flat.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_nested_flat.snap @@ -41,10 +41,11 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ! (a) [Node Set(M0)] 09 - 09 ▽ (b) [Node Set(M1)] 11 - 11 ▽ (c) [Node Set(M2)] 13 - 13 △ _ 14 + 06 ε 08 + 07 ... + 08 ! (a) [Node Set(M0)] 10 + 10 ▽ (b) [Node Set(M1)] 12 + 12 ▽ (c) [Node Set(M2)] 14 14 △ _ 15 - 15 ▶ + 15 △ _ 16 + 16 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_optional_wrapper_struct.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_optional_wrapper_struct.snap index 2310be82..3e356726 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_optional_wrapper_struct.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_optional_wrapper_struct.snap @@ -43,16 +43,18 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε [Obj] 09 - 09 ε 27, 20 - 11 ▶ - 12 ε [EndObj Set(M2)] 11 - 14 ε [EndObj Set(M1)] 12 - 16 ! (identifier) [Node Set(M0)] 14 - 18 ε [Obj] 16 - 20 ε [Null Set(M1)] 12 - 22 ▷ _ 25 - 23 ε 22, 20 - 25 ε 18, 23 - 27 ! _ 25 + 06 ε 08 + 07 ... + 08 ε [Obj] 10 + 10 ε 29, 22 + 12 ▶ + 13 ε [EndObj Set(M2)] 12 + 15 ... + 16 ε [EndObj Set(M1)] 13 + 18 ! (identifier) [Node Set(M0)] 16 + 20 ε [Obj] 18 + 22 ε [Null Set(M1)] 13 + 24 ▷ _ 27 + 25 ε 24, 22 + 27 ε 20, 25 + 29 ! _ 27 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_struct_scope.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_struct_scope.snap index d5b104cd..bf09c080 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_struct_scope.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_struct_scope.snap @@ -41,9 +41,10 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε [Obj] 09 - 09 ! (a) [Node Set(M0)] 11 - 11 ▷ (b) [Node Set(M1)] 13 - 13 ε [EndObj Set(M2)] 15 - 15 ▶ + 06 ε 08 + 07 ... + 08 ε [Obj] 10 + 10 ! (a) [Node Set(M0)] 12 + 12 ▷ (b) [Node Set(M1)] 14 + 14 ε [EndObj Set(M2)] 16 + 16 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_struct_with_type_annotation.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_struct_with_type_annotation.snap index c741f454..5cf041da 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_struct_with_type_annotation.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_struct_with_type_annotation.snap @@ -38,8 +38,9 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε [Obj] 09 - 09 ! (identifier) [Node Set(M0)] 11 - 11 ε [EndObj Set(M1)] 13 - 13 ▶ + 06 ε 08 + 07 ... + 08 ε [Obj] 10 + 10 ! (identifier) [Node Set(M0)] 12 + 12 ε [EndObj Set(M1)] 14 + 14 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_with_type_custom.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_with_type_custom.snap index ed8b5855..20669db0 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_with_type_custom.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_with_type_custom.snap @@ -26,16 +26,17 @@ N0: S1 → T1 ; Identifier N1: S3 → T2 ; Test [entrypoints] -Test = 6 :: T2 +Test = 06 :: T2 [transitions] _ObjWrap: - 0 ε [Obj] 2 - 2 Trampoline 3 - 3 ε [EndObj] 5 - 5 ▶ + 00 ε [Obj] 02 + 02 Trampoline 03 + 03 ε [EndObj] 05 + 05 ▶ Test: - 6 ε 7 - 7 ! (identifier) [Node Set(M0)] 9 - 9 ▶ + 06 ε 08 + 07 ... + 08 ! (identifier) [Node Set(M0)] 10 + 10 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_with_type_string.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_with_type_string.snap index ca30e638..d8bb8686 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_with_type_string.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_with_type_string.snap @@ -23,16 +23,17 @@ M0: S1 → T0 ; name: N0: S2 → T1 ; Test [entrypoints] -Test = 6 :: T1 +Test = 06 :: T1 [transitions] _ObjWrap: - 0 ε [Obj] 2 - 2 Trampoline 3 - 3 ε [EndObj] 5 - 5 ▶ + 00 ε [Obj] 02 + 02 Trampoline 03 + 03 ε [EndObj] 05 + 05 ▶ Test: - 6 ε 7 - 7 ! (identifier) [Text Set(M0)] 9 - 9 ▶ + 06 ε 08 + 07 ... + 08 ! (identifier) [Text Set(M0)] 10 + 10 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_wrapper_struct.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_wrapper_struct.snap index 8dbd5f08..414b4430 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_wrapper_struct.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__captures_wrapper_struct.snap @@ -47,23 +47,26 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε [Arr] 09 - 09 ε 33, 16 - 11 ε [EndObj Push] 13 - 13 ε 39, 16 - 15 ▶ - 16 ε [EndArr Set(M3)] 15 - 18 ε [EndObj Set(M2)] 11 - 20 ▷ (number) [Node Set(M1)] 18 - 22 ! (identifier) [Node Set(M0)] 20 - 24 ε [Obj] 22 + 06 ε 08 + 07 ... + 08 ε [Arr] 10 + 10 ε 36, 17 + 12 ε [EndObj Push] 14 + 14 ε 42, 17 + 16 ▶ + 17 ε [EndArr Set(M3)] 16 + 19 ε [EndObj Set(M2)] 12 + 21 ▷ (number) [Node Set(M1)] 19 + 23 ... + 24 ! (identifier) [Node Set(M0)] 21 26 ε [Obj] 24 - 28 ▷ _ 31 - 29 ε 28, 16 - 31 ε 26, 29 - 33 ! _ 31 - 34 ▷ _ 37 - 35 ε 34, 16 - 37 ε 26, 35 - 39 ▷ _ 37 + 28 ε [Obj] 26 + 30 ▷ _ 34 + 31 ... + 32 ε 30, 17 + 34 ε 28, 32 + 36 ! _ 34 + 37 ▷ _ 40 + 38 ε 37, 17 + 40 ε 28, 38 + 42 ▷ _ 40 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__comprehensive_multi_definition.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__comprehensive_multi_definition.snap index a3b7c146..de43e9c5 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__comprehensive_multi_definition.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__comprehensive_multi_definition.snap @@ -57,8 +57,8 @@ N1: S07 → T05 ; Expression N2: S08 → T06 ; Assignment [entrypoints] -Assignment = 13 :: T06 -Expression = 10 :: T05 +Assignment = 14 :: T06 +Expression = 11 :: T05 Ident = 06 :: T02 [transitions] @@ -69,22 +69,23 @@ _ObjWrap: 05 ▶ Ident: - 06 ε 07 - 07 ! (identifier) [Text Set(M0)] 09 - 09 ▶ + 06 ε 08 + 07 ... + 08 ! (identifier) [Text Set(M0)] 10 + 10 ▶ Expression: - 10 ε 11 - 11 ε 23, 26 + 11 ε 12 + 12 ε 24, 27 Assignment: - 13 ε 14 - 14 ! (assignment_expression) 15 - 15 ▽ left: (identifier) [Node Set(M6)] 17 - 17 ▷ right: (Expression) 10 : 18 - 18 ε [Set(M5)] 20 - 20 △ _ 21 - 21 ▶ + 14 ε 15 + 15 ! (assignment_expression) 16 + 16 ▽ left: (identifier) [Node Set(M6)] 18 + 18 ▷ right: (Expression) 11 : 19 + 19 ε [Set(M5)] 21 + 21 △ _ 22 22 ▶ - 23 ! [Enum(M3)] (number) [Node Set(M1) EndEnum] 22 - 26 ! [Enum(M4)] (identifier) [Node Set(M2) EndEnum] 22 + 23 ▶ + 24 ! [Enum(M3)] (number) [Node Set(M1) EndEnum] 23 + 27 ! [Enum(M4)] (identifier) [Node Set(M2) EndEnum] 23 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_multiple.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_multiple.snap index 8403b2b8..39cdded8 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_multiple.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_multiple.snap @@ -30,7 +30,7 @@ N0: S3 → T1 ; Foo N1: S4 → T2 ; Bar [entrypoints] -Bar = 10 :: T2 +Bar = 11 :: T2 Foo = 06 :: T1 [transitions] @@ -41,11 +41,12 @@ _ObjWrap: 05 ▶ Foo: - 06 ε 07 - 07 ! (identifier) [Node Set(M0)] 09 - 09 ▶ + 06 ε 08 + 07 ... + 08 ! (identifier) [Node Set(M0)] 10 + 10 ▶ Bar: - 10 ε 11 - 11 ! (string) [Node Set(M1)] 13 - 13 ▶ + 11 ε 12 + 12 ! (string) [Node Set(M1)] 14 + 14 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_nested_capture.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_nested_capture.snap index fe8c55c0..51562520 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_nested_capture.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_nested_capture.snap @@ -56,23 +56,25 @@ Outer: 12 ε 13 13 ! (parent) 14 14 ε [Arr] 16 - 16 ε 42, 26 + 16 ε 44, 27 18 ε [EndArr Set(M2)] 20 - 20 △ _ 25 - 21 ε [EndObj Push] 23 - 23 ε 48, 18 - 25 ▶ - 26 ε [EndArr Set(M2)] 25 - 28 ε [Set(M1)] 21 - 30 ε [EndObj] 28 - 32 ! (Inner) 06 : 30 - 33 ε [Obj] 32 - 35 ε [Obj] 33 - 37 ▷ _ 40 - 38 ε 37, 18 - 40 ε 35, 38 - 42 ▽ _ 40 - 43 ▷ _ 46 - 44 ε 43, 18 - 46 ε 35, 44 - 48 ▷ _ 46 + 20 △ _ 26 + 21 ε [EndObj Push] 24 + 23 ... + 24 ε 50, 18 + 26 ▶ + 27 ε [EndArr Set(M2)] 26 + 29 ε [Set(M1)] 21 + 31 ... + 32 ε [EndObj] 29 + 34 ! (Inner) 06 : 32 + 35 ε [Obj] 34 + 37 ε [Obj] 35 + 39 ▷ _ 42 + 40 ε 39, 18 + 42 ε 37, 40 + 44 ▽ _ 42 + 45 ▷ _ 48 + 46 ε 45, 18 + 48 ε 37, 46 + 50 ▷ _ 48 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_reference.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_reference.snap index 145eb38d..29175d44 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_reference.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_reference.snap @@ -36,7 +36,7 @@ N1: S4 → T2 ; Root [entrypoints] Expression = 06 :: T1 -Root = 09 :: T2 +Root = 10 :: T2 [transitions] _ObjWrap: @@ -46,15 +46,16 @@ _ObjWrap: 05 ▶ Expression: - 06 ε 07 - 07 ε 16, 19 + 06 ε 08 + 07 ... + 08 ε 17, 20 Root: - 09 ε 10 - 10 ! (function_declaration) 11 - 11 ▽ name: (identifier) [Node Set(M2)] 13 - 13 △ _ 14 - 14 ▶ + 10 ε 11 + 11 ! (function_declaration) 12 + 12 ▽ name: (identifier) [Node Set(M2)] 14 + 14 △ _ 15 15 ▶ - 16 ! [Null Set(M1)] (identifier) [Node Set(M0)] 15 - 19 ! [Null Set(M0)] (number) [Node Set(M1)] 15 + 16 ▶ + 17 ! [Null Set(M1)] (identifier) [Node Set(M0)] 16 + 20 ! [Null Set(M0)] (number) [Node Set(M1)] 16 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_single.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_single.snap index 97bb257d..190d54d9 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_single.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__definitions_single.snap @@ -23,16 +23,17 @@ M0: S1 → T0 ; id: N0: S2 → T1 ; Foo [entrypoints] -Foo = 6 :: T1 +Foo = 06 :: T1 [transitions] _ObjWrap: - 0 ε [Obj] 2 - 2 Trampoline 3 - 3 ε [EndObj] 5 - 5 ▶ + 00 ε [Obj] 02 + 02 Trampoline 03 + 03 ε [EndObj] 05 + 05 ▶ Foo: - 6 ε 7 - 7 ! (identifier) [Node Set(M0)] 9 - 9 ▶ + 06 ε 08 + 07 ... + 08 ! (identifier) [Node Set(M0)] 10 + 10 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__fields_alternation.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__fields_alternation.snap index 9fc7657a..bfaa39e3 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__fields_alternation.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__fields_alternation.snap @@ -46,8 +46,9 @@ Test: 06 ε 07 07 ! (call_expression) 08 08 ▽ function: _ 09 - 09 ε 12, 15 + 09 ε 12, 16 11 ▶ - 12 ! [Null Set(M1)] (identifier) [Node Set(M0)] 18 - 15 ! [Null Set(M0)] (number) [Node Set(M1)] 18 - 18 △ _ 11 + 12 ! [Null Set(M1)] (identifier) [Node Set(M0)] 19 + 15 ... + 16 ! [Null Set(M0)] (number) [Node Set(M1)] 19 + 19 △ _ 11 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__fields_negated.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__fields_negated.snap index 09677307..f5ef3adc 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__fields_negated.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__fields_negated.snap @@ -35,8 +35,9 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ! -type_parameters (function_declaration) 09 - 09 ▽ name: (identifier) [Node Set(M0)] 11 - 11 △ _ 12 - 12 ▶ + 06 ε 08 + 07 ... + 08 ! -type_parameters (function_declaration) 10 + 10 ▽ name: (identifier) [Node Set(M0)] 12 + 12 △ _ 13 + 13 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__nodes_error.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__nodes_error.snap index f7f007bb..56252bc9 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__nodes_error.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__nodes_error.snap @@ -23,16 +23,17 @@ M0: S1 → T0 ; err: N0: S2 → T1 ; Test [entrypoints] -Test = 6 :: T1 +Test = 06 :: T1 [transitions] _ObjWrap: - 0 ε [Obj] 2 - 2 Trampoline 3 - 3 ε [EndObj] 5 - 5 ▶ + 00 ε [Obj] 02 + 02 Trampoline 03 + 03 ε [EndObj] 05 + 05 ▶ Test: - 6 ε 7 - 7 ! (ERROR) [Node Set(M0)] 9 - 9 ▶ + 06 ε 08 + 07 ... + 08 ! (ERROR) [Node Set(M0)] 10 + 10 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__nodes_missing.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__nodes_missing.snap index bfed4138..cbade5f7 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__nodes_missing.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__nodes_missing.snap @@ -23,16 +23,17 @@ M0: S1 → T0 ; m: N0: S2 → T1 ; Test [entrypoints] -Test = 6 :: T1 +Test = 06 :: T1 [transitions] _ObjWrap: - 0 ε [Obj] 2 - 2 Trampoline 3 - 3 ε [EndObj] 5 - 5 ▶ + 00 ε [Obj] 02 + 02 Trampoline 03 + 03 ε [EndObj] 05 + 05 ▶ Test: - 6 ε 7 - 7 ! (MISSING) [Node Set(M0)] 9 - 9 ▶ + 06 ε 08 + 07 ... + 08 ! (MISSING) [Node Set(M0)] 10 + 10 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__nodes_named.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__nodes_named.snap index 47291bd4..5e44bf6f 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__nodes_named.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__nodes_named.snap @@ -23,16 +23,17 @@ M0: S1 → T0 ; id: N0: S2 → T1 ; Test [entrypoints] -Test = 6 :: T1 +Test = 06 :: T1 [transitions] _ObjWrap: - 0 ε [Obj] 2 - 2 Trampoline 3 - 3 ε [EndObj] 5 - 5 ▶ + 00 ε [Obj] 02 + 02 Trampoline 03 + 03 ε [EndObj] 05 + 05 ▶ Test: - 6 ε 7 - 7 ! (identifier) [Node Set(M0)] 9 - 9 ▶ + 06 ε 08 + 07 ... + 08 ! (identifier) [Node Set(M0)] 10 + 10 ▶ diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__optional_first_child.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__optional_first_child.snap index 21090129..6cd9b8fd 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__optional_first_child.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__optional_first_child.snap @@ -44,15 +44,17 @@ _ObjWrap: Test: 06 ε 07 07 ! (program) 08 - 08 ε 26, 15 + 08 ε 28, 16 10 ▶ - 11 ▽ (number) [Node Set(M1)] 27 - 13 ▷ (number) [Node Set(M1)] 27 - 15 ε [Null Set(M0)] 11 - 17 ! (identifier) [Node Set(M0)] 13 - 19 ε [Null Set(M0)] 13 - 21 ▷ _ 24 - 22 ε 21, 19 - 24 ε 17, 22 - 26 ▽ _ 24 - 27 △ _ 10 + 11 ▽ (number) [Node Set(M1)] 29 + 13 ▷ (number) [Node Set(M1)] 29 + 15 ... + 16 ε [Null Set(M0)] 11 + 18 ! (identifier) [Node Set(M0)] 13 + 20 ε [Null Set(M0)] 13 + 22 ▷ _ 26 + 23 ... + 24 ε 22, 20 + 26 ε 18, 24 + 28 ▽ _ 26 + 29 △ _ 10 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__optional_null_injection.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__optional_null_injection.snap index f58677df..2095a473 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__optional_null_injection.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__optional_null_injection.snap @@ -37,13 +37,14 @@ _ObjWrap: Test: 06 ε 07 07 ! (function_declaration) 08 - 08 ε 22, 11 + 08 ε 23, 11 10 ▶ 11 ε [Null Set(M0)] 10 - 13 ! (decorator) [Node Set(M0)] 23 - 15 ε [Null Set(M0)] 23 - 17 ▷ _ 20 - 18 ε 17, 15 - 20 ε 13, 18 - 22 ▽ _ 20 - 23 △ _ 10 + 13 ! (decorator) [Node Set(M0)] 24 + 15 ... + 16 ε [Null Set(M0)] 24 + 18 ▷ _ 21 + 19 ε 18, 16 + 21 ε 13, 19 + 23 ▽ _ 21 + 24 △ _ 10 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_first_child_array.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_first_child_array.snap index 2cb21746..721908e0 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_first_child_array.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_first_child_array.snap @@ -45,20 +45,21 @@ Test: 06 ε 07 07 ! (array) 08 08 ε [Arr] 10 - 10 ε 30, 23 + 10 ε 31, 24 12 ! (identifier) [Node Push] 14 - 14 ε 36, 21 + 14 ε 37, 21 16 ▶ - 17 ▽ (number) [Node Set(M1)] 37 - 19 ▷ (number) [Node Set(M1)] 37 + 17 ▽ (number) [Node Set(M1)] 38 + 19 ▷ (number) [Node Set(M1)] 38 21 ε [EndArr Set(M0)] 19 - 23 ε [EndArr Set(M0)] 17 - 25 ▷ _ 28 - 26 ε 25, 21 - 28 ε 12, 26 - 30 ▽ _ 28 - 31 ▷ _ 34 - 32 ε 31, 21 - 34 ε 12, 32 - 36 ▷ _ 34 - 37 △ _ 16 + 23 ... + 24 ε [EndArr Set(M0)] 17 + 26 ▷ _ 29 + 27 ε 26, 21 + 29 ε 12, 27 + 31 ▽ _ 29 + 32 ▷ _ 35 + 33 ε 32, 21 + 35 ε 12, 33 + 37 ▷ _ 35 + 38 △ _ 16 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_optional.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_optional.snap index f58677df..2095a473 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_optional.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_optional.snap @@ -37,13 +37,14 @@ _ObjWrap: Test: 06 ε 07 07 ! (function_declaration) 08 - 08 ε 22, 11 + 08 ε 23, 11 10 ▶ 11 ε [Null Set(M0)] 10 - 13 ! (decorator) [Node Set(M0)] 23 - 15 ε [Null Set(M0)] 23 - 17 ▷ _ 20 - 18 ε 17, 15 - 20 ε 13, 18 - 22 ▽ _ 20 - 23 △ _ 10 + 13 ! (decorator) [Node Set(M0)] 24 + 15 ... + 16 ε [Null Set(M0)] 24 + 18 ▷ _ 21 + 19 ε 18, 16 + 21 ε 13, 19 + 23 ▽ _ 21 + 24 △ _ 10 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_optional_nongreedy.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_optional_nongreedy.snap index b6f7a949..83f34577 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_optional_nongreedy.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_optional_nongreedy.snap @@ -37,13 +37,14 @@ _ObjWrap: Test: 06 ε 07 07 ! (function_declaration) 08 - 08 ε 11, 22 + 08 ε 11, 23 10 ▶ 11 ε [Null Set(M0)] 10 - 13 ! (decorator) [Node Set(M0)] 23 - 15 ε [Null Set(M0)] 23 - 17 ▷ _ 20 - 18 ε 15, 17 - 20 ε 18, 13 - 22 ▽ _ 20 - 23 △ _ 10 + 13 ! (decorator) [Node Set(M0)] 24 + 15 ... + 16 ε [Null Set(M0)] 24 + 18 ▷ _ 21 + 19 ε 16, 18 + 21 ε 19, 13 + 23 ▽ _ 21 + 24 △ _ 10 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_plus.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_plus.snap index aeeb8005..09eb7df4 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_plus.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_plus.snap @@ -34,16 +34,17 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε [Arr] 09 - 09 ! _ 18 - 10 ! (identifier) [Node Push] 12 - 12 ε 25, 15 - 14 ▶ - 15 ε [EndArr Set(M0)] 14 - 17 ▷ _ 18 - 18 ε 10, 17 - 20 ▷ _ 23 - 21 ε 20, 15 - 23 ε 10, 21 - 25 ▷ _ 23 + 06 ε 08 + 07 ... + 08 ε [Arr] 10 + 10 ! _ 19 + 11 ! (identifier) [Node Push] 13 + 13 ε 26, 16 + 15 ▶ + 16 ε [EndArr Set(M0)] 15 + 18 ▷ _ 19 + 19 ε 11, 18 + 21 ▷ _ 24 + 22 ε 21, 16 + 24 ε 11, 22 + 26 ▷ _ 24 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_plus_nongreedy.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_plus_nongreedy.snap index f3d7d448..53e9f67e 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_plus_nongreedy.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_plus_nongreedy.snap @@ -34,16 +34,17 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε [Arr] 09 - 09 ! _ 18 - 10 ! (identifier) [Node Push] 12 - 12 ε 15, 25 - 14 ▶ - 15 ε [EndArr Set(M0)] 14 - 17 ▷ _ 18 - 18 ε 17, 10 - 20 ▷ _ 23 - 21 ε 15, 20 - 23 ε 21, 10 - 25 ▷ _ 23 + 06 ε 08 + 07 ... + 08 ε [Arr] 10 + 10 ! _ 19 + 11 ! (identifier) [Node Push] 13 + 13 ε 16, 26 + 15 ▶ + 16 ε [EndArr Set(M0)] 15 + 18 ▷ _ 19 + 19 ε 18, 11 + 21 ▷ _ 24 + 22 ε 16, 21 + 24 ε 22, 11 + 26 ▷ _ 24 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_repeat_navigation.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_repeat_navigation.snap index 9b524cbe..360fdfae 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_repeat_navigation.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_repeat_navigation.snap @@ -38,18 +38,19 @@ Test: 06 ε 07 07 ! (function_declaration) 08 08 ε [Arr] 10 - 10 ε 27, 20 + 10 ε 28, 21 12 ε [EndArr Set(M0)] 14 - 14 △ _ 19 - 15 ! (decorator) [Node Push] 17 - 17 ε 33, 12 - 19 ▶ - 20 ε [EndArr Set(M0)] 19 - 22 ▷ _ 25 - 23 ε 22, 12 - 25 ε 15, 23 - 27 ▽ _ 25 - 28 ▷ _ 31 - 29 ε 28, 12 - 31 ε 15, 29 - 33 ▷ _ 31 + 14 △ _ 20 + 15 ... + 16 ! (decorator) [Node Push] 18 + 18 ε 34, 12 + 20 ▶ + 21 ε [EndArr Set(M0)] 20 + 23 ▷ _ 26 + 24 ε 23, 12 + 26 ε 16, 24 + 28 ▽ _ 26 + 29 ▷ _ 32 + 30 ε 29, 12 + 32 ε 16, 30 + 34 ▷ _ 32 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_sequence_in_called_def.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_sequence_in_called_def.snap index e845018e..2f2f1012 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_sequence_in_called_def.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_sequence_in_called_def.snap @@ -37,9 +37,9 @@ N1: S5 → T4 ; Collect N2: S6 → T4 ; Test [entrypoints] -Collect = 10 :: T4 +Collect = 11 :: T4 Item = 06 :: T1 -Test = 15 :: T4 +Test = 16 :: T4 [transitions] _ObjWrap: @@ -49,35 +49,38 @@ _ObjWrap: 05 ▶ Item: - 06 ε 07 - 07 ! (identifier) [Node Set(M0)] 09 - 09 ▶ + 06 ε 08 + 07 ... + 08 ! (identifier) [Node Set(M0)] 10 + 10 ▶ Collect: - 10 ε 11 - 11 ε [Arr] 13 - 13 ε 41, 25 + 11 ε 12 + 12 ε [Arr] 14 + 14 ε 44, 27 Test: - 15 ε 16 - 16 ! (parent) 17 - 17 ▽ (Collect) 10 : 18 - 18 △ _ 19 - 19 ▶ - 20 ε [EndObj Push] 22 - 22 ε 47, 25 - 24 ▶ - 25 ε [EndArr Set(M2)] 24 - 27 ε [Set(M1)] 20 - 29 ε [EndObj] 27 - 31 ! (Item) 06 : 29 - 32 ε [Obj] 31 - 34 ε [Obj] 32 - 36 ▷ _ 39 - 37 ε 36, 25 - 39 ε 34, 37 - 41 ! _ 39 - 42 ▷ _ 45 - 43 ε 42, 25 - 45 ε 34, 43 - 47 ▷ _ 45 + 16 ε 17 + 17 ! (parent) 18 + 18 ▽ (Collect) 11 : 19 + 19 △ _ 20 + 20 ▶ + 21 ε [EndObj Push] 24 + 23 ... + 24 ε 50, 27 + 26 ▶ + 27 ε [EndArr Set(M2)] 26 + 29 ε [Set(M1)] 21 + 31 ... + 32 ε [EndObj] 29 + 34 ! (Item) 06 : 32 + 35 ε [Obj] 34 + 37 ε [Obj] 35 + 39 ▷ _ 42 + 40 ε 39, 27 + 42 ε 37, 40 + 44 ! _ 42 + 45 ▷ _ 48 + 46 ε 45, 27 + 48 ε 37, 46 + 50 ▷ _ 48 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_star.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_star.snap index 165bba28..c7b61711 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_star.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_star.snap @@ -34,18 +34,19 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε [Arr] 09 - 09 ε 23, 16 - 11 ! (identifier) [Node Push] 13 - 13 ε 29, 16 - 15 ▶ - 16 ε [EndArr Set(M0)] 15 - 18 ▷ _ 21 - 19 ε 18, 16 - 21 ε 11, 19 - 23 ! _ 21 - 24 ▷ _ 27 - 25 ε 24, 16 - 27 ε 11, 25 - 29 ▷ _ 27 + 06 ε 08 + 07 ... + 08 ε [Arr] 10 + 10 ε 24, 17 + 12 ! (identifier) [Node Push] 14 + 14 ε 30, 17 + 16 ▶ + 17 ε [EndArr Set(M0)] 16 + 19 ▷ _ 22 + 20 ε 19, 17 + 22 ε 12, 20 + 24 ! _ 22 + 25 ▷ _ 28 + 26 ε 25, 17 + 28 ε 12, 26 + 30 ▷ _ 28 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_star_nongreedy.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_star_nongreedy.snap index de9c056a..f807d3f1 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_star_nongreedy.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_star_nongreedy.snap @@ -34,18 +34,19 @@ _ObjWrap: 05 ▶ Test: - 06 ε 07 - 07 ε [Arr] 09 - 09 ε 16, 23 - 11 ! (identifier) [Node Push] 13 - 13 ε 16, 29 - 15 ▶ - 16 ε [EndArr Set(M0)] 15 - 18 ▷ _ 21 - 19 ε 16, 18 - 21 ε 19, 11 - 23 ! _ 21 - 24 ▷ _ 27 - 25 ε 16, 24 - 27 ε 25, 11 - 29 ▷ _ 27 + 06 ε 08 + 07 ... + 08 ε [Arr] 10 + 10 ε 17, 24 + 12 ! (identifier) [Node Push] 14 + 14 ε 17, 30 + 16 ▶ + 17 ε [EndArr Set(M0)] 16 + 19 ▷ _ 22 + 20 ε 17, 19 + 22 ε 20, 12 + 24 ! _ 22 + 25 ▷ _ 28 + 26 ε 17, 25 + 28 ε 26, 12 + 30 ▷ _ 28 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_struct_array.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_struct_array.snap index 6d3c4a2e..ae750b6c 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_struct_array.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__quantifiers_struct_array.snap @@ -48,21 +48,24 @@ Test: 06 ε 07 07 ! (array) 08 08 ε [Arr] 10 - 10 ε 33, 20 + 10 ε 36, 21 12 ε [EndArr Set(M2)] 14 - 14 △ _ 19 - 15 ε [EndObj Push] 17 - 17 ε 39, 12 - 19 ▶ - 20 ε [EndArr Set(M2)] 19 - 22 ▷ (number) [Node Set(M1)] 15 - 24 ! (identifier) [Node Set(M0)] 22 - 26 ε [Obj] 24 - 28 ▷ _ 31 - 29 ε 28, 12 - 31 ε 26, 29 - 33 ▽ _ 31 - 34 ▷ _ 37 - 35 ε 34, 12 - 37 ε 26, 35 - 39 ▷ _ 37 + 14 △ _ 20 + 15 ... + 16 ε [EndObj Push] 18 + 18 ε 42, 12 + 20 ▶ + 21 ε [EndArr Set(M2)] 20 + 23 ... + 24 ▷ (number) [Node Set(M1)] 16 + 26 ! (identifier) [Node Set(M0)] 24 + 28 ε [Obj] 26 + 30 ▷ _ 34 + 31 ... + 32 ε 30, 12 + 34 ε 28, 32 + 36 ▽ _ 34 + 37 ▷ _ 40 + 38 ε 37, 12 + 40 ε 28, 38 + 42 ▷ _ 40 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__recursion_simple.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__recursion_simple.snap index 9787f8ff..4c3c6a66 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__recursion_simple.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__recursion_simple.snap @@ -55,13 +55,16 @@ _ObjWrap: 05 ▶ Expr: - 06 ε 07 - 07 ε 13, 21 - 09 ε [Set(M2)] 11 - 11 △ _ 16 - 12 ▶ - 13 ! [Enum(M3)] (number) [Text Set(M0) EndEnum] 12 - 16 ε [EndEnum] 12 - 18 ▷ arguments: (Expr) 06 : 09 - 19 ▽ function: (identifier) [Node Set(M1)] 18 - 21 ! [Enum(M4)] (call_expression) 19 + 06 ε 08 + 07 ... + 08 ε 16, 24 + 10 ε [Set(M2)] 12 + 12 △ _ 19 + 13 ▶ + 14 ... + 15 ... + 16 ! [Enum(M3)] (number) [Text Set(M0) EndEnum] 13 + 19 ε [EndEnum] 13 + 21 ▷ arguments: (Expr) 06 : 10 + 22 ▽ function: (identifier) [Node Set(M1)] 21 + 24 ! [Enum(M4)] (call_expression) 22 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__recursion_with_structured_result.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__recursion_with_structured_result.snap index cc310e38..d1ae05fe 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__recursion_with_structured_result.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__recursion_with_structured_result.snap @@ -54,7 +54,7 @@ N1: S08 → T05 ; Test [entrypoints] Expr = 06 :: T04 -Test = 09 :: T05 +Test = 10 :: T05 [transitions] _ObjWrap: @@ -64,21 +64,22 @@ _ObjWrap: 05 ▶ Expr: - 06 ε 07 - 07 ε 20, 28 + 06 ε 08 + 07 ... + 08 ε 21, 29 Test: - 09 ε 10 - 10 ! (program) 11 - 11 ▽ (Expr) 06 : 12 - 12 ε [Set(M5)] 14 - 14 △ _ 15 - 15 ▶ - 16 ε [Set(M2)] 18 - 18 △ _ 23 - 19 ▶ - 20 ! [Enum(M3)] (number) [Text Set(M0) EndEnum] 19 - 23 ε [EndEnum] 19 - 25 ▷ arguments: (Expr) 06 : 16 - 26 ▽ function: (identifier) [Node Set(M1)] 25 - 28 ! [Enum(M4)] (call_expression) 26 + 10 ε 11 + 11 ! (program) 12 + 12 ▽ (Expr) 06 : 13 + 13 ε [Set(M5)] 15 + 15 △ _ 16 + 16 ▶ + 17 ε [Set(M2)] 19 + 19 △ _ 24 + 20 ▶ + 21 ! [Enum(M3)] (number) [Text Set(M0) EndEnum] 20 + 24 ε [EndEnum] 20 + 26 ▷ arguments: (Expr) 06 : 17 + 27 ▽ function: (identifier) [Node Set(M1)] 26 + 29 ! [Enum(M4)] (call_expression) 27 diff --git a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__sequences_in_quantifier.snap b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__sequences_in_quantifier.snap index 1a0d770b..8789d938 100644 --- a/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__sequences_in_quantifier.snap +++ b/crates/plotnik-lib/src/emit/snapshots/plotnik_lib__emit__emit_tests__sequences_in_quantifier.snap @@ -39,19 +39,21 @@ Test: 06 ε 07 07 ! (parent) 08 08 ε [Arr] 10 - 10 ε 28, 20 + 10 ε 29, 21 12 ε [EndArr Set(M0)] 14 - 14 △ _ 19 - 15 ▷ (b) [Node Push] 17 - 17 ε 34, 12 - 19 ▶ - 20 ε [EndArr Set(M0)] 19 - 22 ! (a) 15 - 23 ▷ _ 26 - 24 ε 23, 12 - 26 ε 22, 24 - 28 ▽ _ 26 - 29 ▷ _ 32 - 30 ε 29, 12 - 32 ε 22, 30 - 34 ▷ _ 32 + 14 △ _ 20 + 15 ... + 16 ▷ (b) [Node Push] 18 + 18 ε 36, 12 + 20 ▶ + 21 ε [EndArr Set(M0)] 20 + 23 ! (a) 16 + 24 ▷ _ 27 + 25 ε 24, 12 + 27 ε 23, 25 + 29 ▽ _ 27 + 30 ▷ _ 34 + 31 ... + 32 ε 30, 12 + 34 ε 23, 32 + 36 ▷ _ 34 diff --git a/crates/plotnik-lib/src/engine/trace.rs b/crates/plotnik-lib/src/engine/trace.rs index 2ec6f145..2b092d38 100644 --- a/crates/plotnik-lib/src/engine/trace.rs +++ b/crates/plotnik-lib/src/engine/trace.rs @@ -195,6 +195,8 @@ pub struct PrintTracer<'s> { pub(crate) step_width: usize, /// Color palette. pub(crate) colors: Colors, + /// Previous instruction IP (for cache line boundary detection). + pub(crate) prev_ip: Option, } /// Builder for `PrintTracer`. @@ -277,6 +279,7 @@ impl<'s, 'm> PrintTracerBuilder<'s, 'm> { pending_return_ip: None, step_width, colors: self.colors, + prev_ip: None, } } } @@ -506,10 +509,47 @@ impl<'s> PrintTracer<'s> { } self.lines.push(self.format_def_label(name)); } + + /// Format cache line boundary separator (full-width dashes, dimmed). + fn format_cache_line_separator(&self) -> String { + // Content spans TOTAL_WIDTH (same as instruction lines before successors) + let c = self.colors; + format!( + "{:indent$}{}{}{}", + "", + c.dim, + "-".repeat(cols::TOTAL_WIDTH), + c.reset, + indent = cols::INDENT, + ) + } + + /// Check if IPs cross a cache line boundary and insert separator if so. + /// + /// Cache line = 64 bytes = 8 steps (each step is 8 bytes). + /// Only shows separator in verbose modes (-v, -vv). + fn check_cache_line_boundary(&mut self, ip: u16) { + // Only show cache line separators in verbose modes + if self.verbosity == Verbosity::Default { + self.prev_ip = Some(ip); + return; + } + + const STEPS_PER_CACHE_LINE: u16 = 8; + if let Some(prev) = self.prev_ip + && prev / STEPS_PER_CACHE_LINE != ip / STEPS_PER_CACHE_LINE + { + self.lines.push(self.format_cache_line_separator()); + } + self.prev_ip = Some(ip); + } } impl Tracer for PrintTracer<'_> { fn trace_instruction(&mut self, ip: u16, instr: &Instruction<'_>) { + // Check for cache line boundary crossing + self.check_cache_line_boundary(ip); + match instr { Instruction::Match(m) => { // Show ε for epsilon transitions, empty otherwise (nav shown in sublines)