Fix poisoning for very large structs (#61521)
authorJakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
Tue, 16 Nov 2021 12:49:58 +0000 (13:49 +0100)
committerGitHub <noreply@github.com>
Tue, 16 Nov 2021 12:49:58 +0000 (13:49 +0100)
commit9a9a4f34ff79167a6b7649b85d9808a10fbba10a
tree5c725a5435dec713d8a4f11166f306b3f8f6d396
parentbd0c543192682ffe6ab86d73aea943a5e71b7baa
Fix poisoning for very large structs (#61521)

For very large structs poisoning could end up generating instructions
requiring larger local var offsets than we can handle which would hit an
IMPL_LIMIT that throws InvalidProgramException. Switch to using rep
stosd (x86/x64)/memset helper (other platforms) when a local needs more
than a certain number of mov instructions to poison.

Also includes a register allocator change to mark killed registers as
modified in addRefsForPhysRegMask instead of by the (usually) calling
function, since this function is used directly in the change.
src/coreclr/jit/codegencommon.cpp
src/coreclr/jit/lsrabuild.cpp
src/tests/JIT/Directed/debugging/poison.cs