Symbols.mesa
Copyright Ó 1985, 1986, 1987, 1988, 1989, 1991 by Xerox Corporation. All rights reserved.
Satterthwaite, June 18, 1986 10:06:53 am PDT
Russ Atkinson (RRA) November 20, 1989 7:44:07 pm PST
DIRECTORY
MobDefs USING [VersionStamp],
Table USING [Base, IndexRep, Selector, Tag];
Symbols: DEFINITIONS = {
Base: TYPE = Table.Base;
tag codes (zero reserved for treeType)
htTag: Table.Tag = 1;
seTag: Table.Tag = 2;
hash table declarations
Name: TYPE = Base RELATIVE LONG POINTER TO HTRecord;
firstName: Name = LOOPHOLE[Table.IndexRep[tag: htTag, highBits: 0, lowBits: 0]];
nullName: Name = firstName;
HTIndex: TYPE = Name;
HTFirst: HTIndex = firstName;
HTNull: Name = nullName;
HTRecord: TYPE = MACHINE DEPENDENT RECORD [
link: HTIndex,
ssIndex: CARD16,
anyInternal, anyPublic: BOOL,
pad1: [0..63] ¬ 0,
pad2: BYTE ¬ 0
];
HVIndex: TYPE = [0..71);
HashVector: TYPE = ARRAY HVIndex OF HTIndex;
semantic entry table declarations
TypeClass: TYPE = MACHINE DEPENDENT {
mode (0),
basic,
signed,
unsigned,
real,
enumerated,
record,
ref,
array,
arraydesc,
transfer,
definition,
union,
sequence,
relative,
subrange,
opaque,
zone,
any,
nil (19)
};
TransferMode: TYPE = MACHINE DEPENDENT {
proc (0), port, signal, error, process, program, other, none (7)
};
UNSPEC: TYPE [SIZE[CARD]];
nullUNSPEC: UNSPEC = LOOPHOLE[CARD[0]];
opaque, conversions should use LOOPHOLE
SERecord: TYPE = MACHINE DEPENDENT RECORD [
sePad1: CARD16 ¬ 0, sePad2: [0..31] ¬ 0,
mark3: BOOL,
mark4: BOOL,
body: SELECT seTag: * FROM
id => [
extended, public, immutable, constant, linkSpace: BOOL ¬ FALSE,
idDecl: [0..7] ¬ 0, -- used for declaration processing (MimExpr, MimStmt)
idCtx: CTXIndex ¬ CTXNull,
idType: Type ¬ nullType,
idInfo: UNSPEC ¬ nullUNSPEC,
idValue: UNSPEC ¬ nullUNSPEC,
hash: Name ¬ nullName,
tagPad1: CARD16 ¬ 0,
flags: VariableFlags ¬ [],
special: SpecialVarKind ¬ normal,
ctxLink: SELECT linkTag: * FROM
terminal => [],
sequential => [],
linked => [link: ISEIndex],
embedded => [base: ISEIndex],
ENDCASE],
cons => [
align: Alignment,
typeInfo: SELECT typeTag: TypeClass FROM
All of these variants must begin and end on 32-bit boundaries.
mode => [],
basic => [
ordered: BOOL,
code: NAT15,
length: CARD16], -- in bits
signed => [
length: INT], -- in bits
unsigned => [
length: INT], -- in bits
real => [
length: INT], -- in bits
enumerated => [
range: CARD,
valueCtx: CTXIndex,
empty, sparse, painted, ordered, machineDep: BOOL,
spare1, spare2, spare3: BOOL ¬ FALSE,
pad1: BYTE ¬ 0,
pad2: CARD16 ¬ 0],
record => [
length: INT, -- in bits
fieldCtx: CTXIndex,
bitOrder: BitOrder,
grain: NAT15,
hints: MACHINE DEPENDENT RECORD [
comparable, assignable: BOOL,
unifield, variant, privateFields: BOOL,
refField, default, voidable: BOOL],
spare: BOOL,
packed, list: BOOL,
argument, monitored, machineDep, painted: BOOL,
linkPart: SELECT linkTag: * FROM
notLinked => [],
linked => [linkType: Type]
ENDCASE],
ref => [
refType: Type,
counted, ordered, readOnly, list, var, basing: BOOL,
spare1, spare2: BOOL ¬ FALSE,
pad: BYTE ¬ 0,
length: CARD16 ¬ 0], -- in bits
array => [
componentType: Type,
indexType: Type,
packed: BOOL,
bitOrder: BitOrder,
pad1: [0..63] ¬ 0,
pad2: BYTE ¬ 0,
pad3: CARD16 ¬ 0],
arraydesc => [
describedType: Type,
var: BOOL,
readOnly: BOOL,
bitOrder: BitOrder,
pad1: [0..31] ¬ 0,
pad2: BYTE ¬ 0,
length: CARD16 ¬ 0], -- in bits
transfer => [
typeIn: CSEIndex,
typeOut: CSEIndex,
mode: TransferMode,
safe: BOOL,
pad1: [0..15] ¬ 0,
pad2: BYTE ¬ 0,
length: CARD16 ¬ 0], -- in bits
definition => [
defCtx: CTXIndex,
slots: CARD16, -- slots in interface record
named: BOOL,
pad: NAT15 ¬ 0], -- obsolete
union => [
caseCtx: CTXIndex,
tagSei: ISEIndex,
hints: MACHINE DEPENDENT RECORD [
equalLengths, refField, default, voidable: BOOL],
overlaid, controlled, machineDep: BOOL,
spare: BOOL ¬ FALSE,
pad: BYTE ¬ 0,
bitOrder: BitOrder,
grain: NAT15],
sequence => [
parentType: RecordSEIndex,
tagSei: ISEIndex,
componentType: Type,
packed, controlled, machineDep: BOOL,
pad1: [0..31] ¬ 0,
pad2: BYTE ¬ 0,
bitOrder: BitOrder,
grain: NAT15],
relative => [
baseType: Type,
offsetType: Type,
resultType: Type],
subrange => [
rangeType: Type,
origin: INT,
range: CARD,
filled, biased, empty: BOOL,
pad1: [0..31] ¬ 0,
pad2: BYTE ¬ 0,
pad3: CARD16 ¬ 0],
opaque => [
id: ISEIndex,
length: INT, -- in bits
lengthKnown: BOOL,
pad1: NAT15 ¬ 0,
pad2: CARD16 ¬ 0],
zone => [
counted, mds: BOOL,
pad1: [0..63] ¬ 0,
pad2: BYTE ¬ 0,
length: CARD16 ¬ 0], -- in bits
any => [],
nil => []
ENDCASE],
ENDCASE];
SEIndex: TYPE = Base RELATIVE LONG POINTER TO SERecord;
SEPointer: TYPE = LONG POINTER TO SERecord;
Type: TYPE = SEIndex;
ISEIndex: TYPE = Base RELATIVE LONG POINTER TO SERecord.id;
ISEPointer: TYPE = LONG POINTER TO SERecord.id;
CSEIndex: TYPE = Base RELATIVE LONG POINTER TO SERecord.cons;
CSEPointer: TYPE = LONG POINTER TO SERecord.cons;
RecordSEIndex: TYPE = Base RELATIVE LONG POINTER TO SERecord.cons.record;
RefSEIndex: TYPE = Base RELATIVE LONG POINTER TO SERecord.cons.ref;
ArraySEIndex: TYPE = Base RELATIVE LONG POINTER TO SERecord.cons.array;
SEFirst: SEIndex = LOOPHOLE[Table.IndexRep[tag: seTag, highBits: 0, lowBits: 0]];
SENull: SEIndex = SEFirst;
nullType: Type = SENull;
ISEFirst: ISEIndex = LOOPHOLE[SEFirst];
ISENull: ISEIndex = LOOPHOLE[SENull];
CSEFirst: CSEIndex = LOOPHOLE[SEFirst];
CSENull: CSEIndex = LOOPHOLE[SENull];
RecordSENull: RecordSEIndex = LOOPHOLE[SENull];
RefSENull: RefSEIndex = LOOPHOLE[SENull];
ArraySENull: ArraySEIndex = LOOPHOLE[SENull];
VariableFlags: TYPE = MACHINE DEPENDENT RECORD [
valid: BOOL ¬ FALSE, -- TRUE => flags are valid for this var
used: BOOL ¬ FALSE, -- TRUE => var is used outside of its decl
addressed: BOOL ¬ FALSE, -- TRUE => var is addressed
assigned: BOOL ¬ FALSE, -- TRUE => var is assigned outside of its decl
upLevel: BOOL ¬ FALSE, -- TRUE => var is upLevel addressed
sized: BOOL ¬ FALSE, -- TRUE => derived from SIZE
spare1: BOOL ¬ FALSE, -- not used yet (reserved)
spare2: BOOL ¬ FALSE-- not used yet (reserved)
];
nullVariableFlags: VariableFlags = [];
SpecialVarKind: TYPE = MACHINE DEPENDENT {
normal (0), -- not special at all
globalLink (1), -- global link points at global frame
staticLink (2), -- static link points at frameExtension
frameExtension (3), -- container for upLevel vars
memoryLink (4), -- memory link points to frameExtension
returnLink (5), -- return link points to large return records
argLink (6), -- argLink points to parts of large argument records
returnVar (7), -- variable is offset from returnLink­
argVar (8), -- variable is offset from argLink­
globalVar (9), -- variable is offset from globalLink­
extensionVar (10), -- variable is offset from frameExtension
invalid (63)}; -- here to reserve extra states
the following two values are guaranteed by the compiler
typeTYPE: CSEIndex = CSENull + SERecord.cons.nil.SIZE;
typeANY: CSEIndex = typeTYPE + SERecord.cons.mode.SIZE;
codes identifying the basic types (extensible)
codeANY: NAT = 0;
codeCHAR: NAT = 1;
BitOrder: TYPE = MACHINE DEPENDENT {msBit, lsBit};
msBit => bit N is more significant than bit N+1 in a word
(PrincOps, Dragon, Motorola 680x0, IBM 360, Sparc)
lsBit => bit N+1 is more significant than bit N in a word
(PDP-11, VAX, Intel 80x86)
WordOrder: TYPE = MACHINE DEPENDENT {msWord, lsWord};
msWord => word N is more significant than word N+1 in multi-word arithmetic
lsWord => word N+1 is more significant than word N in multi-word arithmetic
BitCount: TYPE = INT;
sizes in bits
BitAddress: TYPE = MACHINE DEPENDENT RECORD [bd: BitCount];
ExtensionType: TYPE = MACHINE DEPENDENT {value, form, default, none};
Linkage: TYPE = MACHINE DEPENDENT {val, ref, type, manifest, none};
for import/export
RefClass: TYPE = MACHINE DEPENDENT {none, simple, composite};
Alignment: TYPE = MACHINE DEPENDENT {
none (0),
oneAU,
twoAU,
fourAU,
eightAU,
unknown};
context table declarations
ContextLevel: TYPE = BYTE;
lZ: ContextLevel = 0; -- context level of non-frame records
lG: ContextLevel = 1; -- context level of global frame
lL: ContextLevel = 2; -- context level of outer procedures
Closure: TYPE = MACHINE DEPENDENT {
none (0),
unit (1),
rc (2),
full (BYTE.LAST)}; -- completeness of copied contexts
CTXRecord: TYPE = MACHINE DEPENDENT RECORD [
seList: ISEIndex,
level: ContextLevel,
padTag1: BYTE ¬ 0,
padTag2: BYTE ¬ 0,
padTag3: [0..31] ¬ 0,
varUpdated: BOOL,
extension: SELECT ctxType: * FROM
simple => [
copied: Closure ¬ $unit,
pad1: BYTE ¬ 0, pad2: CARD16 ¬ 0
],
included => [
chain: IncludedCTXIndex,
module: MDIndex,
map: CTXIndex,
copied: Closure ¬ $none,
reset, closed, complete, restricted: BOOL,
pad3: [0..15] ¬ 0, pad4: CARD16 ¬ 0
],
imported => [
includeLink: IncludedCTXIndex
],
nil => []
ENDCASE
];
CTXIndex: TYPE = Base RELATIVE LONG ORDERED POINTER TO CTXRecord;
IncludedCTXIndex: TYPE = Base RELATIVE LONG ORDERED POINTER TO CTXRecord.included;
CTXFirst: CTXIndex = LOOPHOLE[Table.IndexRep[tag:0, highBits:0, lowBits:0]];
CTXNull: CTXIndex = CTXFirst;
IncludedCTXNull: IncludedCTXIndex = LOOPHOLE[CTXNull];
FirstStandardCtx: CTXIndex = CTXFirst+CTXRecord.nil.SIZE;
LastStandardCtx: CTXIndex = CTXFirst+6*CTXRecord.simple.SIZE;
module table declarations
FileIndex: TYPE = CARD16; -- internal file handle
nullFileIndex: FileIndex = FileIndex.LAST;
MDRecord: TYPE = MACHINE DEPENDENT RECORD [
stamp: MobDefs.VersionStamp,
moduleId: Name, -- hash entry for module name
fileId: HTIndex, -- hash entry for file name
shared: BOOL, -- overrides PRIVATE, etc.
exported: BOOL,
pad1: [0..63] ¬ 0,
pad2: BYTE ¬ 0,
file: FileIndex, -- associated file
ctx: IncludedCTXIndex, -- context of copied entries
defaultImport: CTXIndex -- unnamed imported instance
];
MDIndex: TYPE = Base RELATIVE LONG ORDERED POINTER TO MDRecord;
MDFirst: MDIndex = LOOPHOLE[Table.IndexRep[tag:0, highBits:0, lowBits:0]];
MDNull: MDIndex = LOOPHOLE[Table.IndexRep[tag:0]];
OwnMdi: MDIndex = MDFirst;
body table declarations
BodyLink: TYPE = MACHINE DEPENDENT RECORD [
which: {sibling, parent},
pad1: NAT15 ¬ 0, pad2: CARD16 ¬ 0,
index: BTIndex
];
BodyRecord: TYPE = MACHINE DEPENDENT RECORD [
link: BodyLink,
firstSon: BTIndex,
type: RecordSEIndex,
localCtx: CTXIndex,
sourceIndex: CARD,
info: BodyInfo,
level: ContextLevel,
class: ProcClass,
padTag: NAT15 ¬ 0,
extension: SELECT kind: * FROM
Callable => [
id: ISEIndex,
ioType: CSEIndex,
frameOffset: INT, -- offset in AUs from enclosing frame base
entryIndex: CARD16,
hints: MACHINE DEPENDENT RECORD [
safe, argUpdated, nameSafe, noStrings: BOOL,
pad: [0..15] ¬ 0
],
entry, internal, inline, monitored, noXfers, resident: BOOL,
kind: BodyKind],
Other => [relOffset: INT]
ENDCASE];
BodyKind: TYPE = {Outer, Inner, Catch, Other};
ProcClass: TYPE = MACHINE DEPENDENT {
Blank (0), -- field not set
Outer (1), -- outer-level normal procedure
Inner (2), -- nested normal procedure
Install (3), -- instalation procedure
Init (4), -- initialization procedure
Catch (5), -- procedure for catch phrases
Scope (6), -- procedure for ENABLE scopes
Fork (7), -- procedure for FORK base
Last (255)}; -- last code (not used)
BodyInfo: TYPE = MACHINE DEPENDENT RECORD [
padTag: NAT15 ¬ 0,
cases: SELECT mark: * FROM
Internal => [
frameSize: CARD16,
bodyTree: Base RELATIVE LONG POINTER, -- Tree.Index
thread: Base RELATIVE LONG POINTER], -- Tree.Index | LitDefs.STIndex
External => [
pad: CARD16,
bytes, startIndex, indexLength: INT]
ENDCASE];
BTIndex: TYPE = Base RELATIVE LONG POINTER TO BodyRecord;
CBTIndex: TYPE = Base RELATIVE LONG POINTER TO BodyRecord.Callable;
BTFirst: BTIndex = LOOPHOLE[Table.IndexRep[tag:0, highBits:0, lowBits:0]];
BTNull: BTIndex = LOOPHOLE[Table.IndexRep[tag:0]];
CBTNull: CBTIndex = LOOPHOLE[BTNull];
RootBti: CBTIndex = LOOPHOLE[BTFirst];
allocation codes for table components
seType: Table.Selector = 1;
htType: Table.Selector = 2;
ssType: Table.Selector = 3;
ctxType: Table.Selector = 4;
mdType: Table.Selector = 5;
bodyType: Table.Selector = 6;
}.