PCMaps.mesa
Carl Hauser, May 13, 1987 6:01:45 pm PDT
PCMaps map program counters to word values. They are a special-purpose dictionary taking advantage of the structure and organization of the space containing code in Cedar. The implementation is subject to violent change, but the interface should be reasonably static.
PCMaps: CEDAR DEFINITIONS
~
BEGIN
Map: TYPE = LONG POINTER TO MapRep;
BytePC: TYPE = LONG CARDINAL; -- SIM
BytePC: TYPE = WORD; -- RDI
NewMap: PROC [maxPC: BytePC, nullVal: WORD] RETURNS [map: Map];
Lookup: PROC [map: Map, pc: BytePC] RETURNS [val: WORD];
Insert: PROC [map: Map, pc: BytePC, val: WORD];
Private Stuff
MapRep:
PRIVATE
TYPE =
MONITORED RECORD [
nEntries: CARD16,
table: HighOrderTable,
nullVal: WORD,
ref: REF MapRep -- a self-reference to make it uncollectable
];
HighOrderTable: PRIVATE TYPE = LONG POINTER TO HighOrderTableRep;
HighOrderTableRep:
PRIVATE TYPE =
RECORD [
s: SEQUENCE COMPUTED CARDINAL OF LowOrderTable
];
LowOrderTable: PRIVATE TYPE = LONG POINTER TO LowOrderTableRep;
LowOrderTableRep:
PRIVATE TYPE =
RECORD [
maxEntries: CARD16,
nEntries: CARD16,
s: SEQUENCE COMPUTED CARDINAL OF MapEntry
];
MapEntry:
TYPE =
RECORD [
lowOrderPC: CARD16,
value: WORD
];
END.