solution to unsafe operation in l4
This commit is contained in:
@@ -88,11 +88,16 @@ namespace StgSharp.HighPerformance.Memory
|
||||
|
||||
int predictId = head->_predictor;
|
||||
IL4Predict belong = predictorSpan[predictId];
|
||||
// This branch performs resident-line adoption rather than a simple policy
|
||||
// equality check. Returning true means the current predictor can keep using
|
||||
// the existing cache bytes without a write-back plus re-prefetch cycle.
|
||||
if (predict.IsSamePolicy(head->_profile, belong))
|
||||
{
|
||||
head->_predictor =predictIndex;
|
||||
} else
|
||||
{
|
||||
// Compatibility failed, so the old owner must first flush its view of
|
||||
// the line before the new predictor rematerializes the cache bytes.
|
||||
belong.WriteBack(head->_origin, head->_profile, new ReadOnlySpan<byte>((byte*)head->_address, Unsafe.SizeOf<CacheLineData>()));
|
||||
head->_profile = pHandle.MapPolicy;
|
||||
predict.Prefetch(head->_origin, head->_profile, new Span<byte>((byte*)head->_address, Unsafe.SizeOf<CacheLineData>()));
|
||||
|
||||
Reference in New Issue
Block a user