Class InstrumentationMetadataRegistrar
parent-side — i.e. from the compiler's in-memory
IRModule.getCoverageMetadataJson(), not from a compiled class's <clinit>.
Why this exists (Track A). Coverage/profiling metadata JSON is no longer embedded into
every compiled class's <clinit> via LDC. That embedding overflowed the class-file
CONSTANT_Utf8 64KB ceiling on large modules and duplicated the same module-wide JSON into
every class. The compiler already holds the metadata on the IRModule, and every consumer
that reads coverage results (the CLI test runner, the MCP/IDE pipeline, the bytecode-execution test
harness) runs in the SAME process as the compiler — so it registers the metadata here, once per
module, instead of relying on class-load. This is the JVM in-process twin of the native bridge's
parent-side registration (each native test is a separate process; see the LLVM branch's
TestRunner.registerNativeInstrumentationMetadata).
Scope. Only non-dev / non-lib modules are registered — matching the old JVM behaviour exactly (which walked only the MAIN generated bytecode dir): dev/test sources and bundled library/built-in runtime sources never contributed to the coverage denominator. Registering the IRModule metadata for the whole (production) module set means unreferenced/untested code still appears at 0% — more reliably than class-load, which silently dropped classes that failed to load.
Idempotent. CoverageRuntime.registerMetadata(long, String, String) de-duplicates by module id
(putIfAbsent + probe-id keyed), so calling this more than once (e.g. the CLI and pipeline
paths, or per test case) is safe. Profiling metadata is registered unconditionally — harmless with
no timing data (ProfilingRuntime then reports nothing), and it reuses the same JSON (probe
function names).
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidregisterAll(CompilableProgram program) Register coverage + profiling metadata for every production (non-dev, non-lib) module's IR.
-
Method Details
-
registerAll
Register coverage + profiling metadata for every production (non-dev, non-lib) module's IR.- Parameters:
program- the resolved program whose IRModules carry the metadata JSON
-