Skip to content

Add ReadyToRun JIT helper roots metadata - #134092

Merged
davidwrighton merged 6 commits into
mainfrom
copilot/create-jit-helpers-root
Sep 20, 2026
Merged

davidwrighton merged 6 commits into
mainfrom
copilot/create-jit-helpers-root

Conversation

Copilot AI commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Root CoreLib JIT helper implementation methods during ReadyToRun compilation.

Note

This PR description was generated by GitHub Copilot.

Copilot AI and others added 2 commits September 16, 2026 17:24
Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>
Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

Comment thread src/coreclr/tools/Common/Internal/Runtime/ModuleHeaders.cs Outdated
@davidwrighton

Copy link
Copy Markdown
Member

@copilot Please address Jan's feedback. Do not add a check to ensure all jit helpers are handled. HOWEVER, add a comment to jithelpers.h that instructs that future changes of the set of jit helpers should update RootJitHelperMethods

Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>

Copilot AI commented Sep 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please address Jan's feedback. Do not add a check to ensure all jit helpers are handled. HOWEVER, add a comment to jithelpers.h that instructs that future changes of the set of jit helpers sh...

Addressed in 99027aa by removing the extra checking and adding the jithelpers.h maintenance comment for RootJitHelperMethods.

@davidwrighton
davidwrighton marked this pull request as ready for review September 16, 2026 23:30
Copilot AI lite review requested due to automatic review settings September 16, 2026 23:30
@davidwrighton
davidwrighton enabled auto-merge (squash) September 16, 2026 23:31
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

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.

🟡 Changes recommended

Address mapping synchronization and target-specific helper rooting concerns.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds ReadyToRun rooting for CoreLib JIT helper implementations and documents synchronization with jithelpers.h.

Changes:

  • Roots helper methods during ReadyToRun compilation.
  • Adds maintenance guidance for the helper mapping.
File summaries
File Summary
src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs Adds JIT helper method rooting logic.
src/coreclr/inc/jithelpers.h Documents synchronization requirements for the helper mapping.
Review details

Suppressed comments (1)

src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs:1330

  • These roots are unconditional, but the corresponding entries in jithelpers.h are target-dependent: DIV/MOD/UDIV/UMOD are only dynamic helpers on 32-bit ARM, and the 64-bit division/modulo helpers are only dynamic on targets other than Windows x86 (jithelpers.h:43-87). As a result, every CoreLib ReadyToRun image now compiles and retains implementations that are not JIT helpers for the current target, increasing code size and making the root set differ from the platform-specific helper set. Gate these roots with the same target conditions, or derive the list from the target-specific helper definitions.
            RootJitHelperMethod(graph, "System"u8, "Math"u8, "MultiplyChecked");
            RootJitHelperMethod(graph, "System"u8, "Math"u8, "DivInt32");
            RootJitHelperMethod(graph, "System"u8, "Math"u8, "DivUInt32");
            RootJitHelperMethod(graph, "System"u8, "Math"u8, "DivInt64");
            RootJitHelperMethod(graph, "System"u8, "Math"u8, "DivUInt64");
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

@pavelsavara

Copy link
Copy Markdown
Member

Looks like #134200

image

Log

RuntimeError: null function or function signature mismatch
    at WasmInterpreterToR2RThunk(iTp) (wasm://wasm/0981ff36:wasm-function[63123]:0x11250b6)
    at wasm://wasm/01bcb346:wasm-function[9492]:0x3f2b69
    at wasm://wasm/01bcb346:wasm-function[9510]:0x3f586f
    at wasm://wasm/01bcb346:wasm-function[7717]:0x31e8bd
    at wasm://wasm/01bcb346:wasm-function[5967]:0x2483b6
    at wasm://wasm/01bcb346:wasm-function[5970]:0x24935a
    at wasm://wasm/01bcb346:wasm-function[5972]:0x249399
    at WasmR2RToInterpreterThunk(iip) (wasm://wasm/0981ff36:wasm-function[62049]:0x1111027)
    at S_P_CoreLib_System_AppContext__Setup (wasm://wasm/0981ff36:wasm-function[306]:0x54ebe)
    at wasm://wasm/01bcb346:wasm-function[6236]:0x26d0fe

@jkotas

jkotas commented Sep 18, 2026

Copy link
Copy Markdown
Member

Looks like #134200

I do not see these failures on other PRs. I have disabled auto-merge until this is investigated.

davidwrighton and others added 2 commits September 18, 2026 18:25
Root managed JIT helper methods through the compilation root pipeline so they are tracked in the ReadyToRun method index space before WebAssembly function indices are emitted.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings September 19, 2026 00:49
Point the jithelpers.h maintenance note at the new ReadyToRun compilation root provider.

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

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 advertised JitHelperRoots section emission, consumption, and validation are not implemented.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)

@jkotas jkotas left a comment

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.

Root managed JIT helper methods through the compilation root pipeline so they are tracked in the ReadyToRun method index space before WebAssembly function indices are emitted.

How do we feel about this ordering dependency?

@davidwrighton
davidwrighton merged commit db48eab into main Sep 20, 2026
108 of 111 checks passed
@davidwrighton
davidwrighton deleted the copilot/create-jit-helpers-root branch September 20, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants