Fix for bugs related to clasifying System.TypedReference.
authorLubomir Litchev <lubol@microsoft.com>
Tue, 26 Jan 2016 06:23:31 +0000 (22:23 -0800)
committerLubomir Litchev <lubol@microsoft.com>
Tue, 2 Feb 2016 00:32:13 +0000 (16:32 -0800)
commitced8b62e9bee1ab3e3a5e6a519bdba3024245ca6
tree8e24373ec541a98bd0735273ef03e1faf27003ad
parent2d93d77eaa87db87afbd93ed99e79095d6783020
Fix for bugs related to clasifying System.TypedReference.

It was a long standing assumption in the Jit that a field of a struct can
never be of ByRef type. It turns out this assumption is not entirely
holding.
The System.TypedReference is a very special type that is a struct, defined
to have two IntPtr fields. When the VM instantiates this type it changes
the type of the first field to ByRef.
This change closes a GC hole in the passing this struct by value on the
stack. It adds support to the classification algorithm for ByRef
references. It also uses the tree types for generating the code that
places struct field on the stack by value for passin to a callee.

The handling of GT_RETURN in the codegenxarch.cpp has been extracted as a
separate routine - genReturn. In case of struct return (multi-register
struct return or an implicit retBuf return, it delegates to the
genStructReturn method. This is a refactoring as well as making
sure that GT_RETFILT is handled properly - the return type of it is always
bool or void for the last statement of a finally block.

More feedback addressed.
15 files changed:
src/inc/corinfo.h
src/jit/codegencommon.cpp
src/jit/codegenlinear.h
src/jit/codegenxarch.cpp
src/jit/compiler.cpp
src/jit/ee_il_dll.cpp
src/jit/lclvars.cpp
src/jit/lowerxarch.cpp
src/jit/morph.cpp
src/vm/argdestination.h
src/vm/callingconvention.h
src/vm/jitinterface.cpp
src/vm/methodtable.cpp
src/vm/methodtable.h
src/vm/threadsuspend.cpp