Skip to content

Commit

Permalink
Added default value for prewarm method
Browse files Browse the repository at this point in the history
  • Loading branch information
liiir1985 committed Mar 26, 2021
1 parent c849058 commit 4bc06a2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ILRuntime/Runtime/Enviorment/AppDomain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,23 +1000,25 @@ public ILTypeInstance Instantiate(string type, object[] args = null)
/// Prewarm all methods of the specified type
/// </summary>
/// <param name="type"></param>
public void Prewarm(string type)
/// <param name="recursive"></param>
public void Prewarm(string type, bool recursive = true)
{
IType t = GetType(type);
if (t == null || t is CLRType)
return;
var methods = t.GetMethods();
foreach(var i in methods)
foreach (var i in methods)
{
((ILMethod)i).Prewarm(true);
((ILMethod)i).Prewarm(recursive);
}
}

/// <summary>
/// Prewarm all methods specified by the parameter
/// </summary>
/// <param name="info"></param>
public void Prewarm(PrewarmInfo[] info)
/// <param name="recursive"></param>
public void Prewarm(PrewarmInfo[] info, bool recursive = true)
{
foreach(var i in info)
{
Expand All @@ -1031,7 +1033,7 @@ public void Prewarm(PrewarmInfo[] info)
ILMethod m = (ILMethod)j;
if(m.Name == mn && m.GenericParameterCount == 0)
{
m.Prewarm(false);
m.Prewarm(recursive);
}
}
}
Expand Down

0 comments on commit 4bc06a2

Please sign in to comment.