LoadStateFormat.mesa
last edited by Levin on June 17, 1983 2:04 pm
DIRECTORY
BcdDefs USING [MTIndex],
LoadState USING [BcdBase, CopiesList, GlobalFrameHandle, ModuleIndex, Type];
LoadStateFormat: DEFINITIONS =
BEGIN
OPEN LoadState;
Handle: TYPE = REF Object;
Object: TYPE = RECORD [ -- concrete version of LoadState.Object
useCount: INTEGER, -- -1 = exclusive, 0 = not in use, >0 = shared
changeCount: INT ← 0,
configTable: REF ConfigTable, -- <config, module> -> gf mapping
copyTable: REF CopyTable,
collisionTable: REF CollisionTable, --
gfht: ARRAY HashIndex OF Entry -- gf -> <config, module> mapping
];
htSize: NAT = 1019;
Selection criteria:
prime
expected number of modules / htsize ~= 1
SIZE[Entry]*htSize-3*SIZE[REF] is nearly a multiple of the virtual memory page size.
HashIndex: TYPE = NAT[0..htSize);
EntryType: TYPE = {empty, collision, copy, original};
Entry: TYPE = RECORD [
This is arranged to occupy a maximum of two words
SELECT type: EntryType FROM
empty => NULL,
collision => [list: CollisionTableIndex], -- appears only in hash table
copy => [
copyIndex: CopyIndex,
gfh: GlobalFrameHandle -- superfluous if Entry is in hash table
],
original => [
copyIndex: ShortCopyIndex,
configID: ConfigID,
module: ModuleIndex
],
ENDCASE
];
ConfigID: TYPE = NAT[0..256);
CollisionTableIndex: TYPE = NAT;
CollisionTable: TYPE = RECORD [
nCollisions: CollisionTableIndex,
collisions: SEQUENCE length: CollisionTableIndex OF CollisionList
];
CollisionList: TYPE = LIST OF Entry;
ConfigTable: TYPE = RECORD [
nConfigs: NAT,
configs: SEQUENCE length: NAT OF Config
];
Config: TYPE = REF ConfigObject;
ConfigObject: TYPE = RECORD [
bcd: BcdBase,
nModules: NAT,
modules: SEQUENCE length: NAT OF ModuleEntry -- replicated entries for multi-gft modules
];
ModuleEntry: TYPE = RECORD [
mti: BcdDefs.MTIndex,
gfh: GlobalFrameHandle,
type: Type
];
CopyIndex: TYPE = NAT[0..37777B]; -- packs with EntryType in a word
ShortCopyIndex: TYPE = NAT[0..77B]; -- packs with EntryType and ConfigID into a word
nullCopyIndex: CopyIndex = 0;
fuzzyCopyIndex: CopyIndex = ShortCopyIndex.LAST;
CopyTable: TYPE = RECORD [
nCopies: CopyIndex,
copies: SEQUENCE length: NAT OF CopyEntry
];
CopyEntry: TYPE = RECORD [
parent: GlobalFrameHandle,
copies: CopiesList
];
END.