diff options
author | Jeremy Koritzinsky <jkoritzinsky@gmail.com> | 2019-04-09 15:28:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-09 15:28:00 -0700 |
commit | 29fabe7114d006af73ef768c529b4477b355a284 (patch) | |
tree | a37bebaed9cbe4f97ff04b10c4155e0205e50b6c /src/vm/mlinfo.cpp | |
parent | a6b0eef9d4a61e3ef5c3879a5016931f8ca0cf99 (diff) | |
download | coreclr-29fabe7114d006af73ef768c529b4477b355a284.tar.gz coreclr-29fabe7114d006af73ef768c529b4477b355a284.tar.bz2 coreclr-29fabe7114d006af73ef768c529b4477b355a284.zip |
Don't denormalize enum return values on instance methods on x86. (#23816)
* Don't denormalize enum return values on instance methods on x86.
* Reuse closedElemType.
Diffstat (limited to 'src/vm/mlinfo.cpp')
-rw-r--r-- | src/vm/mlinfo.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/vm/mlinfo.cpp b/src/vm/mlinfo.cpp index 2e675fde2a..985eefef1e 100644 --- a/src/vm/mlinfo.cpp +++ b/src/vm/mlinfo.cpp @@ -1652,7 +1652,19 @@ MarshalInfo::MarshalInfo(Module* pModule, } else { - mtype = sig.PeekElemTypeClosed(pModule, pTypeContext); + SigPointer sigtmp = sig; + CorElementType closedElemType = sigtmp.PeekElemTypeClosed(pModule, pTypeContext); + if (closedElemType == ELEMENT_TYPE_VALUETYPE) + { + TypeHandle th = sigtmp.GetTypeHandleThrowing(pModule, pTypeContext); + // If the return type of an instance method is a value-type we need the actual return type. + // However, if the return type is an enum, we can normalize it. + if (!th.IsEnum()) + { + mtype = closedElemType; + } + } + } #endif // _TARGET_X86_ |