diff options
author | Jeremy Koritzinsky <jkoritzinsky@gmail.com> | 2019-01-08 14:50:42 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-08 14:50:42 -0800 |
commit | 41dfe19d1ffe00edfdaa837a3b46aea5a8036617 (patch) | |
tree | a93deb907765936a0067554120664396bcc3f2cb /src/vm/stubgen.h | |
parent | f27337157392bbafd0cf69835d7ec3045a1dc08b (diff) | |
download | coreclr-41dfe19d1ffe00edfdaa837a3b46aea5a8036617.tar.gz coreclr-41dfe19d1ffe00edfdaa837a3b46aea5a8036617.tar.bz2 coreclr-41dfe19d1ffe00edfdaa837a3b46aea5a8036617.zip |
Extract cleanup changes from #21793. (#21852)
* Cleanup changes from #21793.
* Emit the data pointer offset directly into the IL stream (and calculate it as needed instead of passing it through)
* Fix broken assumption that OverrideProcArgs::na::m_pMT is the array type instead of the element type (which it was).
Diffstat (limited to 'src/vm/stubgen.h')
-rw-r--r-- | src/vm/stubgen.h | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/src/vm/stubgen.h b/src/vm/stubgen.h index 7bebfa7610..044029b0af 100644 --- a/src/vm/stubgen.h +++ b/src/vm/stubgen.h @@ -60,17 +60,26 @@ struct LocalDesc void MakeByRef() { + LIMITED_METHOD_CONTRACT; ChangeType(ELEMENT_TYPE_BYREF); } void MakePinned() { + LIMITED_METHOD_CONTRACT; ChangeType(ELEMENT_TYPE_PINNED); } + void MakeArray() + { + LIMITED_METHOD_CONTRACT; + ChangeType(ELEMENT_TYPE_SZARRAY); + } + // makes the LocalDesc semantically equivalent to ET_TYPE_CMOD_REQD<IsCopyConstructed>/ET_TYPE_CMOD_REQD<NeedsCopyConstructorModifier> void MakeCopyConstructedPointer() { + LIMITED_METHOD_CONTRACT; ChangeType(ELEMENT_TYPE_PTR); bIsCopyConstructed = TRUE; } @@ -96,22 +105,40 @@ struct LocalDesc THROWS; GC_TRIGGERS; MODE_ANY; - PRECONDITION(cbType == 1); // this only works on 1-element types for now } CONTRACTL_END; + + bool lastElementTypeIsValueType = false; if (ElementType[0] == ELEMENT_TYPE_VALUETYPE) { - return true; + lastElementTypeIsValueType = true; } else if ((ElementType[0] == ELEMENT_TYPE_INTERNAL) && (InternalToken.IsNativeValueType() || InternalToken.GetMethodTable()->IsValueType())) { - return true; + lastElementTypeIsValueType = true; + } + + if (!lastElementTypeIsValueType) + { + return false; + } + + // verify that the prefix element types don't make the type a non-value type + // this only works on LocalDescs with the prefixes exposed in the Add* methods above. + for (size_t i = 0; i < cbType - 1; i++) + { + if (ElementType[i] == ELEMENT_TYPE_BYREF + || ElementType[i] == ELEMENT_TYPE_SZARRAY + || ElementType[i] == ELEMENT_TYPE_PTR) + { + return false; + } } - return false; + return true; } }; @@ -595,6 +622,7 @@ public: void EmitLDC (DWORD_PTR uConst); void EmitLDC_R4 (UINT32 uConst); void EmitLDC_R8 (UINT64 uConst); + void EmitLDELEMA (int token); void EmitLDELEM_REF (); void EmitLDFLD (int token); void EmitLDFLDA (int token); |