mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-11-22 18:15:11 +00:00
8226997bc7
* Start of JIT garbage collection improvements - thread static pool for Operand, MemoryOperand, Operation - Operands and Operations are always to be constructed via their static helper classes, so they can be pooled. - removing LinkedList from Node for sources/destinations (replaced with List<>s for now, but probably could do arrays since size is bounded) - removing params constructors from Node - LinkedList<> to List<> with Clear() for Operand assignments/uses - ThreadStaticPool is very simple and basically just exists for the purpose of our specific translation allocation problem. Right now it will stay at the worst case allocation count for that thread (so far) - the pool can never shrink. - Still some cases of Operand[] that haven't been removed yet. Will need to evaluate them (eg. is there a reasonable max number of params for Calls?) * ConcurrentStack instead of ConcurrentQueue for Rejit * Optimize some parts of LSRA - BitMap now operates on 64-bit int rather than 32-bit - BitMap is now pooled in a ThreadStatic pool (within lrsa) - BitMap now is now its own iterator. Marginally speeds up iterating through the bits. - A few cases where enumerators were generated have been converted to forms that generate less garbage. - New data structure for sorting _usePositions in LiveIntervals. Much faster split, NextUseAfter, initial insertion. Random insertion is slightly slower. - That last one is WIP since you need to insert the values backwards. It would be ideal if it just flipped it for you, uncomplicating things on the caller side. * Use a static pool of thread static pools. (yes.) Prevents each execution thread creating its own lowCq pool and making me cry. * Move constant value to top, change naming convention. * Fix iteration of memory operands. * Increase max thread count. * Address Feedback
99 lines
No EOL
2.6 KiB
C#
99 lines
No EOL
2.6 KiB
C#
using ARMeilleure.Common;
|
|
|
|
namespace ARMeilleure.IntermediateRepresentation
|
|
{
|
|
static class OperandHelper
|
|
{
|
|
private static MemoryOperand MemoryOperand()
|
|
{
|
|
return ThreadStaticPool<MemoryOperand>.Instance.Allocate();
|
|
}
|
|
|
|
private static Operand Operand()
|
|
{
|
|
return ThreadStaticPool<Operand>.Instance.Allocate();
|
|
}
|
|
|
|
public static Operand Const(OperandType type, long value)
|
|
{
|
|
return type == OperandType.I32 ? Operand().With((int)value) : Operand().With(value);
|
|
}
|
|
|
|
public static Operand Const(bool value)
|
|
{
|
|
return Operand().With(value ? 1 : 0);
|
|
}
|
|
|
|
public static Operand Const(int value)
|
|
{
|
|
return Operand().With(value);
|
|
}
|
|
|
|
public static Operand Const(uint value)
|
|
{
|
|
return Operand().With(value);
|
|
}
|
|
|
|
public static Operand Const(long value)
|
|
{
|
|
return Operand().With(value);
|
|
}
|
|
|
|
public static Operand Const(ulong value)
|
|
{
|
|
return Operand().With(value);
|
|
}
|
|
|
|
public static Operand ConstF(float value)
|
|
{
|
|
return Operand().With(value);
|
|
}
|
|
|
|
public static Operand ConstF(double value)
|
|
{
|
|
return Operand().With(value);
|
|
}
|
|
|
|
public static Operand Label()
|
|
{
|
|
return Operand().With(OperandKind.Label);
|
|
}
|
|
|
|
public static Operand Local(OperandType type)
|
|
{
|
|
return Operand().With(OperandKind.LocalVariable, type);
|
|
}
|
|
|
|
public static Operand Register(int index, RegisterType regType, OperandType type)
|
|
{
|
|
return Operand().With(index, regType, type);
|
|
}
|
|
|
|
public static Operand Undef()
|
|
{
|
|
return Operand().With(OperandKind.Undefined);
|
|
}
|
|
|
|
public static MemoryOperand MemoryOp(
|
|
OperandType type,
|
|
Operand baseAddress,
|
|
Operand index = null,
|
|
Multiplier scale = Multiplier.x1,
|
|
int displacement = 0)
|
|
{
|
|
return MemoryOperand().With(type, baseAddress, index, scale, displacement);
|
|
}
|
|
|
|
public static void PrepareOperandPool(bool highCq)
|
|
{
|
|
ThreadStaticPool<Operand>.PreparePool(highCq ? 1 : 0);
|
|
ThreadStaticPool<MemoryOperand>.PreparePool(highCq ? 1 : 0);
|
|
}
|
|
|
|
public static void ResetOperandPool(bool highCq)
|
|
{
|
|
ThreadStaticPool<Operand>.ReturnPool(highCq ? 1 : 0);
|
|
ThreadStaticPool<MemoryOperand>.ReturnPool(highCq ? 1 : 0);
|
|
}
|
|
}
|
|
} |