mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2025-06-28 22:20:46 -07:00
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:
@ -74,9 +74,9 @@ namespace ARMeilleure.Translation
|
||||
RegisterMask[] localInputs = new RegisterMask[cfg.Blocks.Count];
|
||||
RegisterMask[] localOutputs = new RegisterMask[cfg.Blocks.Count];
|
||||
|
||||
foreach (BasicBlock block in cfg.Blocks)
|
||||
for (BasicBlock block = cfg.Blocks.First; block != null; block = block.ListNext)
|
||||
{
|
||||
foreach (Node node in block.Operations)
|
||||
for (Node node = block.Operations.First; node != null; node = node.ListNext)
|
||||
{
|
||||
Operation operation = node as Operation;
|
||||
|
||||
@ -192,13 +192,13 @@ namespace ARMeilleure.Translation
|
||||
while (modified);
|
||||
|
||||
// Insert load and store context instructions where needed.
|
||||
foreach (BasicBlock block in cfg.Blocks)
|
||||
for (BasicBlock block = cfg.Blocks.First; block != null; block = block.ListNext)
|
||||
{
|
||||
bool hasContextLoad = HasContextLoad(block);
|
||||
|
||||
if (hasContextLoad)
|
||||
{
|
||||
block.Operations.RemoveFirst();
|
||||
block.Operations.Remove(block.Operations.First);
|
||||
}
|
||||
|
||||
// The only block without any predecessor should be the entry block.
|
||||
@ -213,7 +213,7 @@ namespace ARMeilleure.Translation
|
||||
|
||||
if (hasContextStore)
|
||||
{
|
||||
block.Operations.RemoveLast();
|
||||
block.Operations.Remove(block.Operations.Last);
|
||||
}
|
||||
|
||||
if (EndsWithReturn(block) || hasContextStore)
|
||||
@ -226,7 +226,7 @@ namespace ARMeilleure.Translation
|
||||
|
||||
private static bool HasContextLoad(BasicBlock block)
|
||||
{
|
||||
return StartsWith(block, Instruction.LoadFromContext) && block.Operations.First.Value.SourcesCount == 0;
|
||||
return StartsWith(block, Instruction.LoadFromContext) && block.Operations.First.SourcesCount == 0;
|
||||
}
|
||||
|
||||
private static bool HasContextStore(BasicBlock block)
|
||||
@ -241,7 +241,7 @@ namespace ARMeilleure.Translation
|
||||
return false;
|
||||
}
|
||||
|
||||
return block.Operations.First.Value is Operation operation && operation.Instruction == inst;
|
||||
return block.Operations.First is Operation operation && operation.Instruction == inst;
|
||||
}
|
||||
|
||||
private static bool EndsWith(BasicBlock block, Instruction inst)
|
||||
@ -251,7 +251,7 @@ namespace ARMeilleure.Translation
|
||||
return false;
|
||||
}
|
||||
|
||||
return block.Operations.Last.Value is Operation operation && operation.Instruction == inst;
|
||||
return block.Operations.Last is Operation operation && operation.Instruction == inst;
|
||||
}
|
||||
|
||||
private static RegisterMask GetMask(Register register)
|
||||
|
Reference in New Issue
Block a user