[ARM/Linux] Fix incorrect return marshaling in PInvoke stub (dotnet/coreclr#5010)
authorJonghyun Park <parjong@gmail.com>
Wed, 25 May 2016 02:23:51 +0000 (11:23 +0900)
committerJan Kotas <jkotas@microsoft.com>
Wed, 25 May 2016 02:23:51 +0000 (19:23 -0700)
commit298b1e04c53563e92bf14b864890ffe625e85d01
tree722e21abc479cc99bfaf6d40cfe464257248cd18
parent69db30793f43f65bb23dd3069f11cdd21a6ae039
[ARM/Linux] Fix incorrect return marshaling in PInvoke stub (dotnet/coreclr#5010)

* Revises compMethodReturnsMultiRegRetType for ARM

For ARM, the current implementation of 'compMethodReturnsMultiRegRetType'
always returns false.

Unfortunately, this behavior is inconsistent with JIT importer. JIT impoter
attempts to merge various return statements as one statement via inserting
an assignment statement just before each return statement if there are more
than 4 returns.

If the method of interest has a return value, then JIT importer
introduces a local temporary variable, and use it to return value.

Due to the above implementation, JIT importer never generates a return
variable, which results in assertion violation insider JIT morph, which
is discussed in dotnet/coreclr#5009.

This commit attempts to fix dotnet/coreclr#5009 via implementing 'compMethodReturnsMultiRegRetType'
for ARM.

* Uses compRetNativeType instead of compRetType

* Fix typo '_TARGET_ARM' as '_TARGET_ARM_'

Commit migrated from https://github.com/dotnet/coreclr/commit/bcc8495653c03b8ba4bb61fbd4828cac90789c4e
src/coreclr/src/jit/compiler.h
src/coreclr/src/vm/ilmarshalers.h