SMBind.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
last edit by Satterthwaite, May 12, 1986 12:00:14 pm PDT
shared data definitions internal to the binder
DIRECTORY
BcdDefs:
TYPE
USING [
BcdBase, ControlItem, EXPHandle, Link, ModuleIndex,
--IRLinkLimit, MaxNDMi, MaxNMi,-- MTNull, NullLink, NullModule, ProcLimit],
TimeStamp: TYPE USING [Null, Stamp],
VM: TYPE USING [Interval, nullInterval];
SMBind: CEDAR DEFINITIONS ~ {
the modeller's representation of an interface record. Control link entries:
for a proc, [procedure[gfi~gfi, ep~ep, tag~TRUE]]
for a variable, [variable[vgfi~gfi, var~evi, vtag~var]]
for a module, [variable[vgfi~gfi, var~0, vtag~var]]
for an import, [procedure[gfi~dummyGfi, ep~index, tag~TRUE]]
IR: TYPE~REF InterfaceRecord;
InterfaceRecord:
TYPE~
RECORD[
name: ATOM←NIL,
stamp: TimeStamp.Stamp←TimeStamp.Null,
variants:
SELECT tag: *
FROM
virtual => [
dummyGfi: BcdDefs.ModuleIndexs.NullModule,
index: CARDINAL], -- to IMPRecord in bcd
real => [
SEQUENCE size:
NAT
OF
RECORD[link: BcdDefs.Links.NullLink] -- the links
],
ENDCASE
];
VIR: TYPE~REF InterfaceRecord.virtual;
RIR: TYPE~REF InterfaceRecord.real;
IRIndex: TYPE~[0..BcdDefs.ProcLimit*64--BcdDefs.IRLinkLimit--);
IRSeq: TYPE~REF IRSeqRecord;
IRSeqRecord:
TYPE~
RECORD[
body: SEQUENCE size: NAT OF IR -- ith element is IR associated with the ith import
];
BindInfo: TYPE~REF BindInfoRecord;
BindInfoRecord:
TYPE~
RECORD[
bcdSpace: VM.Interval←VM.nullInterval, -- the mapped-in bcd
bcd: BcdDefs.BcdBase←NIL, -- for bcdSpace (redundant but convenient)
moduleIndex: BcdDefs.ModuleIndexs.NullModule, -- dummy gfi in that config
nModules: NAT𡤀, -- (> 1 only for configs)
imports: IRSeq←NIL, -- [1 to bcdBase.nImports] (0 unused)
exports: IRSeq←NIL, -- exports[0] is the global frame
cm: BcdDefs.ControlItem←[module[BcdDefs.MTNull]],
linksResolved: BOOL←FALSE -- accelerator
];
the modeller's version of a dummy gfi relocation map
for importMap[0..bcdBase.nDummies),
importMap[gfi-importMap.bias] is the index into the import table for a dummy gfi
ImportMap: TYPE~REF ImportMapSeq;
ImportMapSeq:
TYPE~
RECORD[
bias: NAT←, -- the value of bcdBase.firstDummy
map:
SEQUENCE maxSize:
NAT
OF
RECORD[
index: NAT, -- to the import record
whichOne: [0..4--BcdDefs.MaxNMi--)]
];
RelocateLink: PROC[bindInfo: BindInfo, bcdLink: BcdDefs.Link] RETURNS[BcdDefs.Link];
ImportLink: PROC[gfi: BcdDefs.ModuleIndex, ep: IRIndex] RETURNS[BcdDefs.Link];
BuildInterface: PROC[bindInfo: BindInfo, eth: BcdDefs.EXPHandle] RETURNS[RIR];
BuildFramePtrInterface: PROC[bindInfo: BindInfo] RETURNS[RIR];
allocation/deallocation
AllocateIR: PROC[stamp: TimeStamp.Stamp, name: ATOM, size: NAT] RETURNS[RIR];
AllocateVIR: PROC[stamp: TimeStamp.Stamp, name: ATOM] RETURNS[VIR];
FreeIR: PROC[ir: IR] RETURNS[IR]; -- always gives NIL
}.