Skip to content

Convert managed ilasm to use ANTLR actions instead of visiting the parse tree - #132346

Open
jkoritzinsky wants to merge 29 commits into
ilasm-more-testsfrom
ilasm-actions
Open

jkoritzinsky wants to merge 29 commits into
ilasm-more-testsfrom
ilasm-actions

Conversation

@jkoritzinsky

@jkoritzinsky jkoritzinsky commented Aug 14, 2026

Copy link
Copy Markdown
Member

Currently, managed ilasm builds a parse tree for the whole input .il file. This causes massive memory allocations (and OOMs on x86) for some of our larger test assemblies (HardwareIntrinsics AVX512 and HugeArray) that are on the scale of CoreLib. It also causes a massive slowdown due to the allocations.

This PR converts our parse tree visitor to instead be called as separate "actions" during grammar parsing, similar to how native ilasm does in the YACC file. Unlike native ilasm, all of the real logic is in C# files, and the logic in the CIL.g4 file is minimal (function calls into C#).

Because ANTLR4 only emits public types, we limit the exposed public API surface for (expected) internal consumers of the ILAssembler library (such as Roslyn for their test tree) to only the expected public API surface.

Performance

Measured Debug NativeAOT ilasm.exe builds from the visitor-based ilasm-more-tests base (89f324378bf3) and this PR's action branch (edca868dbae5) on the same Windows machine. Each input was produced by running checked ildasm -raweh -unicode over an existing CoreCLR test assembly, and each assembler invocation used -DET -DLL -DEBUG. Times and peak working sets are medians after warmup except for the single-run HugeField2 cases.

Architecture Input IL size Runs Visitor elapsed Actions elapsed Visitor peak working set Actions peak working set
x64 async/simple-eh 54,886 B 15 359.7 ms 316.4 ms (-12.0%) 49.8 MiB 38.6 MiB (-22.5%)
x64 HugeArray 9,558,004 B 5 4,614.8 ms 3,243.3 ms (-29.7%) 508.2 MiB 95.3 MiB (-81.2%)
x64 HugeField2 99,120,704 B 1 122.272 s 114.357 s (-6.5%) 3,603.8 MiB 395.8 MiB (-89.0%)
x86 async/simple-eh 54,886 B 10 344.1 ms 301.7 ms (-12.3%) 45.1 MiB 37.1 MiB (-17.7%)
x86 HugeArray 9,558,004 B 3 4,668.5 ms 3,158.8 ms (-32.3%) 304.8 MiB 119.9 MiB (-60.7%)
x86 HugeField2 99,120,704 B 1 OOM after 51.463 s 106.208 s (success) 1,058.0 MiB before failure 372.5 MiB

Peak working set was sampled every 100 ms. The x86 HugeField2 elapsed times are not directly comparable because the visitor process terminated with Insufficient memory to continue the execution of the program, while the actions process completed successfully.


Stack created with GitHub Stacks CLIGive Feedback 💬

Note

The benchmark section was prepared with GitHub Copilot assistance.

@azure-pipelines

Copy link
Copy Markdown
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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib
See info in area-owners.md if you want to be subscribed.

Comment thread src/tools/ilasm/README.md

