Skip to content

Research: WALA-inspired demand-driven alias precision for ownership diagnostics (bounded spike) #429

Open

Description

@PhysShell

Classification

Problem / motivation

Own.NET should not add another general-purpose analysis engine merely because a mature research framework exists. In particular, S5 exposed a soundness problem and showed no demonstrated marginal utility over C01 on evaluated real applications. Before any alias/points-to infrastructure work, establish that a concrete, confirmed Own.NET false negative or false positive is caused by insufficient resource identity, alias, or call-context precision, as opposed to lost Roslyn facts, a missing method summary, incorrect transfer rules, or an invalid test oracle.

WALA is interesting as design prior art, especially its separation between object abstraction policy, call contexts, and propagation/refinement, plus its demand-driven points-to analysis, IFDS tabulation and program slicing. It does not supply ownership/disposal semantics for .NET, and IFDS/points-to alone cannot prove a resource-lifetime property.

Research question: Can a small, budgeted precision escalation on existing OwnIR facts recover a previously missed, independently verified ownership finding, reject a documented false positive, or materially improve a reproducible witness, compared with the current analyzer, at acceptable runtime/memory cost without any unsupported safety claims?

Source areas worth inspecting (pin WALA commit/tag in report)

Do not treat WALA's algorithm, performance or soundness guarantees in its source language as a guarantee for a new C# model.

Bounded plan

0. Gap inventory and pre-registration: stop early if there is nothing real to fix

1. Compare minimal precision strategies offline

Using the existing pipeline (no production changes by default), attempt the cheapest applicable distinctions one at a time:

  1. Baseline: current Own.NET identity/alias and call-summary behavior.
  2. Allocation-site-sensitive abstraction: distinguish resource instances created at different sites, while recording joins/escapes that may merge them.
  3. Selective call-context refinement, only if needed: distinguish a bounded number of caller/call-site contexts or resource-specific flows for the problematic query. Account for virtual/unknown dispatch explicitly.

Retain clear identity/alias semantics (must-alias, may-alias, definitely-distinct, unknown) and do not equate no proven alias with proven disjointness. Resource release, borrow, transfer, escape, exceptional paths and field/array aliasing must use appropriate may/must rules.

Implement the prototype only at the smallest seam required to test the hypothesis; compare behavior before considering a general-purpose points-to graph, IFDS/IDE port, or whole-program call graph.

2. Adversarial controls

Create/reuse a small reviewed micro-corpus (roughly 10–16 cases, not a synthetic scoreboard), covering where applicable:

  • two instances of the same disposable type and calls sharing a callee;
  • definite alias versus separate allocation; reassignment and phi/branch merge;
  • receiver vs argument identity; ownership transfer / escape;
  • field/array/container aliases and unknown heap effects;
  • direct vs virtual/interface calls and unresolved targets;
  • guarded Dispose, use-after-dispose, double dispose, missing release;
  • exceptional path or try/finally, plus one negative near-neighbor.

Compile C# cases and inspect actual OwnIR lowering. Do not count a generated case as ground truth until independently adjudicated. Preserve individual results, not just a pooled score.

3. Budget, uncertainty, and soundness contract

  • Explicitly distinguish witness found, complete bounded negative, unknown due to model/dispatch, incomplete due to limit, and unsupported/failed execution. A timed-out or budget-exhausted search is not evidence of no defect.
  • Prototype refinements must not suppress existing confirmed positives or silently turn unknown into safe. Test deliberate budget truncation and incomplete traversal.
  • Make any performance claims conditional on measurements: wall time, peak RSS, number of visited states/context variants, and cost of initial graph construction, on pinned fixtures and a small real-OSS subset.
  • Check deterministic outcomes and, if relevant, Python/Rust parity without broadening P-022 diagnostics: normalized AnalysisTrace and first-divergence minimizer for Python↔Rust shadow mode #269.

4. Compare to baseline; issue a go/no-go

Report per-case baseline vs. refinement: expected outcome, actual outcome, FP/FN, proof/witness status, uncertainty/completeness, time and memory. Separate better explanatory slices from better detection. Confirm each apparently new finding by independent C# semantics/reproduction, not the prototype's own output.

GO for a separate implementation issue only if at least one previously missed/false diagnostic is demonstrably fixed by the tested abstraction, negative controls remain correct, uncertainty stays explicit, and measured cost is justified. Otherwise NO-GO / research only.

Acceptance

  • Source-backed design note pinned to WALA version/commit, with exact transferable ideas and .NET limitations.
  • Reviewed gap inventory; classify each candidate as identity/alias precision, lost lowering facts, missing model, transfer error, unsupported case, or bad oracle.
  • A minimal reproducible baseline-versus-refinement experiment if an eligible real gap exists, or an early NO-GO with evidence if none does.
  • Reviewed positive, negative, and adversarial controls, with source/OwnIR snapshots and exact commands.
  • Explicit incomplete/unknown outcomes tested under truncation; no new unproven “safe” verdicts.
  • Per-case accuracy/witness and resource-cost comparison, without fabricated precision/recall rates from tiny samples.
  • Final GO / NO-GO / RESEARCH ONLY verdict and, only on GO, a separate narrowly scoped implementation issue.

Non-goals

No WALA/Java runtime dependency, Roslyn frontend replacement, broad OwnIR redesign, generic IFDS/IDE or concolic engine, unbounded program slicing, wholesale heap graph, new default CI gate, or implicit production diagnostic changes. Do not duplicate #424/#426 evidence/path work or #394/#395 summaries. This is an experiment to establish incremental diagnostic utility, not an infrastructure project looking for justification.

Success means validated improvement on a real ownership problem. A sophisticated solver that still finds nothing new is a STOP.

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