2020-03-18 12:44:32 +01: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-01-27 06:21:37 +01:00
|
|
|
|
#region "ThreadStaticPool"
|
|
|
|
|
public static void PrepareOperationPool(int groupId = 0)
|
2020-03-18 12:44:32 +01:00
|
|
|
|
{
|
2021-01-27 06:21:37 +01:00
|
|
|
|
ThreadStaticPool<Operation>.PreparePool(groupId, ChunkSizeLimit.Medium);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Operation Operation()
|
|
|
|
|
{
|
|
|
|
|
return ThreadStaticPool<Operation>.Instance.Allocate();
|
2020-03-18 12:44:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-27 06:21:37 +01:00
|
|
|
|
public static void ResetOperationPool(int groupId = 0)
|
2020-03-18 12:44:32 +01:00
|
|
|
|
{
|
2021-01-27 06:21:37 +01:00
|
|
|
|
ThreadStaticPool<Operation>.ResetPool(groupId);
|
2020-03-18 12:44:32 +01:00
|
|
|
|
}
|
2020-12-24 03:58:36 +01:00
|
|
|
|
|
2021-01-27 06:21:37 +01:00
|
|
|
|
public static void DisposeOperationPools()
|
2020-12-24 03:58:36 +01:00
|
|
|
|
{
|
2021-01-27 06:21:37 +01:00
|
|
|
|
ThreadStaticPool<Operation>.DisposePools();
|
2020-12-24 03:58:36 +01:00
|
|
|
|
}
|
2021-01-27 06:21:37 +01:00
|
|
|
|
#endregion
|
2020-03-18 12:44:32 +01:00
|
|
|
|
}
|
|
|
|
|
}
|