Repository navigation
Conversation
|
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. |
AndyAyersMS
left a comment
There was a problem hiding this comment.
Does this handle describing locals that are on the linear stack? Last I looked those SP/FP based encodings were wonky for Wasm.
Note the exact Wasm locals that hold SP/FP can vary and may even vary between main method and its funclets, which I doubt we can encode.
An easy test for this is to look at any GC-typed local, these are always on the linear stack.
|
@lewing, what value does this debugging data provide? Given my understanding that debugging is likely to only be supported on mostly interpreted scenarios, why should we make this correct for R2R scenarios. (I expect that nativeaot will make good use of this data, so I think overall its goodness, but I don't see why its particularly useful for R2RDump.) |
|
It came out of the DWARF discussion and I'm working on something in the nesm debugger and I'm trying to plumb out more info, it is isn't meant to be user facing currently. |
Preserve variable debug information produced by RyuJIT for ReadyToRun WebAssembly code, including scope ranges across relooper block ordering and packed wasm local register locations. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The end-to-end variable-debug-info validation exposed the hidden wasm portable-entry-pointer argument as a source local. The argument is appended after user arguments, but unlike the wasm stack-pointer argument it was not recorded or excluded by compMap2ILvarNum. AddDoubles therefore reported the hidden i32 argument as source local 0, alongside the real f64 parameters. Record the argument's local number when it is created, map it to UNKNOWN_ILNUM, and account for it when mapping later internal locals back to IL variable numbers. Replace the count-only wasm R2R checks with complete exact records for the AddDoubles parameters and SumWithFinally local: variable identity, native range, location kind, packed wasm local, and frame-pointer-relative offset. Mutate the local-index bits of one packed register and prove the exact oracle rejects the corrupted record. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
8553c54 to
3979515
Compare
|
I opened #133890 (which includes these commits) with cDAC consumer side changes |
Define the packed WASM debug-register bit layout in ICorDebugInfo and have the JIT derive its register masks from that shared encoding contract. Assert that the JIT register representation and WasmValueType count remain compatible with the debug-info format. Document that the static ReadyToRun reader's compiled-in shift must move with a versioned R2R debug-info format change, since it has no live target descriptor from which to discover a different layout. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Publish the shared WASM register type shift and value-type count through the target data descriptor so version-skewed readers can reject incompatible variable debug information. Document the producer-owned encoding and extend the static ReadyToRun reader coverage for reserved and unsupported value-type codes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add a no-opt object local that remains live across a GC call in a finally funclet. Assert its IL class type, complete ReadyToRun variable tuples, frame-relative GC slot, and safepoint coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add exact optimized tracked-variable coverage, frame-base ABI variations including localloc and funclets, and same-type GC slot identity with a legitimate null reference. Pin the current stack VarLoc base encoding and document that absolute frame reconstruction is independent of unstable wasm local indices. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 51b56d7e-45e5-464d-8c2b-78c744680ff8
|
@AndyAyersMS yes, locals that live on the linear stack are covered now. They're encoded as The current tests cover:
One limitation, the same as on other targets: scope info is still not reported inside funclets ( Note This reply was drafted with GitHub Copilot. |
Encode wasm locals in debug info as the local index biased past the reserved RegNum values instead of packing the JIT value type, matching other targets where the type is implied by the variable. Remove the now-unneeded cDAC descriptor globals. Wasm is only compiled ahead of time, where every variable scope covers the whole method, so open all scopes in the first emitted block instead of scanning per block. Update codegen-shape test pins for drift from main. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 51b56d7e-45e5-464d-8c2b-78c744680ff8
Replace exact native offsets, frame sizes, local counts, and instruction byte pins with checks of the debug-info contract: register records name a declared wasm local of the expected type, stack records are frame-relative and their slots are accessed, parameters are homed after their local range, ranges do not overlap, and GC locals cover the safepoint. Unrelated JIT codegen changes no longer break the test. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 51b56d7e-45e5-464d-8c2b-78c744680ff8
Add an optimized Vector128 method and verify its parameters and local are recorded as wasm v128 locals. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 51b56d7e-45e5-464d-8c2b-78c744680ff8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 51b56d7e-45e5-464d-8c2b-78c744680ff8
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 51b56d7e-45e5-464d-8c2b-78c744680ff8
…optional in IsVersionable (#135430) Two `IDebugInfo.GetMethodVarInfo` fixes for targets that use portable entry points, such as CoreCLR WebAssembly. ### `GetMethodVarInfo` code offset `codeOffset` was computed relative to `ICodeVersions.GetNativeCode`, which is the method's **entry point**. On portable-entrypoint targets that is not the code start, so the offset was wrong. The entry point is now mapped with `IExecutionManager.GetDiagnosticCodeStartFromEntryPoint` (#134827), the cDAC mirror of the runtime's `GetDiagnosticCodeStartFromEntryPoint`. It returns: - the interpreter bytecode for an interpreted method; - the R2R virtual IP for a portable entry point; - otherwise the address unchanged. Native `ClrDataAccess::GetMethodVarInfo` maps only interpreter entry points (`GetInterpreterCodeFromEntryPointIfPresent`). The native DAC does not support wasm, so the R2R portable-entrypoint case has no native DAC behavior to compare against. ### `IsVersionable` without the ReJIT contract `GetMethodVarInfo` → `GetNativeCodeVersionForIP` → `IsVersionable` required the `ReJIT` contract. The runtime advertises that contract only under `PROFILING_SUPPORTED`, which is off on wasm, so `GetMethodVarInfo` threw `ContractMissingException` there. Wasm also lacks `FEATURE_REJIT`, so native `IsEligibleForReJIT` is false. A missing contract is now treated as not ReJIT-eligible, using `TryGetContract`. An alternative is to advertise `ReJIT` on wasm, with `IsEnabled()` returning false; I'm happy to switch if reviewers prefer that. Separately, `CoreCLRContracts.ValidateForDataAccess` still requires `IReJIT`, so on wasm the official DAC entry point would fail validation. That is not changed here and needs its own follow-up. ### Validation - `./build.sh -s tools.cdactests -test`: passed (Unit tests 3293/3293, DataGenerator 46/46, Usage 4/4). - `generate-docs.ps1 -Check`: up to date. - New tests: - `GetMethodVarInfo_CodeOffsetIsRelativeToDiagnosticCodeStart` (theory: identity mapping, and an entry point mapped to a different code start). - `IsVersionable_ReJITContractOptional` (theory: no ReJIT contract, ReJIT disabled, ReJIT enabled). - `GetDebugInfo_R2R_NoDebugInfoSection_ReturnsNull` now registers `FeatureFlags` and `PrecodeStubs`, which the mapping requires. - Mutation checks, each confirmed applied by diff and restored afterwards: - Revert to `cv.GetNativeCode(ncvh)` → `GetMethodVarInfo_CodeOffset…(0x400000→0x80010100)` fails with `Assert.Equal`. - Revert to `_target.Contracts.ReJIT.IsEnabled()` → `IsVersionable_ReJITContractOptional(advertiseReJIT: False)` fails with `ContractMissingException`. - I also checked against a live CoreCLR browser-wasm target with R2R. Entry point `0x41ADC1C` maps to diagnostic start `0x800104B3`, and `GetMethodVarInfo` returns offset `0x2`. That is the same result as a wasm-only offset computation used in an earlier prototype. That target used a producer-side branch with variable debug info (#133086); there is no automated test for this case. > [!NOTE] > This PR description was generated with GitHub Copilot. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Re-enables RyuJIT variable debug info for ReadyToRun WebAssembly code, which was disabled before wasm locals could be encoded, and defines the encoding that readers consume.
localIndex + WASM_LOCAL_REGNUM_BASE(3); values 0–2 keep their meanings (REGNUM_PC,REGNUM_COUNT,REGNUM_AMBIENT_SP).REG_FPBASE=REG_SPBASE=REGNUM_AMBIENT_SPon wasm), so they are slots relative to the logical frame, which readers reconstruct from the stack walk.getVarsalways reports method-wide scopes, and wasm block order doesn't follow IL order.Both constants are fixed for DebugInfo contract
c1and documented inDebugInfo.md. Changing either needs a new contract version and, because R2R images persist the encoding, a ReadyToRun format version change. Browser and WASI publishes strip debug info by default (#134690), so these records reach an image only withPublishReadyToRunStripDebugInfo=false; generated code is unchanged. The cDAC consumer is #133890.Test coverage and follow-ups
WasmWebcilModulechecks invariants rather than exact codegen: register records name declared locals with the expected wasm types, stack records use base 2 without overlapping ranges, recorded frame slots are actually accessed (including from a finally funclet), and GC locals' ranges cover the safepoint. Removing the+3bias makes it fail.Follow-ups: NativeAOT DWARF (#135740) can describe locals with
DW_OP_WASM_location(local index = register − 3); frame-slot variables additionally need the engine local holding the frame pointer, which this format doesn't record. #134808 plans R2R DWARF on top of these records.Note
This pull request description was updated with the assistance of GitHub Copilot.