Skip to content
Closed
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
42 changes: 0 additions & 42 deletions src/v1/stage0/examples/parse_compiled_scale.rs

This file was deleted.

22 changes: 0 additions & 22 deletions src/v1/stage0/examples/prep_profile.rs

This file was deleted.

70 changes: 39 additions & 31 deletions src/v1/stage0/src/bin/claim_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,13 +516,39 @@ fn validate_fixture_flags(
Ok(())
}

fn run_witnesses(
index: &MultiEntryIndex,
group: &EntryGroup,
/// The four facts that decide how a witness EVALUATES, as one carrier. They travel together on
/// every path — the single-entry one and the grouped one — and are consumed at exactly one place
/// ([`WitnessRuntime::eval_context`]), so carrying them as four loose parameters was one concept
/// spelled four times per call site, with no way to add a fifth without editing both.
struct WitnessRuntime {
execution_mode: ExecutionMode,
fixture_store: Option<Rc<RecordedFixtureStore>>,
whole_tree_published_keys: Option<Rc<std::collections::HashSet<String>>>,
eval_budget_ms: Option<u64>,
}

impl WitnessRuntime {
fn eval_context(
&self,
graph: &v1_compiler::v1_compiler_compile::ResolvedGraph,
source_indices: Rc<im::HashMap<String, Rc<v1_compiler::v1_std_core::NewlineIndex>>>,
) -> v1_compiler::v1_interpreter::InterpContext {
let ctx = make_eval_context_with_runtime_options(
graph,
source_indices,
self.execution_mode,
self.fixture_store.clone(),
self.whole_tree_published_keys.clone(),
);
ctx.set_witness_eval_budget(self.eval_budget_ms);
ctx
}
}

fn run_witnesses(
index: &MultiEntryIndex,
group: &EntryGroup,
runtime: &WitnessRuntime,
any_failed: &mut bool,
timings: &mut ResolveTimings,
) -> Result<(), ExitCode> {
Expand All @@ -531,14 +557,7 @@ fn run_witnesses(
eprintln!("claim_batch: closure subject for {}: {e}", group.entry);
ExitCode::from(1)
})?;
let ctx = make_eval_context_with_runtime_options(
&graph,
source_indices,
execution_mode,
fixture_store,
whole_tree_published_keys,
);
ctx.set_witness_eval_budget(eval_budget_ms);
let ctx = runtime.eval_context(&graph, source_indices);
for function in &group.functions {
run_claim_timed(&ctx, &closure_subject, function, any_failed, timings);
// The eval-call memo's eviction scope is the witness frame, not this
Expand Down Expand Up @@ -740,6 +759,13 @@ fn run() -> Result<ExitCode, ExitCode> {
}
};

let runtime = WitnessRuntime {
execution_mode,
fixture_store,
whole_tree_published_keys,
eval_budget_ms,
};

let flatten_baseline = v1_compiler::v1_interpreter::flatten_counters_snapshot();
let stats_requested = std::env::var_os("GUNBC_INTERP_STATS").is_some_and(|v| v != "0");

Expand All @@ -766,14 +792,7 @@ fn run() -> Result<ExitCode, ExitCode> {
eprintln!("claim_batch: closure subject for {}: {e}", group.entry);
ExitCode::from(1)
})?;
let ctx = make_eval_context_with_runtime_options(
&graph,
source_indices,
execution_mode,
fixture_store.clone(),
whole_tree_published_keys.clone(),
);
ctx.set_witness_eval_budget(eval_budget_ms);
let ctx = runtime.eval_context(&graph, source_indices);
for function in &group.functions {
run_claim_timed(
&ctx,
Expand Down Expand Up @@ -803,18 +822,7 @@ fn run() -> Result<ExitCode, ExitCode> {
// any_failed). Aborting the whole batch on the first red entry
// truncated the measurement: each run revealed only the NEXT red
// class, and everything alphabetically after it went unmeasured.
if run_witnesses(
&index,
group,
execution_mode,
fixture_store.clone(),
whole_tree_published_keys.clone(),
eval_budget_ms,
&mut any_failed,
&mut timings,
)
.is_err()
{
if run_witnesses(&index, group, &runtime, &mut any_failed, &mut timings).is_err() {
for function in &group.functions {
println!("FAIL {} (entry resolve failed: {})", function, group.entry);
}
Expand Down
1 change: 1 addition & 0 deletions src/v1/stage0/src/bin/cssl_assemble.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::disallowed_macros)]
//! CLI for generic seed-shim closure assembly (curated self-host harness).

use clap::Parser;
Expand Down
15 changes: 10 additions & 5 deletions src/v1/stage0/src/cli_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ pub mod declaration_index;
mod required_floor_runner;
pub(crate) use required_floor_runner::*;
pub use required_floor_runner::{
make_eval_context, make_eval_context_with_runtime_options, run_claim_measured,
run_required_floor,
floor_discovery_path_excluded, floor_prepared_subject_exclusions, make_eval_context,
make_eval_context_with_runtime_options, run_claim_measured, run_required_floor,
};
mod entry_resolve;
pub(crate) use active_workset::*;
pub(crate) use entry_resolve::*;
pub use entry_resolve::{
process_shared_index, resolve_entry_graph, resolve_entry_with_index, resolve_stage_totals,
source_root_ingest_content_hash_fnv1a64,
load_sources_for_entry, process_shared_index, resolve_entry_graph, resolve_entry_with_index,
resolve_stage_totals, source_root_ingest_content_hash_fnv1a64, whole_tree_resolved_ctx,
};
mod live_read_decode;
pub(crate) use live_read_decode::*;
Expand All @@ -74,6 +74,7 @@ mod fallback_arm_census;
pub(crate) use census_heads::*;
pub(crate) use fallback_arm_census::*;
mod declared_refs;
pub use declared_refs::declared_import_closure_binding_observation_from_resolved;
pub(crate) use declared_refs::*;
mod doc_graph;
pub(crate) use doc_graph::*;
Expand All @@ -84,7 +85,10 @@ pub(crate) use emit_host::*;
pub use emit_host::{
compile_dag_diagnostic_census_memo_counts, compile_dag_rust_emit_check_memo_counts,
};
pub use emit_host::{emit_module_storage_binding_manifest, emit_source_root_ingest_manifest};
pub use emit_host::{
compile_dag_multi_module_fixture, emit_module_storage_binding_manifest,
emit_source_root_ingest_manifest,
};
mod witness_gates;
pub use witness_gates::witness_exclusion_substrings;
pub use witness_gates::witness_layer_roots;
Expand All @@ -100,6 +104,7 @@ pub(crate) use class_b_census::*;
mod non_fold_residue;
pub(crate) use non_fold_residue::*;
mod compile_clean;
pub use compile_clean::compile_clean_diagnostic_is_hard;
pub(crate) use compile_clean::*;
mod test_migration;
pub(crate) use test_migration::*;
Expand Down
1 change: 1 addition & 0 deletions src/v1/stage0/tests/bounded_shell_stream_capture_replay.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::disallowed_macros)]
//! Host-boundary regression receipt for bounded shell stream drain (PR #8087).
//!
//! Proves the v1_interpreter seed drain does not retain stderr proportional to child
Expand Down
13 changes: 7 additions & 6 deletions src/v1/stage0/tests/interpreter_dispatch_authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@

use v1_compiler::v1_interpreter_dispatch_generated::{
lookup_eval_algebra_method_inner, lookup_eval_builtin_inner,
lookup_eval_call_bridge_std_compilers_lexing, lookup_eval_call_bridge_std_node,
lookup_eval_call_bridge_std_compilers_lexing, lookup_eval_call_bridge_std_node_reflection,
lookup_eval_call_native_intercept, lookup_try_parse_table_memo_dispatch,
lookup_try_v2_std_collection_map_primitive_grounding, EvalAlgebraMethodArm, EvalBuiltinArm,
EvalCallBridgeStdCompilersLexingArm, EvalCallBridgeStdNodeArm, EvalCallNativeInterceptArm,
TryParseTableMemoDispatchArm, TryV2StdCollectionMapPrimitiveGroundingArm,
EvalCallBridgeStdCompilersLexingArm, EvalCallBridgeStdNodeReflectionArm,
EvalCallNativeInterceptArm, TryParseTableMemoDispatchArm,
TryV2StdCollectionMapPrimitiveGroundingArm,
};

fn all_eval_builtin_variants_reachable() {
Expand All @@ -36,7 +37,7 @@ fn all_eval_algebra_variants_reachable() {

fn all_bridge_variants_reachable() {
assert!(
lookup_eval_call_bridge_std_node("resolve_type_node").is_some(),
lookup_eval_call_bridge_std_node_reflection("resolve_type_node").is_some(),
"missing lookup for eval_call bridge (std_node) spelling: resolve_type_node"
);
assert!(
Expand Down Expand Up @@ -70,8 +71,8 @@ fn generated_enums_are_copy_and_distinct() {
EvalCallBridgeStdCompilersLexingArm::V4BridgeSymbolLexeme
);
assert_eq!(
EvalCallBridgeStdNodeArm::V4BridgeResolveTypeNode,
EvalCallBridgeStdNodeArm::V4BridgeResolveTypeNode
EvalCallBridgeStdNodeReflectionArm::V4BridgeResolveTypeNode,
EvalCallBridgeStdNodeReflectionArm::V4BridgeResolveTypeNode
);
assert_ne!(
TryV2StdCollectionMapPrimitiveGroundingArm::MapGroundingMapInsert,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
//! run is cheap and keeps the claim-A discriminator exercised without opt-in.

use std::fs;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::process::Command;

fn temp_fixture_root(name: &str) -> PathBuf {
Expand All @@ -38,7 +38,7 @@ fn temp_fixture_root(name: &str) -> PathBuf {
base
}

fn write_fixture_crate(root: &PathBuf, lib_rs: &str) {
fn write_fixture_crate(root: &Path, lib_rs: &str) {
let src = root.join("src");
fs::create_dir_all(&src).expect("src dir");
fs::write(
Expand Down
8 changes: 4 additions & 4 deletions src/v1/stage0/tests/namespace_occurrence_serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ fn list_slice_parser_does_not_reuse_authored_identity() {
}

#[test]
fn parser_lists_publish_accepted_child_identity() {
fn weather_example_parser_does_not_reuse_authored_identity() {
let parsed = parse_source(
include_str!("../../../../dag/examples/cost_estimate/cost_estimate.dag"),
"dag/examples/cost_estimate/cost_estimate.dag",
include_str!("../../../../dag/examples/weather/weather.dag"),
"dag/examples/weather/weather.dag",
occurrence_id_allocator_initial(),
);
assert!(parsed.result.error.is_none(), "{:?}", parsed.result.error);
Expand Down Expand Up @@ -318,7 +318,7 @@ fn authored_identity_allocator_crosses_real_module_boundary() {
let digest = parse_source(
include_str!("../../../../dag/extdeps/container/oci/digest.dag"),
"dag/extdeps/container/oci/digest.dag",
materialization.occurrence_allocator.clone(),
materialization.occurrence_allocator,
);
assert!(digest.result.error.is_none(), "{:?}", digest.result.error);
let left: HashSet<i64> = materialization
Expand Down
46 changes: 22 additions & 24 deletions src/v1/tests/src/decl_facts_dimensionless_projection_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,33 +100,31 @@ fn edge_target_named(ctx: &InterpContext, projection: &Value, label: &str) -> Op
_ => return None,
};
for edge in children.iter() {
match edge {
Value::Record {
fields: edge_fields,
..
} => {
let edge_label = match ctx.field(edge_fields, "label") {
Some(Value::Variant {
variant_name,
fields: label_fields,
..
}) => {
if *variant_name != ctx.sym("Named") {
continue;
}
match ctx.field(label_fields, "name") {
Some(Value::Str(s)) => s.as_ref(),
_ => continue,
}
if let Value::Record {
fields: edge_fields,
..
} = edge
{
let edge_label = match ctx.field(edge_fields, "label") {
Some(Value::Variant {
variant_name,
fields: label_fields,
..
}) => {
if *variant_name != ctx.sym("Named") {
continue;
}
match ctx.field(label_fields, "name") {
Some(Value::Str(s)) => s.as_ref(),
_ => continue,
}
_ => continue,
};
if edge_label != label {
continue;
}
return ctx.field(edge_fields, "target").cloned().map(|v| v.clone());
_ => continue,
};
if edge_label != label {
continue;
}
_ => {}
return ctx.field(edge_fields, "target").cloned();
}
}
None
Expand Down
2 changes: 2 additions & 0 deletions src/v1/tests/src/none_undetermined_carrier_refuse_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
//! Checkable receipt: `dag/test/retirement/none_undetermined_carrier_refuse_retained.dag`.

use std::rc::Rc;
use v1_compiler::std_occurrence_identity::NodeOccurrenceIdentity;
use v1_compiler::v1_compiler_emit_rust::emit_none_keyword_for_resolved_type;
use v1_compiler::v1_std_core::{no_span, Cardinality, Connective, ExprData, InferredNode, Node};

fn node_with_cardinality(cardinality: Cardinality) -> Rc<Node> {
let span = no_span();
Rc::new(Node {
occurrence_identity: Rc::new(NodeOccurrenceIdentity::OccurrenceSynthetic),
name: "T".to_string(),
ident: None,
span: span.clone(),
Expand Down
Loading