Skip to content

Research: Cilica-style analysis invalidation and pass verification for OwnIR (bounded spike) #456

Open

Description

@PhysShell

Classification

Why this might matter

Cilica is a post-build IL optimizer, not an ownership analyzer. Its useful prior art is an engineering contract around transformations of an SSA-based IR, specifically:

  1. Analysis dependency tracking / invalidation. Its MethodTransformContext.GetAnalysis<T>() caches analyses, records dependencies and invalidates affected results on instruction edits/method revisions.
  2. Pass manager and invariants. PassRunner.Run(), CompilationPipeline.CreateDefault() and VerifyEachPass coordinate mutation, verification and inspection.
  3. CFG and SSA integrity under rewrites. Dedicated graph edit methods (ReplaceTerminator(), RedirectEdge()) maintain phi inputs; import/code generation form explicit transformation boundaries.
  4. Controlled failure/completeness. Its compilation distinguishes unchanged / optimized / unsupported / failed methods; failed methods keep original bodies, and --strict can prevent saving on failure. This suggests a useful comparison with Own.NET's separate unknown/incomplete versus clean analysis outcomes.

The question is not whether to optimize IL in Own.NET. It is whether a small, demonstrably useful change/invalidation/verification contract would prevent a real Own.NET regression or simplify an existing fragile analysis path.

Bounded investigation (read-only / kill-first)

  • Pin the exact revisions of Own.NET and Cilica; inspect upstream implementation and tests rather than relying on feature descriptions.
  • Inventory current equivalents in Own.NET: Roslyn CFG/semantic extraction, OwnIR representation and validators, Rust solver/pass invocation, caching/recomputation, provenance/source locations and existing fixtures. Record what is already solved.
  • Compare at most three concrete mechanisms: (a) revisions and dependency-based invalidation, (b) post-pass structural verification, (c) pass failure vs incomplete/unknown semantics. For each, identify exact upstream code/tests and current Own.NET counterpart.
  • Reuse Research: semantic mutation testing harness for Own.NET analyzer coverage (bounded pilot) #405/Research: SootUp-inspired OwnIR/ICFG semantic-fidelity and incomplete-call audit (bounded spike) #430 fixtures and traces. If and only if a plausible gap exists, design one minimal read-only regression/reproducer: edit/replace a fact or edge that should invalidate a dependent conclusion; test a changed/unrelated fact and a negative control. Consider ownership-sensitive paths (aliases, event subscription cleanup, conditional/exceptional disposal) without adding new diagnostics or a standalone harness.
  • Evaluate semantic boundaries explicitly: Cilica IR verification checks its own invariants, not C#→OwnIR fidelity, observational equivalence, or ownership-soundness. Do not assume SSA, devirtualization, or IL-level optimization preserves the source evidence chain relevant to Own.NET.
  • Produce a compact decision table: mechanism | Cilica implementation | Own.NET equivalent | demonstrated failure/cost | borrow small idea / defer / reject. Require a reproducible defect or maintainability win before proposing any code.

Non-goals

Exit criteria

Close as BORROW / DEFER / REJECT with cited source locations and a short evidence table. REJECT/no-action is a valid successful outcome if Own.NET already provides equivalent guarantees, or if no actual failure/maintenance benefit can be shown. Any implementation requires a separate, narrowly scoped issue and a test that fails before the change.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions