forked from dotnet/runtimelab
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bring up hot-cold splitting on NativeAOT
- Loading branch information
Showing
6 changed files
with
76 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/coreclr/tools/aot/ILCompiler.RyuJit/Compiler/DependencyAnalysis/MethodColdCodeNode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Internal.Text; | ||
using Internal.TypeSystem; | ||
using System.Diagnostics; | ||
using System; | ||
|
||
namespace ILCompiler.DependencyAnalysis | ||
{ | ||
public class MethodColdCodeNode : ObjectNode, ISymbolDefinitionNode | ||
{ | ||
private ObjectData _methodColdCode; | ||
private MethodDesc _owningMethod; | ||
|
||
public MethodColdCodeNode(MethodDesc owningMethod) | ||
{ | ||
_owningMethod = owningMethod; | ||
} | ||
|
||
public int Offset => 0; | ||
|
||
public override ObjectNodeSection Section | ||
{ | ||
get | ||
{ | ||
return _owningMethod.Context.Target.IsWindows ? ObjectNodeSection.ManagedCodeWindowsContentSection : ObjectNodeSection.ManagedCodeUnixContentSection; | ||
|
||
} | ||
} | ||
|
||
public override bool IsShareable => false; | ||
|
||
public override int ClassCode => 788492408; | ||
|
||
public override bool StaticDependenciesAreComputed => _methodColdCode != null; | ||
|
||
public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) | ||
{ | ||
sb.Append("__coldcode_" + nameMangler.GetMangledMethodName(_owningMethod)); | ||
} | ||
|
||
public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) | ||
{ | ||
MethodColdCodeNode otherNode = (MethodColdCodeNode)other; | ||
return comparer.Compare(_owningMethod, otherNode._owningMethod); | ||
} | ||
|
||
public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) => _methodColdCode; | ||
|
||
protected override string GetName(NodeFactory context) => throw new NotImplementedException(); | ||
|
||
public void SetCode(ObjectData data) | ||
{ | ||
Debug.Assert(_methodColdCode == null); | ||
_methodColdCode = data; | ||
} | ||
|
||
public int GetColdCodeSize() | ||
{ | ||
return _methodColdCode.Data.Length; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters