Skip to content

JIT: fix build breaks with EMIT_TRACK_STACK_DEPTH=0 - #121997

Merged
AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:FixCompileForEmitTrackStackDepth0
Nov 27, 2025
Merged

AndyAyersMS merged 1 commit into
dotnet:mainfrom
AndyAyersMS:FixCompileForEmitTrackStackDepth0

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

And then set it to 0 for Wasm.

Copilot AI review requested due to automatic review settings November 26, 2025 19:20
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 26, 2025
@AndyAyersMS

Copy link
Copy Markdown
Member Author

@dotnet/jit-contrib @SingleAccretion PTAL

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@kg

kg commented Nov 26, 2025

Copy link
Copy Markdown
Contributor

LGTM. Do we potentially want to track stack depth later though for when we're using the linear memory stack?

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 PR fixes build breaks that occur when EMIT_TRACK_STACK_DEPTH is set to 0, then sets it to 0 for the WebAssembly target. WebAssembly doesn't need to track argument pushes/pops on the stack, so disabling this tracking is appropriate for the platform.

  • Moved emitRecordGCcall() and emitLastInsIsCallWithGC() declarations outside the EMIT_TRACK_STACK_DEPTH conditional guard in emit.h
  • Adjusted the #endif placement in emit.cpp to keep GC call recording functions available when EMIT_TRACK_STACK_DEPTH=0
  • Set EMIT_TRACK_STACK_DEPTH to 0 for WASM in targetwasm.h with an updated comment

Reviewed changes

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

File Description
src/coreclr/jit/targetwasm.h Changed EMIT_TRACK_STACK_DEPTH from 1 to 0 and updated the comment to clarify WASM doesn't need to track arg pushes/pops
src/coreclr/jit/emit.h Moved emitRecordGCcall() and emitLastInsIsCallWithGC() declarations outside the EMIT_TRACK_STACK_DEPTH guard so they're available for GC tracking even when stack depth tracking is disabled
src/coreclr/jit/emit.cpp Moved the #endif // EMIT_TRACK_STACK_DEPTH earlier to keep only stack-tracking functions guarded, while making GC call recording functions available unconditionally

@SingleAccretion

Copy link
Copy Markdown
Contributor

LGTM. Do we potentially want to track stack depth later though for when we're using the linear memory stack?

I don't think so. The code this define relates to is only needed for EMIT_RECORD_GCINFO == 1 (and then, in principle, only for FEATURE_FIXED_OUT_ARGS == 0 aka x86, but there are apparently some implementation entanglement issues with that). WASM doesn't have push so there is no big reason to do a calling convention where "the stack pointer" would move outside the prolog.

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

Labels

arch-wasm WebAssembly architecture area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants