<> <> <> <> DIRECTORY DragOpsCross USING [Word]; CacheModel: CEDAR DEFINITIONS = BEGIN Word: TYPE = DragOpsCross.Word; wordsPerPage: CARDINAL = 1024; CacheBase: TYPE = REF CacheBaseRep; CacheBaseRep: 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 data: REF _ NIL, -- private data for clients intercepting fetch & store stats: CacheStats _ [] -- maintained by the default fetch and store routines ]; CacheFetchProc: TYPE = PROC [base: CacheBase, addr: Word, fromJump: BOOL _ FALSE]; CacheStoreProc: TYPE = PROC [base: CacheBase, addr: Word]; CacheStats: TYPE = RECORD [ probes: INT _ 0, chunkMisses: INT _ 0, lineMisses: INT _ 0, jumpMisses: INT _ 0, mapMisses: INT _ 0, dirtyWrites: INT _ 0 ]; NewCache: PROC [lines: [0..4096), quadsPerLine: [0..8), lru: BOOL _ FALSE] RETURNS [CacheBase]; <> ResetCache: PROC [cache: CacheBase]; <> <<>> FlushCache: PROC [cache: CacheBase]; <> Fetch: PROC [base: CacheBase, addr: Word, afterJump: BOOL _ FALSE] = INLINE { base.fetch[base, addr, afterJump]}; Store: PROC [base: CacheBase, addr: Word] = INLINE {base.store[base, addr]}; END.