Files
hakorune/src/runner/modes/common_util/diag.rs
nyash-codex 07a254fc0d feat(phase21.5): MirBuilder optimization prep + crate EXE infrastructure
Phase 21.5 optimization readiness - C-level performance target:
- MirBuilder: JsonFrag purify toggle (HAKO_MIR_BUILDER_JSONFRAG_PURIFY=1)
- Normalizer: extended f64 canonicalization + dedupe improvements
- loop_opts_adapter: JsonFrag path refinement for crate EXE compatibility

Infrastructure improvements:
- provider_registry: add diagnostics + ring-1 providers (array/console/map/path)
- mir_interpreter: add normalization/purify feature gates
- tools/selfhost_exe_stageb.sh: new end-to-end Stage-B→crate EXE pipeline
- tools/perf/microbench.sh: performance measurement tooling

Smoke tests (phase2100):
- Extend timeout 15s→120s for heavy crate EXE builds
- Add stageb_loop_jsonfrag_crate_exe_canary_vm.sh (target test)
- Add s3_backend_selector_crate_exe_vm_parity_return42_canary_vm.sh

Documentation:
- ENV_VARS.md: add Phase 21.5 optimization toggles
- README updates: clarify crate backend strategy
- phase215-optimization.md: new optimization roadmap

This commit sets the stage for Phase 21.5 critical optimization:
achieving C-level performance to decide hakorune's future viability.
2025-11-11 02:07:12 +09:00

29 lines
1.0 KiB
Rust

//! Common diagnostics helpers (concise, centralized)
/// Whether provider logs should be emitted under current policy.
/// quiet_pipe usually reflects NYASH_JSON_ONLY; allowing override with HAKO_PROVIDER_TRACE=1.
pub fn provider_log_enabled(quiet_pipe: bool) -> bool {
!quiet_pipe || std::env::var("HAKO_PROVIDER_TRACE").as_deref() == Ok("1")
}
/// Emit a consistent provider-registry info line.
pub fn provider_log_info(msg: &str) {
eprintln!("[provider-registry] {}", msg);
}
/// Emit the provider selection tag in a stable shape.
pub fn provider_log_select(box_name: &str, ring: &str, source: &str, caps: Option<&str>) {
match caps {
Some(c) if !c.is_empty() => {
eprintln!("[provider/select:{} ring={} src={} caps={}]", box_name, ring, source, c);
}
_ => {
eprintln!("[provider/select:{} ring={} src={}]", box_name, ring, source);
}
}
}
/// Emit a Fail-Fast tag for provider fallback/selection errors.
pub fn failfast_provider(reason: &str) { eprintln!("[failfast/provider/{}]", reason); }