fix sever L4 errors
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
// -----------------------------------------------------------------------
|
||||
// file="L4"
|
||||
// Project: StgSharp
|
||||
// AuthorGroup: Nitload
|
||||
// Copyright (c) Nitload. All rights reserved.
|
||||
// AuthorGroup: Nitload Space
|
||||
// Copyright (c) Nitload Space. All rights reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -108,31 +108,24 @@ namespace StgSharp.HighPerformance.Memory
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public CacheLine Map(
|
||||
nuint origin
|
||||
)
|
||||
public CacheLine Map(nuint origin)
|
||||
{
|
||||
if (_aheadCount < PredictionLeastAhead)
|
||||
{
|
||||
while (true)
|
||||
if (Interlocked.CompareExchange(ref _prefetching, 1, 0) == 0)
|
||||
{
|
||||
if (Interlocked.CompareExchange(ref _prefetching, 1, 0) == 0)
|
||||
try
|
||||
{
|
||||
try
|
||||
if (_aheadCount < PredictionLeastAhead)
|
||||
{
|
||||
if (_aheadCount < PredictionLeastAhead)
|
||||
{
|
||||
// do prefetch in work load now, sync
|
||||
Prefetch();
|
||||
break;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_prefetching = 0;
|
||||
// do prefetch in work load now, sync
|
||||
Prefetch();
|
||||
}
|
||||
}
|
||||
Thread.Sleep(0);
|
||||
finally
|
||||
{
|
||||
_prefetching = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (true)
|
||||
@@ -145,6 +138,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
{
|
||||
(*_eviction)[entry->_id] = 0;
|
||||
_ = Interlocked.Increment(ref _activeCount);
|
||||
_ = Interlocked.Decrement(ref _aheadCount);
|
||||
return new CacheLine(entry->_address, ref _activeCount, ref entry->_refCount);
|
||||
} else
|
||||
{
|
||||
@@ -157,9 +151,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
|
||||
private partial void Prefetch();
|
||||
|
||||
private partial bool TestHit(
|
||||
nuint origin
|
||||
);
|
||||
private partial bool TestHit(nuint origin);
|
||||
|
||||
public ref struct CacheLine : IDisposable
|
||||
{
|
||||
@@ -168,11 +160,7 @@ namespace StgSharp.HighPerformance.Memory
|
||||
private ref int _refCount;
|
||||
private nuint _handle;
|
||||
|
||||
internal CacheLine(
|
||||
nuint handle,
|
||||
ref int activeCount,
|
||||
ref int cacheRefCount
|
||||
)
|
||||
internal CacheLine(nuint handle, ref int activeCount, ref int cacheRefCount)
|
||||
{
|
||||
_handle = handle;
|
||||
_refCount = ref cacheRefCount;
|
||||
|
||||
Reference in New Issue
Block a user