RCMapOps.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Rovner On September 19, 1983 9:31 pm
Russ Atkinson (RRA) January 31, 1985 1:11:22 pm PST
Satterthwaite April 23, 1986 11:34:52 am PST
DIRECTORY
RCMap: TYPE USING[Base, Index],
SymbolTable: TYPE USING[Base],
Symbols: TYPE USING[Type, MDIndex];
RCMapOps: DEFINITIONS = {
TYPEs
RCMapTable: TYPE;
RCMT: TYPE = LONG POINTER TO RCMapTable;
OuterProc: TYPE =
PROC[stb: SymbolTable.Base, mdi: Symbols.MDIndex, inner: PROC[base: SymbolTable.Base]];
MapMap: TYPE = LONG POINTER TO MapMapObj; -- built by Include
MapMapObj: TYPE = RECORD[SEQUENCE length: CARDINAL OF MapMapItem];
MapMapItem: TYPE = RECORD[old, new: RCMap.Index];
OPERATIONs
Create an RCMapTable object
ASSUME ptr was allocated by VM.Allocate
Note that access to this object is not monitored
Create: PROC[
zone: UNCOUNTED ZONE,
ptr: RCMap.Base, nPages: CARDINAL, outerProc: OuterProc←NIL,
expansionOK: BOOLFALSE]
RETURNS[RCMT];
Destroy: PROC[rcmt: RCMT] RETURNS[RCMT];
Retrieve info about the RCMap.Base
GetSpan: PROC[rcmt: RCMT] RETURNS[base: RCMap.Base, size: CARDINAL];
Returns the RCMap.Index of the RCMap for the specified type.
Makes an entry if necessary.
Acquire: PROC[rcmt: RCMT, stb: SymbolTable.Base, type: Symbols.Type]
RETURNS[RCMap.Index];
Merges the specified RCMap.Base into the table object.
If zone # NIL, allocates and returns a MapMap
Include: PROC[
rcmt: RCMT, rcmb: RCMap.Base, size: CARDINAL, zone: UNCOUNTED ZONENIL]
RETURNS[MapMap];
Does a MapMap lookup: returns the index in the current RCMap.Base that corresponds
to the specified index in the RCMap.Base that Include processed.
FindMapMapEntry: PROC[mapMap: MapMap, oldIndex: RCMap.Index]
RETURNS[RCMap.Index];
Enumerate: PROC[
base: RCMap.Base,
limit: CARDINAL,
proc: PROC[RCMap.Index] RETURNS[stop: BOOL]]
RETURNS[stopped: BOOLEAN];
}.
BEWARE: If you allow expansion of the RCMap Base, you must be careful about concurrent access to the existing Base. In current Cedar, for performance reasons (all accesses to the Base would have to be protected by a monitor), the Cedar runtime does not allow expansion (ERROR if RCMap Base overflows).