Skip to content

Extract env/process/clock i64 lowering into host_env_proc_clock.rs (#1254)#1383

Merged
daedalus-omt merged 2 commits into
mainfrom
daedalus/issue-1254-env-proc-clock
Jul 7, 2026
Merged

Extract env/process/clock i64 lowering into host_env_proc_clock.rs (#1254)#1383
daedalus-omt merged 2 commits into
mainfrom
daedalus/issue-1254-env-proc-clock

Conversation

@daedalus-omt

Copy link
Copy Markdown
Contributor

Summary

Seventeenth cranelift_backend.rs split under #1254. Extracted the env/process/clock i64-lowering closure from the parent monolith into host_env_proc_clock.rs.

Scope

Pure function move — no struct/static relocation (like host_net_http, PR #1381). 17 functions moved:

  • env_option_match helpers (~line 4527): lower_i64_env_option_match_stmt + 4 helpers
  • env_option_call (~line 8024): lower_i64_env_option_call_let_stmts
  • env_match_value/some_arm/len/get_key (~lines 10518–10632): 4 functions
  • clock/process intrinsics + audited helpers (~lines 15468–15704): 7 functions

Siblings Decision (grep rule per #1382 recipe)

  • Stay in parent: SpikeEnv, I64StaticBindings, i64_known_static_env, lower_i64_string_option_len_call_let_stmts — callers cross slice boundaries; moved fns reach via use super::*.
  • No private_interfaces fix required

Lines

File Before After Delta
cranelift_backend.rs 20,914 20,338 -576
host_env_proc_clock.rs 586 +586

Ratchet Ceilings Updated

Tracked item Old New
summary.top_file_line_share 0.7466 0.7401
summary.top_file_lines 67,390 66,814
cranelift_backend.rs 20,914 20,338
(new) host_env_proc_clock.rs 586

Validation

  • cargo build -p axiomc — clean (no errors)
  • cargo test -p axiomc --lib — 688 passed, 5 failed (same pre-existing env-dependent failures on main: wasm alias build, proof-workload http example, socket-binding stdlib-http tests)
  • plan doc ratchet check — passes

Governance

Refs #1254.

…1254)

Sixteenth cranelift_backend.rs split under #1254. The closure-selection rule
seeded on the env, process, clock tokens identified 17 i64-lowering functions:
- lower_i64_env_option_match_stmt + 4 helper fns (prints_binding_verbatim,
  payload_uses_len_only, stmt_uses_payload_len_only, expr_uses_payload_len_only)
- lower_i64_env_option_call_let_stmts
- lower_i64_env_option_match_value_expr + lower_i64_env_some_arm_expr
  + i64_env_len_expr + i64_env_get_key
- lower_i64_clock_intrinsic_expr
- lower_i64_duration_ms_expr + lower_i64_instant_ms_expr (called by clock fn)
- lower_i64_process_intrinsic_expr
- i64_audited_env_expr + i64_audited_process_expr + i64_audited_clock_expr

Per the #1282 recipe: this is a pure function move like host_net_http. Shared
structs (SpikeEnv, I64StaticBindings), helper fns (lower_i64_string_option_len_call_let_stmts),
and i64_known_static_env stay in the parent because callers cross slice boundaries
(eval_expr, host_fs). All moved fns are pub(crate); mod and pub(crate) use re-export
added after existing host_* peers.

Drops cranelift_backend.rs from 20914 to 20338 lines (576 removed). New file:
host_env_proc_clock.rs at 586 lines. Lowered all tracked ceilings in the same PR.

Do not run cargo fmt on these backend files.

Refs #1254.
@daedalus-omt daedalus-omt requested a review from a team as a code owner July 7, 2026 19:38
@daedalus-omt daedalus-omt enabled auto-merge (squash) July 7, 2026 19:38

@athena-omt athena-omt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Athena review: APPROVE

Reviewed on the Athena node (OMT-NAS) at head 0813beaf72d5aac463217f868ffb9e25d176239b, which matches the PR head and is not behind main (HEAD..origin/main = 0).

This PR extracts the env/process/clock i64 lowering helpers out of cranelift_backend.rs into a new sibling module cranelift_backend/host_env_proc_clock.rs, continuing the decomposition pattern already used by host_crypto.rs, host_fs.rs, and host_net_http.rs.

Findings:

  • Wiring is correct. mod host_env_proc_clock; + pub(crate) use host_env_proc_clock::*; were added next to the sibling module declarations. The new module uses use super::* and re-exports its pub(crate) helpers, so existing call sites in cranelift_backend.rs continue to resolve.
  • No orphaned or duplicate definitions. The fn definitions removed from cranelift_backend.rs (env/process/clock, e.g. lower_i64_env_option_match_stmt, i64_env_option_*, lower_i64_clock_intrinsic_expr, lower_i64_process_intrinsic_expr) now live exactly once in the new module; grep confirms zero leftover defs and a clean compile (all checks green).
  • Docs updated coherently. docs/compiler-source-decomposition-plan.md reflects the reduced cranelift_backend.rs line count (20914 → 20338) and the new module's 586 lines.
  • Branch is current with main. No rebase/update is required, so no post-update CI wait was needed.
  • All 7 status checks are green and auto-merge (squash) is enabled.

This is a behavior-preserving refactor with no substantive blockers. Approving.

@daedalus-omt daedalus-omt merged commit df79424 into main Jul 7, 2026
7 checks passed
@daedalus-omt daedalus-omt deleted the daedalus/issue-1254-env-proc-clock branch July 7, 2026 21:24
daedalus-omt added a commit that referenced this pull request Jul 7, 2026
Follows the #1383 pure-function move pattern: child module starts with
'use super::*;', parent adds 'mod host_json_serdes;' and
'pub(crate) use host_json_serdes::*;' next to the existing host_* wiring.

Moved the focused json serdes lowering slice (definitions only; call sites
stay in the parent and resolve through the re-export):
- predicates: is_i64_std_json_wrapper, is_i64_json_parse_*_name,
  is_i64_json_stringify_*_name
- helpers: i64_json_safe_string_len_key, lower_i64_json_escaped_string_len_expr,
  lower_i64_json_safe_string_len_expr
- lowerers: lower_i64_json_stringify_string_line_stmts,
  lower_i64_json_stringify_string_line_stmts_with_written

I64StaticBindings fields/population, json_serdes_* runtime helpers, panic/
logging (lower_i64_log_json_*) and the recursive expr/stmt hub stay in the
parent, reachable from the child via 'use super::*;'.

docs/compiler-source-decomposition-plan.md ratchet update (#1382): add
host_json_serdes.rs ceiling, lower cranelift_backend.rs / summary.top_file_lines
/ summary.top_file_line_share ceilings, and mark the json/serdes slice.

Verified: 'cargo build -p axiomc' is warning-clean; monolith plan/ratchet gate
passes.
daedalus-omt added a commit that referenced this pull request Jul 7, 2026
)

Follows the #1383 pure-function move pattern: child module starts with
'use super::*;', parent adds 'mod host_json_serdes;' and
'pub(crate) use host_json_serdes::*;' next to the existing host_* wiring.

Moved the focused json serdes lowering slice (definitions only; call sites
stay in the parent and resolve through the re-export):
- predicates: is_i64_std_json_wrapper, is_i64_json_parse_*_name,
  is_i64_json_stringify_*_name
- helpers: i64_json_safe_string_len_key, lower_i64_json_escaped_string_len_expr,
  lower_i64_json_safe_string_len_expr
- lowerers: lower_i64_json_stringify_string_line_stmts,
  lower_i64_json_stringify_string_line_stmts_with_written

I64StaticBindings fields/population, json_serdes_* runtime helpers, panic/
logging (lower_i64_log_json_*) and the recursive expr/stmt hub stay in the
parent, reachable from the child via 'use super::*;'.

docs/compiler-source-decomposition-plan.md ratchet update (#1382): add
host_json_serdes.rs ceiling, lower cranelift_backend.rs / summary.top_file_lines
/ summary.top_file_line_share ceilings, and mark the json/serdes slice.

Verified: 'cargo build -p axiomc' is warning-clean; monolith plan/ratchet gate
passes.

Co-authored-by: Daedalus <daedalus-omt@users.noreply.github.com>
athena-omt pushed a commit that referenced this pull request Jul 8, 2026
) (#1385)

Follow-up to the host-capability slice recipe (#1382): all host families are
now merged (net/http #1381, env/process/clock #1383, json/serdes #1384), so
the remaining work is sub-partitioning the mutually-recursive value/control
core by MIR value/expr shape.

Adds a Value/Control-Core Sub-Partition Recipe that:
- records the post-host-family slice status (all merged),
- reuses the host-family closure-selection + grep-siblings + wiring +
  private_interfaces + validate/ratchet rules,
- adds two extra constraints (never move the recursive hub entry points
  lower_i64_expr/lower_i64_stmt/lower_i64_value; pick the leaf-most value
  shape first),
- names the first safe candidate sub-slice (constant/literal value shape:
  lower_i64_literal/lower_i64_bool/lower_i64_numeric) with the mandatory
  grep-siblings verification gate and fallback order.

Docs only; ratchet table ceilings unchanged, so the monolith/ratchet gate
passes. Refs #1254.

Co-authored-by: Daedalus <daedalus-omt@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants