inline uptr untagPointer(uptr Ptr) { return Ptr & ((1ULL << 56) - 1); }
-inline uint8_t extractTag(uptr Ptr) {
- return (Ptr >> 56) & 0xf;
-}
+inline uint8_t extractTag(uptr Ptr) { return (Ptr >> 56) & 0xf; }
#else
class ScopedDisableMemoryTagChecks {
size_t PrevTCO;
- public:
+public:
ScopedDisableMemoryTagChecks() {
__asm__ __volatile__(".arch_extension mte; mrs %0, tco; msr tco, #1"
: "=r"(PrevTCO));
2:
)"
- : [ Cur ] "+&r"(RoundOldPtr), [ End ] "+&r"(NewPtr)
- : [ BlockEnd ] "r"(BlockEnd)
+ : [Cur] "+&r"(RoundOldPtr), [End] "+&r"(NewPtr)
+ : [BlockEnd] "r"(BlockEnd)
: "memory");
}
atomic_u32 Val;
public:
- Options load() const {
- return Options{atomic_load(&Val, memory_order_relaxed)};
- }
+ Options load() const { return Options{atomic_load_relaxed(&Val)}; }
void clear(OptionBit Opt) {
atomic_fetch_and(&Val, ~(1U << static_cast<u32>(Opt)),
}
void setFillContentsMode(FillContentsMode FillContents) {
- u32 Opts = atomic_load(&Val, memory_order_relaxed), NewOpts;
+ u32 Opts = atomic_load_relaxed(&Val), NewOpts;
do {
NewOpts = Opts;
NewOpts &= ~(3U << static_cast<u32>(OptionBit::FillContents0of2));
const s32 Interval =
Max(Min(static_cast<s32>(Value), MaxReleaseToOsIntervalMs),
MinReleaseToOsIntervalMs);
- atomic_store(&ReleaseToOsIntervalMs, Interval, memory_order_relaxed);
+ atomic_store_relaxed(&ReleaseToOsIntervalMs, Interval);
return true;
}
// Not supported by the Primary, but not an error either.
}
if (!Force) {
- const s32 IntervalMs =
- atomic_load(&ReleaseToOsIntervalMs, memory_order_relaxed);
+ const s32 IntervalMs = atomic_load_relaxed(&ReleaseToOsIntervalMs);
if (IntervalMs < 0)
return 0;
if (Sci->ReleaseInfo.LastReleaseAtNs +
const s32 Interval =
Max(Min(static_cast<s32>(Value), MaxReleaseToOsIntervalMs),
MinReleaseToOsIntervalMs);
- atomic_store(&ReleaseToOsIntervalMs, Interval, memory_order_relaxed);
+ atomic_store_relaxed(&ReleaseToOsIntervalMs, Interval);
return true;
}
// Not supported by the Primary, but not an error either.
}
if (!Force) {
- const s32 IntervalMs =
- atomic_load(&ReleaseToOsIntervalMs, memory_order_relaxed);
+ const s32 IntervalMs = atomic_load_relaxed(&ReleaseToOsIntervalMs);
if (IntervalMs < 0)
return 0;
if (Region->ReleaseInfo.LastReleaseAtNs +
bool EntryCached = false;
bool EmptyCache = false;
const u64 Time = getMonotonicTime();
- const u32 MaxCount = atomic_load(&MaxEntriesCount, memory_order_relaxed);
+ const u32 MaxCount = atomic_load_relaxed(&MaxEntriesCount);
{
ScopedLock L(Mutex);
if (EntriesCount >= MaxCount) {
s32 Interval;
if (EmptyCache)
empty();
- else if ((Interval = atomic_load(&ReleaseToOsIntervalMs,
- memory_order_relaxed)) >= 0)
+ else if ((Interval = atomic_load_relaxed(&ReleaseToOsIntervalMs)) >= 0)
releaseOlderThan(Time - static_cast<u64>(Interval) * 1000000);
return EntryCached;
}
bool retrieve(uptr Size, LargeBlock::Header **H) {
const uptr PageSize = getPageSizeCached();
- const u32 MaxCount = atomic_load(&MaxEntriesCount, memory_order_relaxed);
+ const u32 MaxCount = atomic_load_relaxed(&MaxEntriesCount);
ScopedLock L(Mutex);
if (EntriesCount == 0)
return false;
}
bool canCache(uptr Size) {
- return atomic_load(&MaxEntriesCount, memory_order_relaxed) != 0U &&
- Size <= atomic_load(&MaxEntrySize, memory_order_relaxed);
+ return atomic_load_relaxed(&MaxEntriesCount) != 0U &&
+ Size <= atomic_load_relaxed(&MaxEntrySize);
}
bool setOption(Option O, sptr Value) {
const s32 Interval =
Max(Min(static_cast<s32>(Value), MaxReleaseToOsIntervalMs),
MinReleaseToOsIntervalMs);
- atomic_store(&ReleaseToOsIntervalMs, Interval, memory_order_relaxed);
+ atomic_store_relaxed(&ReleaseToOsIntervalMs, Interval);
return true;
} else if (O == Option::MaxCacheEntriesCount) {
const u32 MaxCount = static_cast<u32>(Value);
if (MaxCount > EntriesArraySize)
return false;
- atomic_store(&MaxEntriesCount, MaxCount, memory_order_relaxed);
+ atomic_store_relaxed(&MaxEntriesCount, MaxCount);
return true;
} else if (O == Option::MaxCacheEntrySize) {
- atomic_store(&MaxEntrySize, static_cast<uptr>(Value),
- memory_order_relaxed);
+ atomic_store_relaxed(&MaxEntrySize, static_cast<uptr>(Value));
return true;
}
// Not supported by the Secondary Cache, but not an error either.
static const u32 R = 24;
u32 H;
- public:
+public:
explicit MurMur2HashBuilder(u32 Init = 0) { H = Seed ^ Init; }
void add(u32 K) {
K *= M;