aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/IntermediateRepresentation
diff options
context:
space:
mode:
Diffstat (limited to 'ARMeilleure/IntermediateRepresentation')
-rw-r--r--ARMeilleure/IntermediateRepresentation/OperandHelper.cs40
-rw-r--r--ARMeilleure/IntermediateRepresentation/OperationHelper.cs24
2 files changed, 34 insertions, 30 deletions
diff --git a/ARMeilleure/IntermediateRepresentation/OperandHelper.cs b/ARMeilleure/IntermediateRepresentation/OperandHelper.cs
index f7381d86..26d66478 100644
--- a/ARMeilleure/IntermediateRepresentation/OperandHelper.cs
+++ b/ARMeilleure/IntermediateRepresentation/OperandHelper.cs
@@ -4,16 +4,6 @@ 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);
@@ -84,22 +74,34 @@ namespace ARMeilleure.IntermediateRepresentation
return MemoryOperand().With(type, baseAddress, index, scale, displacement);
}
- public static void PrepareOperandPool(bool highCq)
+ #region "ThreadStaticPool"
+ public static void PrepareOperandPool(int groupId = 0)
{
- ThreadStaticPool<Operand>.PreparePool(highCq ? 1 : 0);
- ThreadStaticPool<MemoryOperand>.PreparePool(highCq ? 1 : 0);
+ ThreadStaticPool<Operand>.PreparePool(groupId, ChunkSizeLimit.Large);
+ ThreadStaticPool<MemoryOperand>.PreparePool(groupId, ChunkSizeLimit.Small);
+ }
+
+ private static Operand Operand()
+ {
+ return ThreadStaticPool<Operand>.Instance.Allocate();
+ }
+
+ private static MemoryOperand MemoryOperand()
+ {
+ return ThreadStaticPool<MemoryOperand>.Instance.Allocate();
}
- public static void ReturnOperandPool(bool highCq)
+ public static void ResetOperandPool(int groupId = 0)
{
- ThreadStaticPool<Operand>.ReturnPool(highCq ? 1 : 0);
- ThreadStaticPool<MemoryOperand>.ReturnPool(highCq ? 1 : 0);
+ ThreadStaticPool<MemoryOperand>.ResetPool(groupId);
+ ThreadStaticPool<Operand>.ResetPool(groupId);
}
- public static void ResetOperandPools()
+ public static void DisposeOperandPools()
{
- ThreadStaticPool<Operand>.ResetPools();
- ThreadStaticPool<MemoryOperand>.ResetPools();
+ ThreadStaticPool<Operand>.DisposePools();
+ ThreadStaticPool<MemoryOperand>.DisposePools();
}
+ #endregion
}
}
diff --git a/ARMeilleure/IntermediateRepresentation/OperationHelper.cs b/ARMeilleure/IntermediateRepresentation/OperationHelper.cs
index 538bdac4..0e560ee0 100644
--- a/ARMeilleure/IntermediateRepresentation/OperationHelper.cs
+++ b/ARMeilleure/IntermediateRepresentation/OperationHelper.cs
@@ -4,11 +4,6 @@ namespace ARMeilleure.IntermediateRepresentation
{
static class OperationHelper
{
- public static Operation Operation()
- {
- return ThreadStaticPool<Operation>.Instance.Allocate();
- }
-
public static Operation Operation(Instruction instruction, Operand destination)
{
return Operation().With(instruction, destination);
@@ -46,19 +41,26 @@ namespace ARMeilleure.IntermediateRepresentation
return Operation().With(instruction, destinations, sources);
}
- public static void PrepareOperationPool(bool highCq)
+ #region "ThreadStaticPool"
+ public static void PrepareOperationPool(int groupId = 0)
{
- ThreadStaticPool<Operation>.PreparePool(highCq ? 1 : 0);
+ ThreadStaticPool<Operation>.PreparePool(groupId, ChunkSizeLimit.Medium);
+ }
+
+ private static Operation Operation()
+ {
+ return ThreadStaticPool<Operation>.Instance.Allocate();
}
- public static void ReturnOperationPool(bool highCq)
+ public static void ResetOperationPool(int groupId = 0)
{
- ThreadStaticPool<Operation>.ReturnPool(highCq ? 1 : 0);
+ ThreadStaticPool<Operation>.ResetPool(groupId);
}
- public static void ResetOperationPools()
+ public static void DisposeOperationPools()
{
- ThreadStaticPool<Operation>.ResetPools();
+ ThreadStaticPool<Operation>.DisposePools();
}
+ #endregion
}
}