diff options
author | gdkchan <gab.dark.100@gmail.com> | 2020-02-17 18:30:54 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-17 22:30:54 +0100 |
commit | e5f78fb1d44b825ee9195660f4387680055137dc (patch) | |
tree | 59cfa56dc046bd27aa1d7e9d7b0840ffafd9f601 /ARMeilleure/Translation/EmitterContext.cs | |
parent | e9a37ca6a85346c05149deac916dc90de43ad240 (diff) |
Replace LinkedList by IntrusiveList to avoid allocations on JIT (#931)
* Replace LinkedList by IntrusiveList to avoid allocations on JIT
* Fix wrong replacements
Diffstat (limited to 'ARMeilleure/Translation/EmitterContext.cs')
-rw-r--r-- | ARMeilleure/Translation/EmitterContext.cs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ARMeilleure/Translation/EmitterContext.cs b/ARMeilleure/Translation/EmitterContext.cs index 13cf677c..a125a715 100644 --- a/ARMeilleure/Translation/EmitterContext.cs +++ b/ARMeilleure/Translation/EmitterContext.cs @@ -12,7 +12,7 @@ namespace ARMeilleure.Translation { private Dictionary<Operand, BasicBlock> _irLabels; - private LinkedList<BasicBlock> _irBlocks; + private IntrusiveList<BasicBlock> _irBlocks; private BasicBlock _irBlock; @@ -22,7 +22,7 @@ namespace ARMeilleure.Translation { _irLabels = new Dictionary<Operand, BasicBlock>(); - _irBlocks = new LinkedList<BasicBlock>(); + _irBlocks = new IntrusiveList<BasicBlock>(); _needsNewBlock = true; } @@ -508,7 +508,8 @@ namespace ARMeilleure.Translation if (_irLabels.TryGetValue(label, out BasicBlock nextBlock)) { nextBlock.Index = _irBlocks.Count; - nextBlock.Node = _irBlocks.AddLast(nextBlock); + + _irBlocks.AddLast(nextBlock); NextBlock(nextBlock); } @@ -524,7 +525,7 @@ namespace ARMeilleure.Translation { BasicBlock block = new BasicBlock(_irBlocks.Count); - block.Node = _irBlocks.AddLast(block); + _irBlocks.AddLast(block); NextBlock(block); } @@ -556,7 +557,7 @@ namespace ARMeilleure.Translation public ControlFlowGraph GetControlFlowGraph() { - return new ControlFlowGraph(_irBlocks.First.Value, _irBlocks); + return new ControlFlowGraph(_irBlocks.First, _irBlocks); } } }
\ No newline at end of file |