Repository navigation
[cDAC][wasm] Register platform GC-info decoding - #135055
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
lewing
left a comment
There was a problem hiding this comment.
I checked the traits against native Wasm32GcInfoEncoding in src/coreclr/inc/gcinfotypes.h, and every constant matches, including HAS_INTERRUPTIBLE_RANGES = false, which GCInfoDecoder honors. The interpreter correctly keeps InterpreterGCInfoTraits. I ran the GC-info tests locally at 41b8bbf: 5/5 pass, and the change merges cleanly with #135044.
Heads-up on overlap: #133890 also adds a WASM traits class (Wasm32GCInfoTraits) and registers it on the same CoreCLRContracts.cs line. That version doesn't override HAS_INTERRUPTIBLE_RANGES, so it inherits true and would misdecode WASM fat headers. The traits here are the correct ones to keep, and I've asked that session to drop its copy when it restacks.
Note
This review was generated with assistance from GitHub Copilot.
|
/ba-g the failures are pre-existing on main |
… section (#135059) Native `ReadyToRunInfo::GetDebugInfo` (`src/coreclr/vm/readytoruninfo.cpp`) returns `NULL` immediately when `m_pSectionDebugInfo == NULL`. The cDAC mirror, `ReadyToRunJitManager.GetDebugInfo`, dereferenced `ReadyToRunInfo.DebugInfoSection` without that check and built a `NativeArray` from whatever was at address 0. This now matters because #134690 makes Browser/WASI ReadyToRun publishes pass `--strip-debug-info` by default, including CoreLib and the framework. iOS, tvOS, and MacCatalyst already default to it. On wasm, linear address 0 is readable, so cDAC decoded garbage. A live run against a stripped browser image threw `BadImageFormatException: offset out of bounds` (`NativeReader.DecodeUnsigned` ← `NativeArray..ctor` ← `ReadyToRunJitManager.GetDebugInfo` ← `DebugInfo_1.GetMethodVarInfo`) instead of reporting that there was no debug info. On native targets, the same path fails with a read exception. ## Changes - `ReadyToRunJitManager.GetDebugInfo` returns `TargetPointer.Null` (with `hasFlagByte = false`) when `DebugInfoSection` is null, matching native. - `docs/design/datacontracts/ExecutionManager.md`: the R2R `GetDebugInfo` description now includes the null-section early return. - No caller changes were needed. `DebugInfo_1.HasDebugInfo`, `GetMethodNativeMap`, `GetMethodVarInfo`, and `GetAsyncSuspensionPoints` already treat a null debug-info pointer as "no debug info". The two map/var methods still compute `codeOffset`. ## Tests New test `ExecutionManagerTests.GetDebugInfo_R2R_NoDebugInfoSection_ReturnsNull` runs as a `[Theory]` over `StdArchAllVersions` (4 arch cases). It builds an R2R module whose `DebugInfoSection` is null and makes the low 4 KB of the address space readable as zeros, the way wasm linear memory is, so the unfixed code decodes instead of hitting a read fault. It asserts that: - `IExecutionManager.GetDebugInfo` returns `TargetPointer.Null` and `hasFlagByte == false` - `IDebugInfo.HasDebugInfo` is `false` - `GetMethodVarInfo` and `GetMethodNativeMap` return empty sequences with `codeOffset == 4` Results: - `./build.sh -s tools.cdactests -test`: passed. UnitTests 3236/3236, DataGeneratorTests 46/46, UsageTests 4/4 (no stale generated docs). - `./.dotnet/dotnet test src/native/managed/cdac/tests/UnitTests --filter "FullyQualifiedName~GetDebugInfo_R2R_NoDebugInfoSection"`: passed, 4/4. - Mutation check: I removed the null check and reran the same filtered command. It failed 4/4 with `System.BadImageFormatException : offset out of bounds` at `NativeReader.DecodeUnsigned` ← `NativeArray..ctor` ← `ReadyToRunJitManager.GetDebugInfo`, the same failure as the live wasm run. With the fix restored, it passes 4/4. This PR has a single concern. It leaves wasm stack-walk and variable-location work to #133890, #135044, and #135055. > [!NOTE] > This PR description was generated with GitHub Copilot. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Register the Wasm GC-info decoder using traits matching native
Wasm32GcInfoEncoding. The platform format uses six-bit code-length encodingand omits the fat-header interruptible-range count; interpreter decoding
continues to use its separate format.
Adds slim/fat-header tests that distinguish both formats and detect stream
misalignment, plus the matching contract documentation. No runtime descriptors
or DBI/EE changes are included.
Validation: managed cDAC build and 3,236 unit tests passed; generated contract
docs are up to date. All four new cases fail without registration, and the
fat-header case rejects an incorrect interruptible-range count.
NativeAOT publishing and live Wasm GC walks were not rerun for this patch.
Note
Prepared with GitHub Copilot.