@@ -328,7 +328,20 @@ public NativeLayoutParameterizedTypeSignatureVertexNode(NodeFactory factory, Typ
328328 }
329329 public override IEnumerable < DependencyListEntry > GetStaticDependencies ( NodeFactory context )
330330 {
331- return new DependencyListEntry [ ] { new DependencyListEntry ( _parameterTypeSig , "NativeLayoutParameterizedTypeSignatureVertexNode parameter type signature" ) } ;
331+ if ( ! _type . ContainsSignatureVariables ( ) )
332+ {
333+ if ( _type . IsRuntimeDeterminedSubtype )
334+ {
335+ if ( GenericTypesTemplateMap . IsArrayTypeEligibleForTemplate ( _type ) )
336+ yield return new DependencyListEntry ( context . NativeLayout . TemplateTypeLayout ( _type . ConvertToCanonForm ( CanonicalFormKind . Specific ) ) , "Array template" ) ;
337+ }
338+ else
339+ {
340+ yield return new DependencyListEntry ( context . NecessaryTypeSymbol ( _type ) , "Non-shared array" ) ;
341+ }
342+ }
343+
344+ yield return new DependencyListEntry ( _parameterTypeSig , "NativeLayoutParameterizedTypeSignatureVertexNode parameter type signature" ) ;
332345 }
333346 public override Vertex WriteVertex ( NodeFactory factory )
334347 {
@@ -428,6 +441,18 @@ public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFacto
428441 {
429442 DependencyList dependencies = new DependencyList ( ) ;
430443
444+ if ( ! _type . ContainsSignatureVariables ( ) )
445+ {
446+ if ( _type . IsRuntimeDeterminedSubtype )
447+ {
448+ dependencies . Add ( context . NativeLayout . TemplateTypeLayout ( _type . ConvertToCanonForm ( CanonicalFormKind . Specific ) ) , "Generic type template" ) ;
449+ }
450+ else
451+ {
452+ dependencies . Add ( context . NecessaryTypeSymbol ( _type ) , "Non-shared generic type" ) ;
453+ }
454+ }
455+
431456 dependencies . Add ( new DependencyListEntry ( _genericTypeDefSig , "NativeLayoutInstantiatedTypeSignatureVertexNode generic definition signature" ) ) ;
432457 foreach ( var arg in _instantiationArgs )
433458 dependencies . Add ( new DependencyListEntry ( arg , "NativeLayoutInstantiatedTypeSignatureVertexNode instantiation argument signature" ) ) ;
@@ -871,21 +896,11 @@ public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFacto
871896
872897 yield return new DependencyListEntry ( typeNode , "Template MethodTable" ) ;
873898
874- foreach ( var dependency in context . NativeLayout . TemplateConstructableTypes ( _type ) )
875- {
876- yield return new DependencyListEntry ( dependency , "type itslef must be template loadable" ) ;
877- }
878-
879899 yield return new DependencyListEntry ( context . GenericDictionaryLayout ( _type . ConvertToCanonForm ( CanonicalFormKind . Specific ) . GetClosestDefType ( ) ) , "Dictionary layout" ) ;
880900
881901 foreach ( TypeDesc iface in _type . RuntimeInterfaces )
882902 {
883903 yield return new DependencyListEntry ( context . NativeLayout . TypeSignatureVertex ( iface ) , "template interface list" ) ;
884-
885- foreach ( var dependency in context . NativeLayout . TemplateConstructableTypes ( iface ) )
886- {
887- yield return new DependencyListEntry ( dependency , "interface type dependency must be template loadable" ) ;
888- }
889904 }
890905
891906 if ( context . PreinitializationManager . HasLazyStaticConstructor ( _type . ConvertToCanonForm ( CanonicalFormKind . Specific ) ) )
@@ -926,11 +941,6 @@ public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFacto
926941 if ( _type . BaseType != null && _type . BaseType . IsRuntimeDeterminedSubtype )
927942 {
928943 yield return new DependencyListEntry ( context . NativeLayout . PlacedSignatureVertex ( context . NativeLayout . TypeSignatureVertex ( _type . BaseType ) ) , "template base type" ) ;
929-
930- foreach ( var dependency in context . NativeLayout . TemplateConstructableTypes ( _type . BaseType ) )
931- {
932- yield return new DependencyListEntry ( dependency , "base type must be template loadable" ) ;
933- }
934944 }
935945 }
936946
@@ -1080,11 +1090,6 @@ public NativeLayoutTypeSignatureBasedGenericDictionarySlotNode(NodeFactory facto
10801090 public sealed override IEnumerable < DependencyListEntry > GetStaticDependencies ( NodeFactory factory )
10811091 {
10821092 yield return new DependencyListEntry ( _signature , "TypeSignature" ) ;
1083-
1084- foreach ( var dependency in factory . NativeLayout . TemplateConstructableTypes ( _type ) )
1085- {
1086- yield return new DependencyListEntry ( dependency , "template construction dependency" ) ;
1087- }
10881093 }
10891094
10901095 protected sealed override Vertex WriteSignatureVertex ( NativeWriter writer , NodeFactory factory )
@@ -1169,10 +1174,7 @@ public sealed override IEnumerable<DependencyListEntry> GetStaticDependencies(No
11691174 {
11701175 yield return new DependencyListEntry ( _signature , "TypeSignature" ) ;
11711176
1172- foreach ( var dependency in factory . NativeLayout . TemplateConstructableTypes ( _type ) )
1173- {
1174- yield return new DependencyListEntry ( dependency , "template construction dependency" ) ;
1175- }
1177+ yield return new DependencyListEntry ( factory . NativeLayout . TemplateTypeLayout ( _type . ConvertToCanonForm ( CanonicalFormKind . Specific ) ) , "Template" ) ;
11761178 }
11771179
11781180 protected sealed override Vertex WriteSignatureVertex ( NativeWriter writer , NodeFactory factory )
@@ -1224,11 +1226,6 @@ public sealed override IEnumerable<DependencyListEntry> GetStaticDependencies(No
12241226 {
12251227 yield return new DependencyListEntry ( factory . VirtualMethodUse ( canonMethod ) , "Slot number" ) ;
12261228 }
1227-
1228- foreach ( var dependency in factory . NativeLayout . TemplateConstructableTypes ( _method . OwningType ) )
1229- {
1230- yield return new DependencyListEntry ( dependency , "template construction dependency" ) ;
1231- }
12321229 }
12331230
12341231 protected sealed override Vertex WriteSignatureVertex ( NativeWriter writer , NodeFactory factory )
@@ -1259,17 +1256,6 @@ public sealed override IEnumerable<DependencyListEntry> GetStaticDependencies(No
12591256 {
12601257 var dependencies = new DependencyList ( ) ;
12611258
1262- foreach ( var dependency in factory . NativeLayout . TemplateConstructableTypes ( _method . OwningType ) )
1263- {
1264- dependencies . Add ( dependency , "template construction dependency for method OwningType" ) ;
1265- }
1266-
1267- foreach ( var type in _method . Instantiation )
1268- {
1269- foreach ( var dependency in factory . NativeLayout . TemplateConstructableTypes ( type ) )
1270- dependencies . Add ( dependency , "template construction dependency for method Instantiation types" ) ;
1271- }
1272-
12731259 GenericMethodsTemplateMap . GetTemplateMethodDependencies ( ref dependencies , factory , _method . GetCanonMethodTarget ( CanonicalFormKind . Specific ) ) ;
12741260
12751261 dependencies . Add ( factory . NativeLayout . MethodEntry ( _method ) , "wrappednode" ) ;
@@ -1304,11 +1290,6 @@ public sealed override IEnumerable<DependencyListEntry> GetStaticDependencies(No
13041290 { factory . NativeLayout . TypeSignatureVertex ( _field . OwningType ) , "Owning type of field" }
13051291 } ;
13061292
1307- foreach ( var dependency in factory . NativeLayout . TemplateConstructableTypes ( _field . OwningType ) )
1308- {
1309- result . Add ( dependency , "template construction dependency" ) ;
1310- }
1311-
13121293 var canonOwningType = ( InstantiatedType ) _field . OwningType . ConvertToCanonForm ( CanonicalFormKind . Specific ) ;
13131294 FieldDesc canonField = factory . TypeSystemContext . GetFieldForInstantiatedType ( _field . GetTypicalFieldDefinition ( ) , canonOwningType ) ;
13141295 factory . MetadataManager . GetDependenciesDueToLdToken ( ref result , factory , canonField ) ;
@@ -1343,17 +1324,6 @@ public sealed override IEnumerable<DependencyListEntry> GetStaticDependencies(No
13431324 {
13441325 var result = new DependencyList ( ) ;
13451326
1346- foreach ( var dependency in factory . NativeLayout . TemplateConstructableTypes ( _method . OwningType ) )
1347- {
1348- result . Add ( dependency , "template construction dependency for method OwningType" ) ;
1349- }
1350-
1351- foreach ( var type in _method . Instantiation )
1352- {
1353- foreach ( var dependency in factory . NativeLayout . TemplateConstructableTypes ( type ) )
1354- result . Add ( dependency , "template construction dependency for method Instantiation types" ) ;
1355- }
1356-
13571327 factory . MetadataManager . GetDependenciesDueToLdToken ( ref result , factory , _method . GetCanonMethodTarget ( CanonicalFormKind . Specific ) ) ;
13581328
13591329 result . Add ( factory . NativeLayout . MethodEntry ( _method ) , "wrappednode" ) ;
@@ -1418,20 +1388,6 @@ public sealed override IEnumerable<DependencyListEntry> GetStaticDependencies(No
14181388
14191389 yield return new DependencyListEntry ( constrainedMethodDescriptorNode , "ConstrainedMethodType" ) ;
14201390
1421- foreach ( var dependency in factory . NativeLayout . TemplateConstructableTypes ( _constrainedMethod . OwningType ) )
1422- {
1423- yield return new DependencyListEntry ( dependency , "template construction dependency constrainedMethod OwningType" ) ;
1424- }
1425-
1426- foreach ( var type in _constrainedMethod . Instantiation )
1427- {
1428- foreach ( var dependency in factory . NativeLayout . TemplateConstructableTypes ( type ) )
1429- yield return new DependencyListEntry ( dependency , "template construction dependency constrainedMethod Instantiation type" ) ;
1430- }
1431-
1432- foreach ( var dependency in factory . NativeLayout . TemplateConstructableTypes ( _constraintType ) )
1433- yield return new DependencyListEntry ( dependency , "template construction dependency constraintType" ) ;
1434-
14351391 if ( _constrainedMethod . IsVirtual && _constrainedMethod . HasInstantiation )
14361392 {
14371393 MethodDesc canonMethod = _constrainedMethod . GetCanonMethodTarget ( CanonicalFormKind . Specific ) ;
@@ -1500,17 +1456,6 @@ public sealed override IEnumerable<DependencyListEntry> GetStaticDependencies(No
15001456 {
15011457 DependencyList dependencies = new DependencyList ( ) ;
15021458
1503- foreach ( var dependency in factory . NativeLayout . TemplateConstructableTypes ( _method . OwningType ) )
1504- {
1505- dependencies . Add ( dependency , "template construction dependency for method OwningType" ) ;
1506- }
1507-
1508- foreach ( var type in _method . Instantiation )
1509- {
1510- foreach ( var dependency in factory . NativeLayout . TemplateConstructableTypes ( type ) )
1511- dependencies . Add ( dependency , "template construction dependency for method Instantiation types" ) ;
1512- }
1513-
15141459 GenericMethodsTemplateMap . GetTemplateMethodDependencies ( ref dependencies , factory , _method . GetCanonMethodTarget ( CanonicalFormKind . Specific ) ) ;
15151460
15161461 dependencies . Add ( _wrappedNode , "wrappednode" ) ;
0 commit comments