Repository navigation
Closed
Labels
arch-wasmWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone
Description
Using repro instructions from #125199 with
--singlemethodtypename:"System.Runtime.Intrinsics.Vector256"
--singlemethodname:"Create"
--singlemethodindex:17
we try and put too much code into the prolog IG
ebug: New V10 debug range: first
IN00c1: local.cnt 0
IN00c2: local.get 0
IN00c3: i32.const 272
IN00c4: i32.sub
IN00c5: local.set 0
*************** In genHomeRegisterParams()
IN00c6: local.get 0
IN00c7: local.get 1
IN00c8: i32.store 0 268 ;; V01
IN00c9: local.get 0
IN00ca: local.get 2
IN00cb: i32.store 0 264 ;; V02
IN00cc: local.get 0
IN00cd: local.get 3
IN00ce: i32.store 0 260 ;; V03
IN00cf: local.get 0
IN00d0: local.get 4
IN00d1: i32.store 0 256 ;; V04
IN00d2: local.get 0
IN00d3: local.get 5
IN00d4: i32.store 0 252 ;; V05
IN00d5: local.get 0
IN00d6: local.get 6
IN00d7: i32.store 0 248 ;; V06
IN00d8: local.get 0
IN00d9: local.get 7
IN00da: i32.store 0 244 ;; V07
IN00db: local.get 0
IN00dc: local.get 8
IN00dd: i32.store 0 240 ;; V08
IN00de: local.get 0
IN00df: local.get 9
IN00e0: i32.store 0 236 ;; V09
IN00e1: local.get 0
IN00e2: local.get 10
IN00e3: i32.store 0 232 ;; V10
IN00e4: local.get 0
IN00e5: local.get 11
IN00e6: i32.store 0 228 ;; V11
IN00e7: local.get 0
IN00e8: local.get 12
IN00e9: i32.store 0 224 ;; V12
IN00ea: local.get 0
IN00eb: local.get 13
IN00ec: i32.store 0 220 ;; V13
IN00ed: local.get 0
IN00ee: local.get 14
IN00ef: i32.store 0 216 ;; V14
IN00f0: local.get 0
IN00f1: local.get 15
IN00f2: i32.store 0 212 ;; V15
IN00f3: local.get 0
IN00f4: local.get 16
IN00f5: i32.store 0 208 ;; V16
IN00f6: local.get 0
IN00f7: local.get 17
IN00f8: i32.store 0 204 ;; V17
IN00f9: local.get 0
IN00fa: local.get 18
IN00fb: i32.store 0 200 ;; V18
IN00fc: local.get 0
IN00fd: local.get 19
IN00fe: i32.store 0 196 ;; V19
IN00ff: local.get 0
IN0100: local.get 20
IN0101: i32.store 0 192 ;; V20
IN0102: local.get 0
IN0103: local.get 21
IN0104: i32.store 0 188 ;; V21
IN0105: local.get 0
IN0106: local.get 22
IN0107: i32.store 0 184 ;; V22
IN0108: local.get 0
IN0109: local.get 23
IN010a: i32.store 0 180 ;; V23
IN010b: local.get 0
IN010c: local.get 24
IN010d: i32.store 0 176 ;; V24
IN010e: local.get 0
IN010f: local.get 25
IN0110: i32.store 0 172 ;; V25
IN0111: local.get 0
IN0112: local.get 26
IN0113: i32.store 0 168 ;; V26
IN0114: local.get 0
IN0115: local.get 27
IN0116: i32.store 0 164 ;; V27
IN0117: local.get 0
IN0118: local.get 28
C:\repos\runtime2\src\coreclr\jit\emit.cpp:9875
Assertion failed 'emitCurIG != emitPrologIG' in 'System.Runtime.Intrinsics.Vector256:Create(byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte,byte):System.Runtime.Intrinsics.Vector256`1[byte]' during 'Generate code' (IL size 81; hash 0x4b683611; MinOpts)
Metadata
Metadata
Assignees
Labels
arch-wasmWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Activity
dotnet-policy-service commentedon Mar 5, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
jakobbotsch commentedon Mar 5, 2026
Swift has a similar problem. It works around this backend limitation on the prolog size by doing it in the first basic block:
runtime/src/coreclr/jit/codegenlinear.cpp
Lines 403 to 411 in 0a4314b
kg commentedon Mar 10, 2026
I see multiple ways to fix this:
I feel like for now we should just do option 1, and once that ceases to be enough, we should do 2. I don't think we should do 3.
jakobbotsch commentedon Mar 10, 2026
Swift does the same as I pointed at above. I don't think it would be particularly weird to do it that way.
kg commentedon Mar 10, 2026
We would have to move the genHomeRegisterParams call out of its current position, or redefine what genHomeRegisterParams does, I think? This isn't limited to a specific subset of struct parameters for a specific calling convention.
jakobbotsch commentedon Mar 10, 2026
genHomeRegisterParamsis already different for wasm. It does not seem like a huge issue to make it do nothing and call the wasm specific handling next to the Swift handling instead.kg commentedon Mar 10, 2026
Will try that, thanks. We don't have good test coverage yet so I'm wary of making big changes without someone who knows the JIT better saying 'that should work'.
jakobbotsch commentedon Mar 10, 2026
To be clear I think 2 is a better solution, and if implemented we would move the Swift handling back into the prolog too. But as you point out, 1 is not much of a solution. At least with 3 we shouldn't need to come back to this problem (famous last words).
[Wasm RyuJIT] Move genHomeRegisterParams' output out of the prolog (#…
[Wasm RyuJIT] Move genHomeRegisterParams' output out of the prolog (#…
dotnet-policy-service commentedon Mar 15, 2026
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.
AndyAyersMS commentedon May 1, 2026
Allowing multiple prolog IGs: #126552
[RyuJit/WASM] Remove the special prolog handling (#128721)
[RyuJit/WASM] Remove the special prolog handling (#128721)