2020-03-18 07:44:32 -04:00
|
|
|
|
using ARMeilleure.Common;
|
|
|
|
|
|
|
|
|
|
namespace ARMeilleure.IntermediateRepresentation
|
|
|
|
|
{
|
|
|
|
|
static class OperationHelper
|
|
|
|
|
{
|
|
|
|
|
public static Operation Operation(Instruction instruction, Operand destination)
|
|
|
|
|
{
|
|
|
|
|
return Operation().With(instruction, destination);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Operation Operation(Instruction instruction, Operand destination,
|
|
|
|
|
Operand[] sources)
|
|
|
|
|
{
|
|
|
|
|
return Operation().With(instruction, destination, sources);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Operation Operation(Instruction instruction, Operand destination,
|
|
|
|
|
Operand source0)
|
|
|
|
|
{
|
|
|
|
|
return Operation().With(instruction, destination, source0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Operation Operation(Instruction instruction, Operand destination,
|
|
|
|
|
Operand source0, Operand source1)
|
|
|
|
|
{
|
|
|
|
|
return Operation().With(instruction, destination, source0, source1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Operation Operation(Instruction instruction, Operand destination,
|
|
|
|
|
Operand source0, Operand source1, Operand source2)
|
|
|
|
|
{
|
|
|
|
|
return Operation().With(instruction, destination, source0, source1, source2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Operation Operation(
|
|
|
|
|
Instruction instruction,
|
|
|
|
|
Operand[] destinations,
|
|
|
|
|
Operand[] sources)
|
|
|
|
|
{
|
|
|
|
|
return Operation().With(instruction, destinations, sources);
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-21 21:23:48 -05:00
|
|
|
|
#region "ThreadStaticPool"
|
|
|
|
|
public static void PrepareOperationPool(int groupId = 0)
|
2020-03-18 07:44:32 -04:00
|
|
|
|
{
|
2021-02-21 21:23:48 -05:00
|
|
|
|
ThreadStaticPool<Operation>.PreparePool(groupId, ChunkSizeLimit.Medium);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Operation Operation()
|
|
|
|
|
{
|
|
|
|
|
return ThreadStaticPool<Operation>.Instance.Allocate();
|
2020-03-18 07:44:32 -04:00
|
|
|
|
}
|
|
|
|
|
|
2021-02-21 21:23:48 -05:00
|
|
|
|
public static void ResetOperationPool(int groupId = 0)
|
2020-03-18 07:44:32 -04:00
|
|
|
|
{
|
2021-02-21 21:23:48 -05:00
|
|
|
|
ThreadStaticPool<Operation>.ResetPool(groupId);
|
2020-03-18 07:44:32 -04:00
|
|
|
|
}
|
2020-12-23 21:58:36 -05:00
|
|
|
|
|
2021-02-21 21:23:48 -05:00
|
|
|
|
public static void DisposeOperationPools()
|
2020-12-23 21:58:36 -05:00
|
|
|
|
{
|
2021-02-21 21:23:48 -05:00
|
|
|
|
ThreadStaticPool<Operation>.DisposePools();
|
2020-12-23 21:58:36 -05:00
|
|
|
|
}
|
2021-02-21 21:23:48 -05:00
|
|
|
|
#endregion
|
2020-03-18 07:44:32 -04:00
|
|
|
|
}
|
|
|
|
|
}
|