Clear JIT cache on exit (#1518)
* Initial cache memory allocator implementation * Get rid of CallFlag * Perform cache cleanup on exit * Basic cache invalidation * Thats not how conditionals works in C# it seems * Set PTC version to PR number * Address PR feedback * Update InstEmitFlowHelper.cs * Flag clear on address is no longer needed * Do not include exit block in function size calculation * Dispose jump table * For future use * InternalVersion = 1519 (force retest). Co-authored-by: LDj3SNuD <35856442+LDj3SNuD@users.noreply.github.com>
This commit is contained in:
parent
11222516c4
commit
61634dd415
24 changed files with 827 additions and 357 deletions
|
@ -4,12 +4,12 @@ using System.Numerics;
|
|||
|
||||
namespace ARMeilleure.Common
|
||||
{
|
||||
class BitMap : IEnumerator<int>
|
||||
class BitMap : IEnumerator<int>, IEnumerable<int>
|
||||
{
|
||||
private const int IntSize = 64;
|
||||
private const int IntMask = IntSize - 1;
|
||||
|
||||
private List<long> _masks;
|
||||
private readonly List<long> _masks;
|
||||
|
||||
private int _enumIndex;
|
||||
private long _enumMask;
|
||||
|
@ -57,7 +57,7 @@ namespace ARMeilleure.Common
|
|||
EnsureCapacity(bit + 1);
|
||||
|
||||
int wordIndex = bit / IntSize;
|
||||
int wordBit = bit & IntMask;
|
||||
int wordBit = bit & IntMask;
|
||||
|
||||
long wordMask = 1L << wordBit;
|
||||
|
||||
|
@ -76,7 +76,7 @@ namespace ARMeilleure.Common
|
|||
EnsureCapacity(bit + 1);
|
||||
|
||||
int wordIndex = bit / IntSize;
|
||||
int wordBit = bit & IntMask;
|
||||
int wordBit = bit & IntMask;
|
||||
|
||||
long wordMask = 1L << wordBit;
|
||||
|
||||
|
@ -88,11 +88,26 @@ namespace ARMeilleure.Common
|
|||
EnsureCapacity(bit + 1);
|
||||
|
||||
int wordIndex = bit / IntSize;
|
||||
int wordBit = bit & IntMask;
|
||||
int wordBit = bit & IntMask;
|
||||
|
||||
return (_masks[wordIndex] & (1L << wordBit)) != 0;
|
||||
}
|
||||
|
||||
public int FindFirstUnset()
|
||||
{
|
||||
for (int index = 0; index < _masks.Count; index++)
|
||||
{
|
||||
long mask = _masks[index];
|
||||
|
||||
if (mask != -1L)
|
||||
{
|
||||
return BitOperations.TrailingZeroCount(~mask) + index * IntSize;
|
||||
}
|
||||
}
|
||||
|
||||
return _masks.Count * IntSize;
|
||||
}
|
||||
|
||||
public bool Set(BitMap map)
|
||||
{
|
||||
EnsureCapacity(map._masks.Count * IntSize);
|
||||
|
@ -135,7 +150,7 @@ namespace ARMeilleure.Common
|
|||
return modified;
|
||||
}
|
||||
|
||||
#region IEnumerable<long> Methods
|
||||
#region IEnumerable<long> Methods
|
||||
|
||||
// Note: The bit enumerator is embedded in this class to avoid creating garbage when enumerating.
|
||||
|
||||
|
@ -147,6 +162,11 @@ namespace ARMeilleure.Common
|
|||
}
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public IEnumerator<int> GetEnumerator()
|
||||
{
|
||||
Reset();
|
||||
|
@ -180,6 +200,6 @@ namespace ARMeilleure.Common
|
|||
|
||||
public void Dispose() { }
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue