-- Store>CachedSpace.mesa (last edited by Gobbel on June 16, 1980 3:42 PM)
DIRECTORY
Space USING [WindowOrigin],
Transaction USING [Handle],
VM USING [Interval, PageCount, PageNumber];
CachedSpace: DEFINITIONS
IMPORTS Transaction =
BEGIN
Level: TYPE = [0..4);-- see CachedRegion.Desc for packing considerations.
SizeSwapUnit: TYPE = [VM.PageCount[0]..VM.PageCount[64]);-- (note: 0 is an illegal value.)
Handle: TYPE = RECORD [level: Level, page: VM.PageNumber];-- the implemenation of a Space.Handle.
handleVM: Handle = [level: 0, page: 0];-- the root of the space tree.
handleNull: Handle = [level: 0, page: LAST[VM.PageNumber]];-- not a space.
State: TYPE = {missing, unmapped, mapped, beingRemapped};
DataOrFile: TYPE = {data, file};
Desc: TYPE = RECORD [
interval: VM.Interval,
level: Level,
dPinned: BOOLEAN,-- descriptor ineligible for replacement?
dDirty: BOOLEAN,-- descriptor modified since cached?
pinned: BOOLEAN,-- TRUE only if space or ancestor is mapped.
state: State,
writeProtected: BOOLEAN,-- window.file is immutable or doesn’t have write permission.
hasSwapUnits: BOOLEAN,
sizeSwapUnit: SizeSwapUnit,-- assuming hasSwapUnits.
dataOrFile: DataOrFile,
pageRover: VM.PageNumber,-- for Space.Create with default base.
vp: SELECT OVERLAID * FROM
short => NULL,
long => [
window: WindowOrigin,
countMapped: VM.PageCount,
transaction: Transaction.Handle],-- Transaction.nullHandle here means no transaction
ENDCASE];
PDesc: TYPE = LONG POINTER TO Desc;
WindowOrigin: TYPE = Space.WindowOrigin;
-- Interpretation of handles by these operations is not "strict": page may be any page of space
Insert: PROCEDURE [pDescVictim: PDesc, pDesc: PDesc];
-- Inserts a Desc into the space cache.
-- Upon return, if pDescVictim.dDirty, then pDescVictim↑ must be written through to higher level database.
-- pDesc.dPinned and pDesc.dDirty are significant.
Delete: PROCEDURE [space: Handle];
Get: PROCEDURE [pDescResult: PDesc, space: Handle];
-- "Get descriptor." If not found, returns Desc[..., state: missing, ...].
Update: PROCEDURE [pDesc: PDesc] RETURNS [found: BOOLEAN];
-- pDesc.dPinned is significant; cached desc.dDirty is set as side-effect
END.
Notes
It is necessary to avoid page faults within the monitor implementing this interface. In a system with a resident and a nonresident frame heap, it is important to prevent long parameter or result records from being allocated in the nonresident frame heap. When the stack is increased to 16 words, all the above parameter/result records would fit on the stack even with the by-reference changed to by-value. In the mean time, it is up to the caller to provide references to resident storage.
LOG
Time: March 1, 1978 2:25 PMBy: McJonesAction: Created file
Time: August 1, 1978 4:21 PMBy: McJonesAction: Removed dataOrFile from state
Time: August 11, 1978 11:48 AMBy: McJonesAction: Added beingRemapped to State
Time: September 10, 1978 1:23 PMBy: McJonesAction: Added pinned field to Desc
Time: February 1, 1979 1:59 PMBy: McJonesCR20.169: Added pageRover (and variants to Desc)
Time: March 5, 1979 2:25 PMBy: McJonesAction: Added Handle, handleVM
Time: August 27, 1979 10:10 AMBy: KnutsenAction: Improved documentation.
Time: September 14, 1979 5:33 PMBy: KnutsenAction: Added hasSwapUnits, sizeSwapUnit.
Time: April 11, 1980 12:30 PMBy: KnutsenAction: Allow SizeSwapUnit[0].
Time: May 20, 1980 4:44 PMBy: GobbelAction: Added transaction handle to Desc.