Make all entries in WASM tables SymbolDefinitions#130920
Draft
jtschuster wants to merge 4 commits into
Draft
Conversation
Contributor
|
Tagging @dotnet/jit-contrib for JIT-EE GUID update |
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the WASM object writer to assign and resolve WASM structural indices (function/type/table) via a shared symbol-index table, and extends SuperPMI recording support for getWasmWellKnownGlobals alongside a JIT/EE interface GUID bump.
Changes:
- Replace ad-hoc
_uniqueSymbols/_uniqueSignaturesbookkeeping with per-section symbol index assignment and use it to self-resolve WASM index relocations. - Update well-known WASM global symbol names for
READYTORUNand wire them into default import creation. - Add SuperPMI record support for
GetWasmWellKnownGlobalsand updateJITEEVersionIdentifier.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/tools/superpmi/superpmi-shared/methodcontext.h | Adds a recGetWasmWellKnownGlobals declaration (currently duplicated in the header). |
| src/coreclr/tools/Common/Compiler/ObjectWriter/WasmObjectWriter.cs | Centralizes symbol index assignment and uses it for WASM index relocations; updates exports/elements counts to use derived method count. |
| src/coreclr/tools/Common/Compiler/ObjectWriter/ObjectWriter.cs | Makes EmitSymbolDefinition virtual to allow format-specific overrides. |
| src/coreclr/tools/Common/Compiler/DependencyAnalysis/WasmWellKnownGlobalSymbolNode.cs | Switches well-known global import names based on READYTORUN. |
| src/coreclr/inc/jiteeversionguid.h | Updates the JIT/EE interface version GUID. |
And use the symbol definitions for reloc lookups. This creates a single location for all named entries in each section of the module, and makes _uniqueSignatures, _uniqueSymbols, and _methodCount unnecessary.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2b88048c-7bbb-40bb-ae53-e990e71779c0
jtschuster
force-pushed
the
jtschuster-wasm-table-symbols
branch
from
July 16, 2026 20:34
d2f13bb to
2b84bf9
Compare
Comment on lines
1092
to
1099
| SectionWriter typeSectionWriter = GetOrCreateSection(ObjectNodeSection.WasmTypeSection); | ||
| byte[] encodedSignature = new byte[signature.EncodeSize()]; | ||
| signature.Encode(encodedSignature); | ||
| typeSectionWriter.EmitData(encodedSignature); | ||
| // Assigns the type index (via the EmitSymbolDefinition override) and registers the | ||
| // signature in the defined-symbol table used during relocation resolution. | ||
| typeSectionWriter.EmitSymbolDefinition(signatureKey); | ||
|
|
Comment on lines
+846
to
+847
| private int RegisterFunctionSymbol(Utf8String name) => | ||
| GetOrCreateSymbolIndex(name, GetOrCreateSection(WasmObjectNodeSection.FunctionSection).SectionIndex); |
| Debug.Assert(bytesWritten == encodeSize); | ||
| writer.Buffer.Advance((int)bytesWritten); | ||
|
|
||
| writer.EmitSymbolDefinition(new Utf8String(import.Name)); |
| if (!_wasmSymbolDefinitions.TryGetValue(reloc.SymbolName, out var symbol)) | ||
| { | ||
| throw new InvalidDataException($"Type signature symbol definition '{reloc.SymbolName}' not found"); | ||
| throw new NotImplementedException($"No wasm index registered for symbol '{reloc.SymbolName}' (relocation {reloc.Type})."); |
Open
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.