Skip to content

Delete the Library Body Analysis infrastructure #9959

Open

Description

@richlander

Goal

Delete the Library Body Analysis infrastructure: every LibraryBody* type, LibraryMethodAnalysisRunner, and MethodDefinitionMap in src/ILInspector.Analysis, plus docs/design/library-body-analysis-service.md. This follows the deletion of LibraryBodyIndex (#9307).

Why Library Body Analysis is retired gives the reasons:

  • its cost follows the assembly, not the question;
  • its results don't decompose;
  • its hubs are closed;
  • its receipt can't prove scope.

Role map says where each of its roles moves.

Relation to existing trackers

Remaining dependencies (main at 813406e7f)

Production and tool consumers of LibraryBodyAnalysisService (24 files)

  • CLI:
    • Commands/ILOffsetQuery.cs
    • Inspectors/MethodBodyInspectionSession.cs
  • Queries:
    • AssemblyContextCallGraphAnalysis
    • AssemblyContextImplementationProfileFamilyQuery
    • AssemblyContextImplementationProfilesQuery
    • AssemblyContextMethodAnalysisQuery (Adopt focused exact-member Analysis in AssemblyContextMethodAnalysisQuery #9832)
    • AssemblyContextOptimizationOpportunitiesQuery
    • AssemblyContextResourceTriageQuery
    • AssemblyContextTypeImplementationHeatQuery
    • AssemblyContextTypeMethodLeverageQuery
    • AssemblyPairClusterRootPathQuery
    • MemberCallGraphSession
  • Research queries:
    • AssemblyContextImplementationDiffQuery
    • AssemblyContextLibraryDependencyStructureQuery
    • AssemblyContextLibraryMetricsQuery
    • AssemblyContextResearchProjectionQueries
    • DirectMemberComparisonQuery
  • Sections: LibraryAddressInspectionOperation
  • Research:
    • MemberProjectionProducer
    • ResearchDiff
    • ResearchDiff.BodySignals
  • Tools:
    • ILInspector.Analysis.App/Program.cs
    • ILInspector.TypeScriptGeneration/JsExportSurfaceLoader.cs
    • runfaster/Program.cs

Repository tools under tools/ (added at bafc7ab38)

The first inventory listed only src/ consumers. These tools also build on the infrastructure. Each must either move to the new stack or be deleted; neither may keep Library Body Analysis alive.

  • AnalysisHarness (12 files):
    • AllocationMetadataReadout.cs
    • AnalysisFixtureRunner.cs
    • BodyUseScorecardKernel.cs, which uses LibraryBodyAnalysisBuilder, LibraryMethodAnalysisRunner, and the LibraryBodyUse* service
    • CallerLoopCensus.cs
    • CorpusSensor.cs
    • DeferredCallbackCensus.cs
    • ImplementationMetricPerformance.cs
    • LeakActionabilitySensor.cs
    • MemberBodySizeScorecard.cs, which also uses LibraryMethodAnalysisRunner
    • PrecisionRecall.cs
    • RecursiveTraversalCensus.cs
    • README.md
  • AddressTerminalScorecard/Program.cs
  • CatalogCallGraphScorecard/Program.cs
  • OwnershipIncidenceScorecard/Program.cs
  • DecompilerHarness/AnnotationCheck.cs, plus three corpus baselines that name LibraryBody* types
  • AnalysisLibraryBodyUseAdmissionBenchmark (Program.cs and README.md)

Tests that name these types (about 125 files across 8 test projects, most in ILInspector.Analysis.Tests) move or are deleted with the code they cover; they are not tracked one by one here.

Method Query Source's own dependencies on the legacy runner and builder

The owner-issued source still borrows the legacy machinery internally. These dependencies must go too, or a consumer that has "moved" still runs Library Body Analysis code:

  • Module lookup is the legacy runner. MethodDefinitionView.Lookup is a LibraryMethodAnalysisRunner. MethodDefinitionExecution builds a LibraryBodyAnalysisBuilder per lane to obtain it, and MethodDefinitionPredicates, MethodRowGate, and MethodDefinitionProducers read through it. It needs an owner-issued module-lookup support.
  • Unsafe evidence presence probes through LibraryMethodAnalysisRunner.ProbeUnsafeDeclaration and ProbeUnsafeBody. This is inherited from the consolidated Unsafe work, and must agree with the census (Make Analysis memory-safety evidence model-aware #5254).
  • Generated-body expansion delegates discovery and authentication to LibraryBodyDeclaredSourceResolver, LibraryBodyAsyncSourceResolver, and LibraryBodyLiftedSourceOwnerResolver. Publish the declared-source relation over all-definition and exact-type breadth #9864 moves them out of LibraryBody* into a focused declared-source owner, and grounds state-machine identity and roles in StateMachineRelationshipIndex. Library Body Analysis then consumes the new owner until it is deleted.
  • Runner reads: AsyncSiblingProducer, MethodCallCountProducer, and AnalysisLibraryBodyUse also read through the runner.

Infrastructure files (35)

  • The hub:
    • LibraryBodyAnalysisService
    • LibraryBodyAnalysisExecution
    • LibraryBodyAnalysisBuilder (5 files)
    • LibraryBodyAnalysisAccumulator
    • LibraryBodyAnalysisFeatures
    • LibraryBodyAnalysisPlan
    • LibraryBodyAnalysisRequest
    • LibraryBodyAnalysisResult
    • LibraryBodyAnalysisStageParticipation
    • LibraryMethodAnalysisRunner (3 files)
    • MethodDefinitionMap, which is now a subclass of the shared SameModuleMethodResolver (Receipt same-module call-target support as a Method Query Source capability #9938)
  • Classifiers and resolvers that hold reusable judgment:
    • async-sibling (5 files)
    • declared, async, and lifted source resolvers
    • exception type, generated provenance, generic constraint, and stable receiver getter classifiers
    • method, primary, and reference metadata resolvers
    • module identity
    • root paths
    • TypeDef resolution

Each reusable piece either moves to its focused owner under a name without LibraryBody, as SameModuleMethodResolver did, or is deleted with its last caller. It never stays behind as a dependency of the new stack.

Done when

  • No type named LibraryBody*, LibraryMethodAnalysisRunner, or MethodDefinitionMap remains in src/.
  • src/ILInspector.Analysis/Planning/ references none of them.
  • library-body-analysis-service.md is deleted, and AAO's migration section, including the Role map, is reduced to history or removed. Its focused result semantics move to their owner documents first.

Refs #8965, #8568, #5254

🤖 Generated with Claude Code

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