Cache Related Types
Cache: TYPE = REF CacheRec;
CacheRec:
TYPE =
RECORD [
private: REF ← NIL, -- private data to the cache implementation
fetch: CacheFetchProc ← NIL, -- this hook allows the user to intercept cache accesses
store: CacheStoreProc ← NIL, -- this hook allows the user to intercept cache accesses
reset: CacheResetProc ← NIL, -- Resets the given cache to its initial state
flush: CacheFlushProc ← NIL, -- Forget everything it knows, but don't effect stats
print: CachePrintProc ← NIL, -- Print statistics, and eventually resets them
data: REF ← NIL -- private data for clients intercepting fetch & store
];
CacheFetchProc: TYPE = PROC [cache: Cache, addr: Word, fromJump: BOOL ← FALSE];
CacheStoreProc: TYPE = PROC [cache: Cache, addr: Word];
CacheResetProc: TYPE = PROC [cache: Cache];
CacheFlushProc: TYPE = PROC [cache: Cache];
CachePrintProc: TYPE = PROC [cache: Cache, stream: IO.STREAM, name: Rope.ROPE, resetStatistics: BOOL ← TRUE];
Short ways of calling
Fetch: CacheFetchProc = INLINE {cache.fetch[cache, addr, fromJump]};
Store: CacheStoreProc = INLINE {cache.store[cache, addr]};
Reset: CacheResetProc = INLINE {cache.reset[cache]};
Flush: CacheFlushProc = INLINE {cache.flush[cache]};
Print: CachePrintProc = INLINE {cache.print[cache, stream, name]};