From e5f78fb1d44b825ee9195660f4387680055137dc Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 17 Feb 2020 18:30:54 -0300 Subject: Replace LinkedList by IntrusiveList to avoid allocations on JIT (#931) * Replace LinkedList by IntrusiveList to avoid allocations on JIT * Fix wrong replacements --- ARMeilleure/IntermediateRepresentation/BasicBlock.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ARMeilleure/IntermediateRepresentation/BasicBlock.cs') diff --git a/ARMeilleure/IntermediateRepresentation/BasicBlock.cs b/ARMeilleure/IntermediateRepresentation/BasicBlock.cs index 06839f30..ac48ac8e 100644 --- a/ARMeilleure/IntermediateRepresentation/BasicBlock.cs +++ b/ARMeilleure/IntermediateRepresentation/BasicBlock.cs @@ -2,13 +2,14 @@ using System.Collections.Generic; namespace ARMeilleure.IntermediateRepresentation { - class BasicBlock + class BasicBlock : IIntrusiveListNode { public int Index { get; set; } - public LinkedListNode Node { get; set; } + public BasicBlock ListPrevious { get; set; } + public BasicBlock ListNext { get; set; } - public LinkedList Operations { get; } + public IntrusiveList Operations { get; } private BasicBlock _next; private BasicBlock _branch; @@ -33,7 +34,7 @@ namespace ARMeilleure.IntermediateRepresentation public BasicBlock() { - Operations = new LinkedList(); + Operations = new IntrusiveList(); Predecessors = new List(); @@ -77,7 +78,7 @@ namespace ARMeilleure.IntermediateRepresentation public Node GetLastOp() { - return Operations.Last?.Value; + return Operations.Last; } } } \ No newline at end of file -- cgit v1.2.3