@@ -8732,29 +8732,30 @@ MethodTableBuilder::HandleExplicitLayout(
87328732 if (pMT->IsByRefLike ())
87338733 return CheckByRefLikeValueClassLayout (pMT, pFieldLayout);
87348734
8735- // This method assumes there is a GC desc associated with the MethodTable.
8736- _ASSERTE (pMT->ContainsPointers ());
8737-
87388735 // Build a layout of the value class (vc). Don't know the sizes of all the fields easily, but
87398736 // do know (a) vc is already consistent so don't need to check it's overlaps and
87408737 // (b) size and location of all objectrefs. So build it by setting all non-oref
8741- // then fill in the orefs later
8738+ // then fill in the orefs later if present.
87428739 UINT fieldSize = pMT->GetNumInstanceFieldBytes ();
87438740
87448741 CQuickBytes qb;
87458742 bmtFieldLayoutTag *vcLayout = (bmtFieldLayoutTag*) qb.AllocThrows (fieldSize * sizeof (bmtFieldLayoutTag));
87468743 memset ((void *)vcLayout, nonoref, fieldSize);
87478744
8748- // use pointer series to locate the orefs
8749- CGCDesc* map = CGCDesc::GetCGCDescFromMT (pMT);
8750- CGCDescSeries *pSeries = map->GetLowestSeries ();
8751-
8752- for (SIZE_T j = 0 ; j < map->GetNumSeries (); j++)
8745+ // If the type contains pointers fill it out from the GC data
8746+ if (pMT->ContainsPointers ())
87538747 {
8754- CONSISTENCY_CHECK (pSeries <= map->GetHighestSeries ());
8748+ // use pointer series to locate the orefs
8749+ CGCDesc* map = CGCDesc::GetCGCDescFromMT (pMT);
8750+ CGCDescSeries *pSeries = map->GetLowestSeries ();
87558751
8756- memset ((void *)&vcLayout[pSeries->GetSeriesOffset () - OBJECT_SIZE], oref, pSeries->GetSeriesSize () + pMT->GetBaseSize ());
8757- pSeries++;
8752+ for (SIZE_T j = 0 ; j < map->GetNumSeries (); j++)
8753+ {
8754+ CONSISTENCY_CHECK (pSeries <= map->GetHighestSeries ());
8755+
8756+ memset ((void *)&vcLayout[pSeries->GetSeriesOffset () - OBJECT_SIZE], oref, pSeries->GetSeriesSize () + pMT->GetBaseSize ());
8757+ pSeries++;
8758+ }
87588759 }
87598760
87608761 ExplicitClassTrust explicitClassTrust;
0 commit comments