diff options
author | Jan Kotas <jkotas@microsoft.com> | 2017-10-06 11:11:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-06 11:11:35 -0700 |
commit | 643b09f966e68e06d5f0930755985a01a2a2b096 (patch) | |
tree | edfa10cdb5aa49010dbc2b8836b24e6d7fa73557 /src/vm | |
parent | 77b5ee4f53eb6a098898afbba1c8d85cb9a632d8 (diff) | |
download | coreclr-643b09f966e68e06d5f0930755985a01a2a2b096.tar.gz coreclr-643b09f966e68e06d5f0930755985a01a2a2b096.tar.bz2 coreclr-643b09f966e68e06d5f0930755985a01a2a2b096.zip |
Reorder checks in CEEInfo::getClassLayout (#14356)
Check for native value type has to be first to handle byref-like native value types correctly.
Diffstat (limited to 'src/vm')
-rw-r--r-- | src/vm/jitinterface.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index 5a5ff05cd6..d326a92ccb 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -2267,7 +2267,14 @@ unsigned CEEInfo::getClassGClayout (CORINFO_CLASS_HANDLE clsHnd, BYTE* gcPtrs) MethodTable* pMT = VMClsHnd.GetMethodTable(); - if (pMT->IsByRefLike()) + if (VMClsHnd.IsNativeValueType()) + { + // native value types have no GC pointers + result = 0; + memset(gcPtrs, TYPE_GC_NONE, + (VMClsHnd.GetSize() + sizeof(void*) -1)/ sizeof(void*)); + } + else if (pMT->IsByRefLike()) { // TODO: TypedReference should ideally be implemented as a by-ref-like struct containing a ByReference<T> field, in // which case the check for g_TypedReferenceMT below would not be necessary @@ -2287,13 +2294,6 @@ unsigned CEEInfo::getClassGClayout (CORINFO_CLASS_HANDLE clsHnd, BYTE* gcPtrs) result = ComputeGCLayout(VMClsHnd.AsMethodTable(), gcPtrs); } } - else if (VMClsHnd.IsNativeValueType()) - { - // native value types have no GC pointers - result = 0; - memset(gcPtrs, TYPE_GC_NONE, - (VMClsHnd.GetSize() + sizeof(void*) -1)/ sizeof(void*)); - } else { _ASSERTE(pMT->IsValueType()); |