JIT: retype some return expressions
authorAndy Ayers <andya@microsoft.com>
Sat, 17 Nov 2018 18:26:25 +0000 (10:26 -0800)
committerAndy Ayers <andya@microsoft.com>
Tue, 27 Nov 2018 18:47:41 +0000 (10:47 -0800)
commit1353404095e1ab886ff3c028d75218081d428e36
tree8b47bc8b36f7817241f4b0dd5aca01e69d8ff508
parent12d7b9a19162f6fa11f9a4f49332e41b2a827da7
JIT: retype some return expressions

The jit is fairly tolerant of byref/native int mismatches for inline arguments
and return values. And some of the new unsafe helpers do this kind of
reinterpretation across call boundaries as well. This sometimes leads the jit
to lose track of byrefs.

A general fix for this is likely somewhat involved. For now we simply detect if
we're about to lose track of a byref when substituting a particular kind of
return expression, and retype the expression to a byref.

Fixes dotnet/coreclr#21051.

Commit migrated from https://github.com/dotnet/coreclr/commit/3bc2f7a800498135a1c1575b01d0f5d1113d9acd
src/coreclr/src/jit/flowgraph.cpp
src/libraries/System.Private.CoreLib/src/System/Globalization/CharUnicodeInfo.cs