```
./dotnet.sh build src/tools/ilasm/src/ILAssembler/gen
./dotnet.sh build src/tools/ilasm/src/ILAssembler

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that gen was dropped here?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the managed ILAssembler pipeline to avoid building a full ANTLR parse tree by switching to action-driven parsing (with an unbuffered token stream), and introduces an explicit reference-assembly “contract” to constrain the intended public API surface while keeping ANTLR-generated types out of the supported contract.

Changes:

  • Switch DocumentCompiler to parse with UnbufferedTokenStream, disable parse-tree construction, and drive compilation through GrammarActions.
  • Add a custom reference-assembly project under src/tools/ilasm/src/ILAssembler/ref/ and adjust tests to compile against implementation where needed.
  • Add extensive regression tests for error-tolerant parsing and state-leak prevention across documents/scopes.

Reviewed changes

Copilot reviewed 83 out of 88 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/tools/ilasm/tests/ILAssembler.Tests/TypedefTests.cs Updates custom-attribute assertions to match new emission/binding behavior.
src/tools/ilasm/tests/ILAssembler.Tests/SyntaxTests.cs Adds corpora for truncated/malformed input to ensure diagnostics are produced instead of exceptions.
src/tools/ilasm/tests/ILAssembler.Tests/SourceDirectiveTests.cs Adds multi-document and malformed language directive tests to ensure debug state doesn’t leak.
src/tools/ilasm/tests/ILAssembler.Tests/SecurityTests.cs Adds permissionset ordering/leak tests; expands coverage for structured security declarations.
src/tools/ilasm/tests/ILAssembler.Tests/MethodTests.cs Adds tests for override ownership and state isolation after malformed nested method headers.
src/tools/ilasm/tests/ILAssembler.Tests/InteropTests.cs Adds coverage for raw marshal blobs and “no state leak” scenarios across fields/documents.
src/tools/ilasm/tests/ILAssembler.Tests/ILAssembler.Tests.csproj Opts into implementation assembly for tests and links additional CLI helper code.
src/tools/ilasm/tests/ILAssembler.Tests/FieldTests.cs Adds tests ensuring trailing .custom directives bind correctly and don’t leak across scopes.
src/tools/ilasm/tests/ILAssembler.Tests/ExceptionHandlingTests.cs Adds ordering/bounds tests for EH region synthesis and catch-type resolution timing.
src/tools/ilasm/tests/ILAssembler.Tests/EventTests.cs Adds test for .event without an explicit type emitting a nil event type.
src/tools/ilasm/tests/ILAssembler.Tests/DocumentCompilerTests.cs Adds tests ensuring truncated/syntax-broken documents don’t leak namespace/type scopes into subsequent documents.
src/tools/ilasm/tests/ILAssembler.Tests/DataTests.cs Adds large bytearray/data declaration tests and leak-prevention tests across documents.
src/tools/ilasm/tests/ILAssembler.Tests/CommandLineTests.cs Adds a Windows sharing-violation retry test for output writing behavior.
src/tools/ilasm/tests/ILAssembler.Tests/AssemblyTests.cs Adds coverage for accepting “legacy library” assembly attribute variants.
src/tools/ilasm/src/ILAssembler/TypeName.cs Removes the old internal TypeName record (migrated into the new semantic model).
src/tools/ilasm/src/ILAssembler/StringCharStream.cs Adds a lightweight ICharStream over string to avoid AntlrInputStream overhead.
src/tools/ilasm/src/ILAssembler/ref/ILAssembler/SourceText.cs Adds contract type for document text + path.
src/tools/ilasm/src/ILAssembler/ref/ILAssembler/SourceSpan.cs Adds contract type for source spans.
src/tools/ilasm/src/ILAssembler/ref/ILAssembler/Options.cs Adds contract type defining compiler options.
src/tools/ilasm/src/ILAssembler/ref/ILAssembler/Location.cs Adds contract type for diagnostic locations.
src/tools/ilasm/src/ILAssembler/ref/ILAssembler/DocumentCompiler.cs Adds contract surface for the compiler entry points.
src/tools/ilasm/src/ILAssembler/ref/ILAssembler/Diagnostic.cs Adds contract surface for diagnostics and ids.
src/tools/ilasm/src/ILAssembler/ref/ILAssembler/CompilationResult.cs Adds contract surface for serializing compiler output.
src/tools/ilasm/src/ILAssembler/ref/ILAssembler.csproj Introduces the ref-contract project.
src/tools/ilasm/src/ILAssembler/PreprocessedTokenSource.cs Keeps root source on stack at EOF to support parser error recovery on truncated input.
src/tools/ilasm/src/ILAssembler/ILAssembler.csproj Hooks up the new contract project and excludes ref sources from implementation compile.
src/tools/ilasm/src/ILAssembler/gen/ilasm-generator.csproj Disables visitor generation and removes generated visitor/parser compile items from the generator build.
src/tools/ilasm/src/ILAssembler/EntityRegistry.cs Allows events to have an absent type and emits a nil handle accordingly.
src/tools/ilasm/src/ILAssembler/DocumentCompiler.cs Switches from visitor-based traversal to action-driven parsing with parse-tree disabled.
src/tools/ilasm/src/ILAssembler/CompatibilitySuppressions.xml Adds CP0001 suppressions for intentionally unsupported implementation-only public types.
src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Signatures.cs Adds strongly-typed semantic value model for signatures/types/member refs.
src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.MethodBodies.cs Adds semantic value model for method bodies (EH/debug/data/security/instruction values).
src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Marshalling.cs Adds semantic value model for marshalling/native type synthesis.
src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Manifest.cs Adds semantic value model for manifest-level constructs (assembly/resources/typedef/etc.).
src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.Declarations.cs Adds semantic value model for headers/builders used during action parsing.
src/tools/ilasm/src/ILAssembler/CILParser.SemanticValues.CustomAttributes.cs Adds semantic value model for custom attributes and serialization blobs.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.References.cs Implements action helpers for type-name construction and type resolution.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.Headers.Actions.cs Implements action helpers for namespace/class header parsing and attribute synthesis.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Types.cs Implements scope ownership/unwind to prevent state leaks across declarations.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.References.cs Implements action helpers for signature/member reference synthesis and materialization.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.cs Provides thin helpers connecting parser contexts to the materializers.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Security.cs Implements action-driven declarative security parsing and permission-set emission.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodHeaders.Generics.cs Implements generic parameter name/constraint materialization logic.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodHeaders.cs Implements action-driven method definition creation/signature emission.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.MethodBodies.cs Adds label validation and method-name parsing actions.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Members.Fields.cs Implements action-driven field declaration parsing and emission; tracks pending .custom binding.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.VTable.cs Implements vtfixup parsing; rejects raw .vtable blob support.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Typedefs.cs Implements typedef parsing and alias resolution materialization.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Resources.cs Implements action-driven manifest resource declaration materialization.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.References.cs Implements action-driven assembly reference header/declarations materialization.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Files.cs Implements action-driven file declarations and entrypoint tracking.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Assembly.cs Implements action-driven assembly definition parsing, keys, and directive application.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Literals.cs Implements action-driven parsing for identifiers, dotted names, numeric literals, etc.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Instructions.References.cs Implements instruction emission paths that require resolving types/members/tokens.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Declarations.Actions.cs Implements top-level declaration dispatch actions.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Debug.cs Implements action-driven .line/.language handling and sequence point emission.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Data.cs Implements streamed .data emission and reference fixups.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.CustomAttributes.Sequences.cs Implements custom-attribute “sequence” value emission.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.CustomAttributes.Actions.cs Implements custom-attribute descriptor parsing and blob materialization.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.cs Adds per-document lifecycle reset for action-driven compilation.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Conversions.cs Centralizes shared state/diagnostics and attribute application helpers.
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Bytes.cs Adds bytearray parsing that tolerates lexer ambiguities and avoids exceptions.
src/tools/ilasm/src/ilasm/Program.cs Switches output writing to use OutputFile.Write.
src/tools/ilasm/src/ilasm/OutputFile.cs Adds retrying output writer to mitigate transient Windows sharing violations.
src/tools/ilasm/README.md Updates documentation to describe the action-driven architecture and ref contract pattern.
src/tools/ilasm/ilasm.slnx Adds the ref contract project to the solution.

Comment thread src/tools/ilasm/src/ILAssembler/ILAssembler.csproj Outdated
Comment thread src/tools/ilasm/src/ILAssembler/ref/ILAssembler/Options.cs Outdated
Copilot AI review requested due to automatic review settings August 26, 2026 20:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 83 out of 88 changed files in this pull request and generated 1 comment.

Comment thread src/tools/ilasm/tests/ILAssembler.Tests/CommandLineTests.cs Outdated
Copilot AI review requested due to automatic review settings August 26, 2026 20:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 83 out of 88 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

src/tools/ilasm/src/ILAssembler/DocumentCompiler.cs:112

  • ParserErrorListener uses TokenSource.SourceName to look up SourceText in loadedDocuments. For synthetic/missing tokens created during error recovery, TokenSource may be PreprocessedTokenSource, whose SourceName can include include-chain decorations (and may not match the raw document keys). Using the underlying InputStream.SourceName aligns with Location.From(...) and should make document lookup robust for recovery tokens.

Comment thread src/tools/ilasm/src/ILAssembler/ref/ILAssembler/DocumentCompiler.cs Outdated
@jkoritzinsky
jkoritzinsky changed the base branch from ilasm-pseudoattributes to ilasm-more-tests August 26, 2026 22:04
Copilot AI review requested due to automatic review settings August 26, 2026 22:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 83 out of 88 changed files in this pull request and generated 3 comments.

Comment thread src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Manifest.Resources.cs Outdated
Comment thread src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Literals.cs
Comment thread src/tools/ilasm/src/ILAssembler/EntityRegistry.cs
Comment thread src/tools/ilasm/src/ilasm/OutputFile.cs Outdated
jkoritzinsky and others added 8 commits September 18, 2026 13:55
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 806a996a-9fcc-42b7-a902-cac954582b24
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 806a996a-9fcc-42b7-a902-cac954582b24
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 806a996a-9fcc-42b7-a902-cac954582b24
Remove the temporary managed-ilasm incompatibility markers now that the GrammarActions layer addresses the practical CI limits for these merged runners.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 806a996a-9fcc-42b7-a902-cac954582b24
Remove the temporary OOM-based managed-ilasm exclusions from the Directed runners, AVX512F tests, and HugeArray1 now that the GrammarActions layer avoids those memory failures.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 806a996a-9fcc-42b7-a902-cac954582b24
Remove the temporary memory exclusion in the GrammarActions layer, which avoids the bottom-layer managed ilasm memory limit.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 806a996a-9fcc-42b7-a902-cac954582b24
Port the bottom-layer encoder simplification to GrammarActions now that method bodies conservatively preserve InitLocals.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 806a996a-9fcc-42b7-a902-cac954582b24
The GrammarActions parser round-trips HugeField2 and hugeSimpleExpr1 within practical CI memory limits, so keep both covered on the action layer.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 806a996a-9fcc-42b7-a902-cac954582b24
Copilot AI review requested due to automatic review settings September 19, 2026 18:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The generator build configuration and undefined exception-label handling contain unresolved correctness issues.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 4 High severity · 2 Medium severity

Open (6)

Comment thread src/tools/ilasm/src/ILAssembler/gen/ilasm-generator.csproj
Fix octal parsing, raw vtable diagnostics, character stream seeking, and undefined exception label tracking with regression coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 806a996a-9fcc-42b7-a902-cac954582b24
Copilot AI review requested due to automatic review settings September 20, 2026 03:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

PDB document language metadata is derived from the final parser-wide language state instead of the language active for each source document.

Review effort: Lite
Findings: None

Resolved since last review (6)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Preserve per-document language when creating PDB metadata

src/​tools/​ilasm/​src/​ILAssembler/​Actions/​GrammarActions.BuildImage.cs:633

_currentLanguageGuid is mutable parser-wide state, but PDB metadata is built only after all documents have been parsed. If two source documents use different valid .language directives, every newly created Document row receives the language from the last directive rather than the language active when that document's sequence points were recorded. Capture the language with each method/document's debug information and use that value when creating the PDB document handle.

Capture the active language with each method's debug document so multi-document compilations emit the correct portable PDB language metadata.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 806a996a-9fcc-42b7-a902-cac954582b24
Copilot AI review requested due to automatic review settings September 20, 2026 03:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

malformed-token recovery can still invoke throwing parser action conversions instead of producing diagnostics.

Review effort: Lite
Findings: None

Previously missed (2)

In code that hasn't changed since last review

Medium severity Guard truefalse conversion after inline parser recovery

src/​tools/​ilasm/​src/​ILAssembler/​Actions/​GrammarActions.Literals.cs:198

The generated truefalse rule uses RecoverInline and then invokes this @after conversion even when recovery deleted an unexpected token. In a malformed initializer such as bool(bad true), token.Text can still be the offending text, so bool.Parse throws FormatException instead of allowing error-tolerant compilation to report a parser diagnostic and continue. Use a non-throwing conversion with a safe fallback here (and apply the same guard to the other single-token @after converters).\n\n> [!NOTE] This review comment was generated by GitHub Copilot.

Medium severity Prevent secAction conversion from throwing after recovery

src/​tools/​ilasm/​src/​ILAssembler/​Actions/​GrammarActions.Security.cs:33

secAction is another single-token rule whose generated @after action runs after RecoverInline. If recovery skips an unexpected token before a valid action (for example foo demand ...), ParseSecurityAction receives foo and reaches this UnreachableException, so malformed input throws rather than producing the parser diagnostic. Return a safe fallback or otherwise guard this conversion on invalid token text, consistently with the boolean conversion.

Use neutral fallback values when single-token grammar actions receive an invalid token during ANTLR recovery, with direct and end-to-end regression coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 806a996a-9fcc-42b7-a902-cac954582b24
Copilot AI review requested due to automatic review settings September 20, 2026 04:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Several accepted typedef and hexbyte paths currently produce false diagnostics, invalid output, or silently drop declarations.

Review effort: Lite
Findings: None

Previously missed (4)

In code that hasn't changed since last review

Medium severity Normalize 0x prefixes before parsing hexbyte values

src/​tools/​ilasm/​src/​ILAssembler/​Actions/​GrammarActions.Bytes.cs:40

hexbyte accepts INT32, and the lexer allows 0x-prefixed INT32 values, but the fallback parses the original text with AllowHexSpecifier, which does not accept the 0x prefix. Therefore an accepted value such as 0x123 falls through to zero instead of the documented masked byte value 0x23; normalize the prefix (and the signed form) before applying the fallback.

Medium severity Report diagnostics for unresolved custom-attribute aliases

src/​tools/​ilasm/​src/​ILAssembler/​Actions/​GrammarActions.CustomAttributes.Actions.cs:188

An unresolved custom-attribute alias returns null here without reporting DiagnosticIds.TypedefNotFound; every caller simply ignores the null result. Thus a syntactically valid use such as MissingAttributeAlias silently drops the attribute and produces no diagnostic, unlike the method, field, and type typedef paths. Pass the source location through this path and report the missing alias before returning.

Medium severity Resolve typedef aliases in structured custom-attribute arguments

src/​tools/​ilasm/​src/​ILAssembler/​Actions/​GrammarActions.CustomAttributes.Serialization.cs:258

This branch reports TypedefNotFound for every TypedefSerializationTypeValue without consulting the typedef table. The grammar explicitly accepts aliases in serializTypeElement, so a declared alias such as .typedef int32 as MyInt cannot be used in a structured custom-attribute named argument: the emitted serialization-type blob is empty and compilation reports a false error. Resolve the alias (or reject this syntax in the grammar) and add a regression test.

Medium severity Resolve typedef aliases used as native marshal types

src/​tools/​ilasm/​src/​ILAssembler/​Actions/​GrammarActions.Marshalling.Actions.cs:307

The grammar accepts a dotted-name typedef as a native marshal type, but this materialization path unconditionally reports TypedefNotFound and emits an empty blob. Consequently, even a declared alias used as marshal(Alias) is unusable and can leave the field or parameter with an invalid marshalling descriptor. Either resolve the alias here or remove the accepted typedef form and report a deliberate unsupported-syntax diagnostic.

Handle prefixed hex bytes, report missing custom attribute aliases, and resolve type aliases in structured attributes and marshal descriptors.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 806a996a-9fcc-42b7-a902-cac954582b24
Copilot AI review requested due to automatic review settings September 20, 2026 04:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The broad parser rewrite changes error recovery and metadata construction, while its claimed performance gains lack representative measurements.

Review effort: Lite
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Low severity Add benchmarks validating streaming parser memory and performance

src/​tools/​ilasm/​src/​ILAssembler/​DocumentCompiler.cs:59

This switches the compiler to the new streaming/action path that is intended to eliminate the large allocation and slowdown described for the AVX512/HugeArray inputs, but the PR provides no before/after measurements. Please include representative peak memory and elapsed-time results (especially x86, where OOMs are reported) and confirm that the action path does not regress ordinary IL files before relying on this high-risk parser rewrite.

[!NOTE] This review comment was generated by GitHub Copilot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants