[fix] 修复计算 AOTGenericReferences时未考虑到泛型中调用泛型的问题,导致间接调用的泛型未被统计在内的bug
parent
c3f6325e4a
commit
3f1b34682d
|
@ -58,15 +58,15 @@ namespace HybridCLR.Editor.AOT
|
|||
return;
|
||||
}
|
||||
gc = gc.ToGenericShare();
|
||||
if (_genericTypes.Add(gc) && NeedWalk(gc.Type))
|
||||
if (_genericTypes.Add(gc) && NeedWalk(null, gc.Type))
|
||||
{
|
||||
WalkType(gc);
|
||||
}
|
||||
}
|
||||
|
||||
private bool NeedWalk(TypeDef type)
|
||||
private bool NeedWalk(MethodDef callFrom, TypeDef type)
|
||||
{
|
||||
return _hotUpdateAssemblyFiles.Contains(type.Module.Name);
|
||||
return _hotUpdateAssemblyFiles.Contains(type.Module.Name) || callFrom == null || callFrom.HasGenericParameters;
|
||||
}
|
||||
|
||||
private bool IsAotType(TypeDef type)
|
||||
|
@ -85,7 +85,7 @@ namespace HybridCLR.Editor.AOT
|
|||
{
|
||||
return;
|
||||
}
|
||||
if (_genericMethods.Add(method) && NeedWalk(method.Method.DeclaringType))
|
||||
if (NeedWalk(methodDef, method.Method.DeclaringType) && _genericMethods.Add(method))
|
||||
{
|
||||
_newMethods.Add(method);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ namespace HybridCLR.Editor.AOT
|
|||
{
|
||||
return;
|
||||
}
|
||||
if (_genericMethods.Add(method) && NeedWalk(method.Method.DeclaringType))
|
||||
if (NeedWalk(null, method.Method.DeclaringType) && _genericMethods.Add(method))
|
||||
{
|
||||
_newMethods.Add(method);
|
||||
}
|
||||
|
@ -157,9 +157,9 @@ namespace HybridCLR.Editor.AOT
|
|||
for (uint rid = 1, n = ass.Metadata.TablesStream.TypeSpecTable.Rows; rid <= n; rid++)
|
||||
{
|
||||
var ts = ass.ResolveTypeSpec(rid);
|
||||
if (!ts.ContainsGenericParameter)
|
||||
{
|
||||
var cs = GenericClass.ResolveClass(ts, null)?.ToGenericShare();
|
||||
if (cs != null)
|
||||
{
|
||||
TryAddAndWalkGenericType(cs);
|
||||
}
|
||||
}
|
||||
|
@ -167,10 +167,6 @@ namespace HybridCLR.Editor.AOT
|
|||
for (uint rid = 1, n = ass.Metadata.TablesStream.MethodSpecTable.Rows; rid <= n; rid++)
|
||||
{
|
||||
var ms = ass.ResolveMethodSpec(rid);
|
||||
if (ms.DeclaringType.ContainsGenericParameter || ms.GenericInstMethodSig.ContainsGenericParameter)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var gm = GenericMethod.ResolveMethod(ms, null)?.ToGenericShare();
|
||||
TryAddMethodNotWalkType(gm);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue