solution to unsafe operation in l4
This commit is contained in:
@@ -45,6 +45,32 @@ namespace StgSharp.HighPerformance.Memory
|
||||
public interface IL4Predict
|
||||
{
|
||||
|
||||
/*
|
||||
* Planned optimization contract types:
|
||||
* 1. internal interface IL4PredictOptimizationContract
|
||||
* - Trusted extension point queried once during predictor registration.
|
||||
* - Produces normalized compatibility tokens for a given map policy.
|
||||
* 2. readonly struct L4PredictCompatibilityToken
|
||||
* - Hot-path comparable descriptor cached by L4.
|
||||
* - Should at least carry ResidentFamily, FlushFamily and AccessMode.
|
||||
* 3. enum L4PredictAccessMode
|
||||
* - Distinguishes read-only sources from write-back or write-through targets.
|
||||
*
|
||||
* L4 should only use these cached tokens in the prefetch path. Predictors without the
|
||||
* internal contract stay on the conservative path: write back the old owner, then
|
||||
* rematerialize the cache line for the new predictor.
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether a cache line materialized by <paramref name="predict" /> under
|
||||
/// <paramref name="policy" /> can be adopted by the current predictor without an
|
||||
/// intermediate rematerialization.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is intentionally stronger than comparing raw policy bits for equality. A true
|
||||
/// result means the resident bytes can continue to be interpreted safely after ownership
|
||||
/// is transferred to the current predictor.
|
||||
/// </remarks>
|
||||
bool IsSamePolicy(
|
||||
uint policy,
|
||||
IL4Predict predict
|
||||
|
||||
Reference in New Issue
Block a user