@@ -32,10 +32,10 @@ class TypeDesc
3232{
3333public:
3434#ifndef DACCESS_COMPILE
35- TypeDesc (CorElementType type) {
35+ TypeDesc (CorElementType type, bool isCollectible ) {
3636 LIMITED_METHOD_CONTRACT;
3737
38- _typeAndFlags = type;
38+ _typeAndFlags = type | (isCollectible ? enum_flag_IsCollectible : 0 ) ;
3939 }
4040#endif
4141
@@ -112,14 +112,19 @@ class TypeDesc
112112 // Is actually ParamTypeDesc (BYREF, PTR)
113113 BOOL HasTypeParam ();
114114
115+ bool IsCollectible () const
116+ {
117+ LIMITED_METHOD_CONTRACT;
118+ return (_typeAndFlags & TypeDesc::enum_flag_IsCollectible) != 0 ;
119+ }
115120
116- BOOL HasTypeEquivalence () const
121+ bool HasTypeEquivalence () const
117122 {
118123 LIMITED_METHOD_CONTRACT;
119124 return (_typeAndFlags & TypeDesc::enum_flag_HasTypeEquivalence) != 0 ;
120125 }
121126
122- BOOL IsFullyLoaded () const
127+ bool IsFullyLoaded () const
123128 {
124129 LIMITED_METHOD_CONTRACT;
125130
@@ -186,7 +191,7 @@ class TypeDesc
186191 // See methodtable.h for details of the flags with the same name there
187192 enum
188193 {
189- // unused = 0x00000100,
194+ enum_flag_IsCollectible = 0x00000100 ,
190195 // unused = 0x00000200,
191196 // unused = 0x00000400,
192197 // unused = 0x00000800,
@@ -228,7 +233,7 @@ class ParamTypeDesc : public TypeDesc {
228233public:
229234#ifndef DACCESS_COMPILE
230235 ParamTypeDesc (CorElementType type, TypeHandle arg)
231- : TypeDesc(type), m_Arg(arg) {
236+ : TypeDesc(type, arg.IsCollectible() ), m_Arg(arg) {
232237
233238 LIMITED_METHOD_CONTRACT;
234239
@@ -291,7 +296,7 @@ class TypeVarTypeDesc : public TypeDesc
291296#ifndef DACCESS_COMPILE
292297
293298 TypeVarTypeDesc (PTR_Module pModule, mdToken typeOrMethodDef, unsigned int index, mdGenericParam token) :
294- TypeDesc(TypeFromToken(typeOrMethodDef) == mdtTypeDef ? ELEMENT_TYPE_VAR : ELEMENT_TYPE_MVAR)
299+ TypeDesc(TypeFromToken(typeOrMethodDef) == mdtTypeDef ? ELEMENT_TYPE_VAR : ELEMENT_TYPE_MVAR, pModule->IsCollectible() )
295300 {
296301 CONTRACTL
297302 {
@@ -416,7 +421,7 @@ class FnPtrTypeDesc : public TypeDesc
416421public:
417422#ifndef DACCESS_COMPILE
418423 FnPtrTypeDesc (BYTE callConv, DWORD numArgs, TypeHandle * retAndArgTypes, PTR_Module pLoaderModule)
419- : TypeDesc(ELEMENT_TYPE_FNPTR), m_pLoaderModule(pLoaderModule), m_NumArgs(numArgs), m_CallConv(callConv)
424+ : TypeDesc(ELEMENT_TYPE_FNPTR, pLoaderModule-> IsCollectible () ), m_pLoaderModule(pLoaderModule), m_NumArgs(numArgs), m_CallConv(callConv)
420425 {
421426 LIMITED_METHOD_CONTRACT;
422427 for (DWORD i = 0 ; i <= numArgs; i++)
0 commit comments