L4 removes RRPV array, will not support cross-predictor reuse, will use out-line predictcount and map count array, will not use inline predict count.
This commit is contained in:
@@ -42,4 +42,16 @@ namespace StgSharp.HighPerformance.Memory
|
|||||||
: base($"L4 predictor with id {id} is null. Maybe it has been unregistered.") { }
|
: base($"L4 predictor with id {id} is null. Maybe it has been unregistered.") { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sealed class L4PredictConflictException : Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
public L4PredictConflictException(
|
||||||
|
nuint basePtr,
|
||||||
|
ushort policy,
|
||||||
|
int current
|
||||||
|
)
|
||||||
|
: base($"L4 predictor with id {current} has already registered a cache line with base pointer {basePtr} and policy {policy}.") { }
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,16 +93,15 @@ namespace StgSharp.HighPerformance.Memory
|
|||||||
// This branch performs resident-line adoption rather than a simple policy
|
// This branch performs resident-line adoption rather than a simple policy
|
||||||
// equality check. Returning true means the current predictor can keep using
|
// equality check. Returning true means the current predictor can keep using
|
||||||
// the existing cache bytes without a write-back plus re-prefetch cycle.
|
// the existing cache bytes without a write-back plus re-prefetch cycle.
|
||||||
if (predict.IsSamePolicy(head->Profile, belong))
|
if (!ReferenceEquals(predict, belong))
|
||||||
{
|
{
|
||||||
head->Predictor = (short)predictIndex;
|
throw new L4PredictConflictException(head->Origin, head->Profile, predictId);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// Compatibility failed, so the old owner must first flush its view of
|
// Compatibility failed, so the old owner must first flush its view of
|
||||||
// the line before the new predictor rematerializes the cache bytes.
|
// the line before the new predictor rematerializes the cache bytes.
|
||||||
belong.WriteBack(head->Origin, head->Profile, new ReadOnlySpan<byte>((byte*)head->Address, (int)head->Size));
|
|
||||||
head->Profile = pHandle.MapPolicy;
|
_ = Interlocked.Increment(ref head->RemainingPredictionCount);
|
||||||
predict.Prefetch(head->Origin, head->Profile, new Span<byte>((byte*)head->Address, (int)head->Size));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user