Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions src/v1/05_emit_rust.dag
Original file line number Diff line number Diff line change
Expand Up @@ -17427,46 +17427,48 @@ fn emit_source_root_eval_driver_main_rs(crate_name: String, pipeline_module: Str
" // THE PREPARATION SPAN CLOSES WHEN THE PREPARATION OUTCOME IS ESTABLISHED, BEFORE ANY", "\n",
" // DECLARATION IS EVALUATED. prepare and eval are exclusive rows of one partition, so a", "\n",
" // prepare interval that contained its module's eval intervals would count that work", "\n",
" // twice and inflate the sum against the parent. Each arm therefore records the close at", "\n",
" // the point its outcome is known -- the two refusal arms as soon as the rows are", "\n",
" // decided, the accepted arm as soon as inference returns -- and the evaluation loop runs", "\n",
" // strictly after that close.", "\n",
" let mut module_prepare_nanos: u128 = 0;", "\n",
" // twice and inflate the sum against the parent.", "\n",
" //", "\n",
" // THE CLOSE IS THE ARM'S VALUE, NOT AN ASSIGNMENT INSIDE IT. Assigning an outer binding", "\n",
" // from each arm left its initialiser dead, and a dead store is an ERROR in the emitted", "\n",
" // crate (RUSTFLAGS=\"-D warnings\"); silencing it with an allow would be the escape hatch", "\n",
" // DESIGN section 5 forbids. Each arm yields its own span instead, so there is one binding", "\n",
" // site, nothing to overwrite, and the order control has a single spelling to assert on.", "\n",
" let resolve_started = Instant::now();", "\n",
" let resolution = native_lane_module_resolution(context.clone(), refusal_index.clone(), entry.clone());", "\n",
" let module_resolve_nanos = span_nanos(resolve_started);", "\n",
" let outcome_label = match &*resolution \{", "\n",
" let (outcome_label, module_prepare_nanos) = match &*resolution \{", "\n",
" NativeLaneModuleResolution::NativeLaneModuleContextRowsDecided \{ rows \} => \{", "\n",
" module_prepare_nanos = span_nanos(prepare_started);", "\n",
" let this_prepare = span_nanos(prepare_started);", "\n",
" prepare_refused += 1;", "\n",
" for row in rows.iter() \{", "\n",
" population.push(row.clone());", "\n",
" identities += 1;", "\n",
" \}", "\n",
" \"context_refused\"", "\n",
" (\"context_refused\", this_prepare)", "\n",
" \}", "\n",
" NativeLaneModuleResolution::NativeLaneModuleResolveRowsDecided \{ rows \} => \{", "\n",
" module_prepare_nanos = span_nanos(prepare_started);", "\n",
" let this_prepare = span_nanos(prepare_started);", "\n",
" prepare_refused += 1;", "\n",
" for row in rows.iter() \{", "\n",
" population.push(row.clone());", "\n",
" identities += 1;", "\n",
" \}", "\n",
" \"resolve_refused\"", "\n",
" (\"resolve_refused\", this_prepare)", "\n",
" \}", "\n",
" NativeLaneModuleResolution::NativeLaneModuleResolved \{ resolved \} => \{", "\n",
" let infer_started = Instant::now();", "\n",
" let preparation = native_lane_module_inference(entry.clone(), resolved.clone());", "\n",
" module_infer_nanos = span_nanos(infer_started);", "\n",
" module_prepare_nanos = span_nanos(prepare_started);", "\n",
" let this_prepare = span_nanos(prepare_started);", "\n",
" match &*preparation \{", "\n",
" NativeLaneModulePreparation::NativeLaneModuleRowsDecided \{ rows \} => \{", "\n",
" prepare_refused += 1;", "\n",
" for row in rows.iter() \{", "\n",
" population.push(row.clone());", "\n",
" identities += 1;", "\n",
" \}", "\n",
" \"infer_refused\"", "\n",
" (\"infer_refused\", this_prepare)", "\n",
" \}", "\n",
" NativeLaneModulePreparation::NativeLaneModulePrepared \{ prepared \} => \{", "\n",
" prepare_ok += 1;", "\n",
Expand All @@ -17483,7 +17485,7 @@ fn emit_source_root_eval_driver_main_rs(crate_name: String, pipeline_module: Str
" population.push(row);", "\n",
" identities += 1;", "\n",
" \}", "\n",
" \"accepted\"", "\n",
" (\"accepted\", this_prepare)", "\n",
" \}", "\n",
" \}", "\n",
" \}", "\n",
Expand Down
2 changes: 1 addition & 1 deletion src/v1/stage0/src/v1_compiler_emit_rust.rs

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions src/v1/tests/src/native_driver_cost_refusal_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,16 @@ fn the_preparation_span_closes_before_any_declaration_is_evaluated() {
// loop -- the regression this file is being extended for -- reds here and nowhere else.
let main_rs = driver_main();
let close = main_rs
.match_indices("module_prepare_nanos = span_nanos(prepare_started);")
.match_indices("let this_prepare = span_nanos(prepare_started);")
.map(|(i, _)| i)
.collect::<Vec<usize>>();
assert!(
!close.is_empty(),
"the preparation span must be closed by an explicit span_nanos read; emitted:\n{main_rs}"
assert_eq!(
close.len(),
3,
"each preparation arm closes its own span and yields it as the arm's VALUE -- an outer \
binding assigned from every arm leaves its initialiser dead, which is an error in the \
emitted crate under -D warnings. Expected one close per arm (context, resolve, infer/accepted); \
emitted:\n{main_rs}"
);
let eval_start = main_rs
.find("let evaluate_started = Instant::now();")
Expand Down
Loading