Replace LinkedList by IntrusiveList to avoid allocations on JIT (#931)

* Replace LinkedList by IntrusiveList to avoid allocations on JIT

* Fix wrong replacements
This commit is contained in:
gdkchan 2020-02-17 18:30:54 -03:00 committed by GitHub
parent e9a37ca6a8
commit e5f78fb1d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 365 additions and 198 deletions

View file

@ -2,13 +2,14 @@ using System.Collections.Generic;
namespace ARMeilleure.IntermediateRepresentation
{
class BasicBlock
class BasicBlock : IIntrusiveListNode<BasicBlock>
{
public int Index { get; set; }
public LinkedListNode<BasicBlock> Node { get; set; }
public BasicBlock ListPrevious { get; set; }
public BasicBlock ListNext { get; set; }
public LinkedList<Node> Operations { get; }
public IntrusiveList<Node> Operations { get; }
private BasicBlock _next;
private BasicBlock _branch;
@ -33,7 +34,7 @@ namespace ARMeilleure.IntermediateRepresentation
public BasicBlock()
{
Operations = new LinkedList<Node>();
Operations = new IntrusiveList<Node>();
Predecessors = new List<BasicBlock>();
@ -77,7 +78,7 @@ namespace ARMeilleure.IntermediateRepresentation
public Node GetLastOp()
{
return Operations.Last?.Value;
return Operations.Last;
}
}
}