Skip to content

func_env.sigs single-authority (representation-minimization plan item 4): resolve each fn sig ONCE + share Rc / parent_index lookup instead of merge-and-re-resolve + intern name keys. Resolution-strategy ROOT fix (same class as #5867), ~hundreds MiB. Measure-first, green-by-exec, hand-edit .rs seed - #5893

Merged
briansrls merged 4 commits into
mainfrom
session/zesty-wren-856
Jun 28, 2026

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Auto-opened by session-dashboard for session zesty-wren-856.
Pushing to session/zesty-wren-856 advances this PR.

Worker attestation

Before flipping this PR to ready for review, confirm each item:

  • Title describes the change (not the session id or branch).
  • PR body summarises what and why (replace the TODO below).
  • Tests run: name the command (e.g. npm test, cargo test) and the result.
  • If this closes a work item, the body contains a Closes #N directive.
  • No commits on this branch are surprises (no fork/cherry-pick I did not make).
  • No secrets / credentials / large binaries staged.

Summary

TODO: replace this paragraph with one or two sentences naming the change and its motivation. Reviewers read this first.

Test plan

  • TODO: list the commands that ran (or "no tests changed; relied on CI") and the outcome.

briansrls and others added 3 commits June 28, 2026 01:06
…les (plan item 4)

Each importing module was re-materializing its transitive-closure signatures:
merge_scope_from_imports converted ResolvedFuncSig -> DeclaredFuncSig (fresh
allocation per sig), then resolve_func_sigs called collect_parent_resolved_sigs
which called declared_to_resolved to convert back (another fresh allocation).
Net: two fresh struct allocations per imported sig per module.

Fix: merge_scope_from_imports now accumulates imported_sigs as
Map<String, ResolvedFuncSig> directly via rc_map_merge over the parent's
func_env.signatures (Rc clone — O(1) per sig, no struct allocation).
resolve_func_sigs accepts parent_sigs directly, skipping collect_parent_resolved_sigs.
InferScopeComponents.func_sigs (DeclaredFuncSig) replaced by imported_sigs
(ResolvedFuncSig) — the conversion round-trip is eliminated.

Same single-authority move as #5867 (shared InternTable). Payoff: hundreds of
MiB — each of the ~608 modules no longer allocates fresh ResolvedFuncSig
structs for every transitively-imported function signature.

Changes: 04_infer.dag (.dag authority) + 04_sigs.dag + hand-edited .rs seed
(v1_compiler_infer.rs, v1_compiler_infer_sigs.rs).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…adow filter

Two fixes from claude-opus review:
1. collect_parent_resolved_sigs is now unreferenced (its only call in
   resolve_func_sigs was replaced by parent_sigs parameter). Delete it
   from 04_sigs.dag and v1_compiler_infer_sigs.rs.
2. The original collect_parent_resolved_sigs filtered out parent sigs
   whose names collide with local functions, preserving correct topo-
   ordering when a local fn shadows an imported one. The new parent_sigs
   parameter did not apply this filter. Restore the local-shadow filter
   inline in resolve_func_sigs: parent_sigs_filtered excludes names in
   local_func_set before seeding topo_resolve_loop, exactly matching
   the original behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@briansrls
briansrls marked this pull request as ready for review June 28, 2026 14:41
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.

1 participant