JIT: Fix ordering of type initialization and stsfld (#80485)
authorMark Plesko <markples@microsoft.com>
Mon, 27 Mar 2023 09:11:16 +0000 (02:11 -0700)
committerGitHub <noreply@github.com>
Mon, 27 Mar 2023 09:11:16 +0000 (02:11 -0700)
commite6e252b9d5ba34d11a6c73ba48f22849a900c316
treee53a28a50104762846abbc420f46be5db6546991
parent5856dde4d0b61f3c0bbc83c92828606fd252f13b
JIT: Fix ordering of type initialization and stsfld  (#80485)

Insertion of the type initializer before the tree for a stsfld could reorder them inappropriately. This includes those computation in the spill check.

Fixes #72354.
src/coreclr/jit/importer.cpp
src/tests/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite.cs [new file with mode: 0644]
src/tests/Loader/classloader/TypeInitialization/CctorsWithSideEffects/CctorForWrite.csproj [new file with mode: 0644]