BcdDefs.mesa
last edited by Satterthwaite on June 3, 1986 10:45:06 am PDT
DIRECTORY
PrincOps: TYPE USING [MaxFrameSize],
Table: TYPE USING [Base, Selector],
TimeStamp: TYPE USING [Null, Stamp],
VM: TYPE USING [wordsPerPage];
BcdDefs: DEFINITIONS = {
base pointer types
Base: TYPE = Table.Base;
BcdBase: TYPE = LONG POINTER TO BCD;
NTHandle: TYPE = LONG POINTER TO NTRecord;
CTHandle: TYPE = LONG POINTER TO CTRecord;
MTHandle: TYPE = LONG POINTER TO MTRecord;
IMPHandle: TYPE = LONG POINTER TO IMPRecord;
EXPHandle: TYPE = LONG POINTER TO EXPRecord;
EVHandle: TYPE = LONG POINTER TO EVRecord;
SGHandle: TYPE = LONG POINTER TO SGRecord;
FTHandle: TYPE = LONG POINTER TO FTRecord;
SPHandle: TYPE = LONG POINTER TO SPRecord;
FPHandle: TYPE = LONG POINTER TO FPRecord;
TYPHandle: TYPE = LONG POINTER TO TYPRecord;
TMHandle: TYPE = LONG POINTER TO TMRecord;
NameString: TYPE = LONG POINTER TO PackedString;
allocation codes for the binder
BinderNTables: CARDINAL = 20;
Selector: TYPE = Table.Selector[0..BinderNTables);
treetype: Selector = 0; -- trees
httype: Selector = 1; -- hash table
sstype: Selector = 2; -- (packed) string table
cttype: Selector = 3; -- config table
mttype: Selector = 4; -- module table
imptype: Selector = 5; -- import table
exptype: Selector = 6; -- export table
sgtype: Selector = 7; -- segment table
fttype: Selector = 8; -- file table
sttype: Selector = 9; -- semantic table
cxtype: Selector = 10; -- context table
nttype: Selector = 11; -- name table
evtype: Selector = 12; -- external variable table
sptype: Selector = 13; -- space table
fptype: Selector = 14; -- frame pack table
typtype: Selector = 15; -- type table
tmtype: Selector = 16; -- type table
lftype: Selector = 17; -- link fragment table
rftype: Selector = 18; -- ref literal and atom fragment table
tftype: Selector = 19; -- type fragment table
version identification
VersionStamp: TYPE = TimeStamp.Stamp;
NullVersion: TimeStamp.Stamp = TimeStamp.Null;
BCD Header
VersionID: CARDINAL = 03066;
BCD:
TYPE =
RECORD[
versionIdent: CARDINAL,
version: VersionStamp,
creator: VersionStamp,
sourceVersion: VersionStamp,
source: NameRecord,
spare1, spare2: BOOL,
nPages: [0..512),
nConfigs, nModules: CARDINAL,
nImports, nExports: CARDINAL,
definitions, repackaged, typeExported, tableCompiled: BOOL,
versions: BOOL,
extended: BOOL←TRUE,
firstdummy: ModuleIndex,
nDummies: CARDINAL,
ssOffset: CARDINAL, -- string table
ssLimit: CARDINAL,
ctOffset: CARDINAL, -- config table
ctLimit: CTIndex,
mtOffset: CARDINAL, -- module table
mtLimit: MTIndex,
impOffset: CARDINAL, -- import table
impLimit: IMPIndex,
expOffset: CARDINAL, -- export table
expLimit: EXPIndex,
evOffset: CARDINAL, -- external variable table
evLimit: EVIndex,
sgOffset: CARDINAL, -- segment table
sgLimit: SGIndex,
ftOffset: CARDINAL, -- file table
ftLimit: FTIndex,
spOffset: CARDINAL, -- space table
spLimit: SPIndex,
ntOffset: CARDINAL, -- name table
ntLimit: NTIndex,
typOffset: CARDINAL, -- type table
typLimit: TYPIndex,
tmOffset: CARDINAL, -- type map table
tmLimit: TMIndex,
fpOffset: CARDINAL, -- frame pack table
fpLimit: FPIndex,
lfOffset: CARDINAL, -- link fragment table
lfLimit: LFIndex,
rfOffset: CARDINAL, -- ref literal fragment table
rfLimit: RFIndex,
tfOffset: CARDINAL, -- type fragment table
tfLimit: TFIndex,
rtPages: RECORD[relPageBase, pages: [0..256)]]; -- atom print names, type table, etc.
PageSize: NAT = VM.wordsPerPage;
Portable Type
Portable: TYPE = {module, interface};
Name Table
PackedString:
TYPE =
MACHINE
DEPENDENT
RECORD[
SELECT
OVERLAID *
FROM
string => [string: StringBody],
size => [size: PACKED ARRAY [-3..-3) OF [0..256)]
ENDCASE];
NameRecord: TYPE = RECORD[CARDINAL];
NullName: NameRecord = [1];
NTRecord: TYPE = RECORD[name: NameRecord, item: Namee];
Namee:
TYPE =
RECORD[
SELECT type: *
FROM
config => [cti: CTIndex],
module => [mti: MTIndex],
import => [impi: IMPIndex],
export => [expi: EXPIndex]
ENDCASE];
NTIndex: TYPE = Base RELATIVE LONG POINTER TO NTRecord;
NTNull: NTIndex = NTIndex.LAST;
Configuration Table
CTRecord:
TYPE =
--MACHINE DEPENDENT--
RECORD[
name: NameRecord,
namedInstance: BOOL,
file: FTIndex,
config: CTIndex,
nControls: CARDINAL,
controls: ARRAY [0..0) OF Namee]; -- only config or module are valid
CTIndex: TYPE = Base RELATIVE LONG POINTER TO CTRecord;
CTNull: CTIndex = CTIndex.LAST;
Module Table
LinkLocation: TYPE = {frame, code, dontcare};
MTRecord:
TYPE =
--MACHINE DEPENDENT--
RECORD[
name: NameRecord,
namedInstance: BOOL,
initial: BOOL,
file: FTIndex,
linkLoc: LinkLocation,
config: CTIndex,
code: CodeDesc,
sseg: SGIndex,
long, tableCompiled, boundsChecks, nilChecks: BOOL,
links: LFIndex,
refLiterals: RFIndex,
types: TFIndex,
frameRefs: BOOL,
frameType: TypeIndex,
framesize: [0..PrincOps.MaxFrameSize),
spare: BOOL←FALSE,
residentFrame, crossJumped, packageable: BOOL,
gfi: ModuleIndex,
variables: EVIndex,
ngfi: [1..MaxNMi]];
CodeDesc:
TYPE =
RECORD[
sgi: SGIndex, packed: BOOL, linkspace: BOOL, offset, length: CARDINAL];
MTIndex: TYPE = Base RELATIVE LONG POINTER TO MTRecord;
MTNull: MTIndex = MTIndex.LAST;
Import Table
IMPRecord:
TYPE =
RECORD[
name: NameRecord,
port: Portable,
namedInstance: BOOL,
file: FTIndex,
gfi: ModuleIndex,
ngfi: [1..MaxNDMi]];
IMPIndex: TYPE = Base RELATIVE LONG POINTER TO IMPRecord;
IMPNull: IMPIndex = IMPIndex.LAST;
Export Table
EXPRecord:
TYPE =
--MACHINE DEPENDENT--
RECORD[
name: NameRecord,
size: [0..377b],
port: Portable,
namedInstance, typeExported: BOOL,
file: FTIndex,
links: ARRAY [0..0) OF Link];
EXPIndex: TYPE = Base RELATIVE LONG POINTER TO EXPRecord;
EXPNull: EXPIndex = EXPIndex.LAST;
External Variable Table
EVRecord: TYPE = RECORD[length: CARDINAL, offsets: ARRAY [1..1) OF CARDINAL];
EVIndex: TYPE = Base RELATIVE LONG POINTER TO EVRecord;
EVNull: EVIndex = EVIndex.LAST;
Segment Table
SegClass: TYPE = {code, symbols, acMap, other};
SGRecord:
TYPE =
RECORD[
class: SegClass, file: FTIndex, base: CARDINAL, pages, extraPages: [0..256)];
SGIndex: TYPE = Base RELATIVE LONG POINTER TO SGRecord;
SGNull: SGIndex = SGIndex.LAST;
File Table
FTRecord: TYPE = RECORD[name: NameRecord, version: VersionStamp];
FTIndex: TYPE = Base RELATIVE LONG POINTER TO FTRecord;
FTNull: FTIndex = FTIndex.LAST;
FTSelf: FTIndex = FTIndex.LAST - 1;
Space Table
SPRecord:
TYPE =
--MACHINE DEPENDENT--
RECORD[
seg: SGIndex,
name: NameRecord,
length: CARDINAL, spaces: ARRAY [0..0) OF SpaceID];
SpaceID:
TYPE =
RECORD[
name: NameRecord, resident: BOOL, offset: [0..256), pages: [1..128]];
SPIndex: TYPE = Base RELATIVE LONG POINTER TO SPRecord;
SPNull: SPIndex = SPIndex.LAST;
Frame Pack Table
FPRecord:
TYPE =
--MACHINE DEPENDENT--
RECORD[
name: NameRecord, length: CARDINAL, modules: ARRAY [0..0) OF MTIndex];
FPIndex: TYPE = Base RELATIVE LONG POINTER TO FPRecord;
FPNull: FPIndex = FPIndex.LAST;
Type Table
TYPRecord: TYPE = RECORD[version: VersionStamp, id: RECORD[UNSPECIFIED]];
TYPIndex: TYPE = Base RELATIVE --LONG-- POINTER[0..CARDINAL.LAST] TO TYPRecord;
TYPNull: TYPIndex = TYPIndex.LAST;
Type Map Table
TMRecord:
TYPE =
RECORD[
version: VersionStamp, offset: CARDINAL, map: TYPIndex];
TMIndex: TYPE = Base RELATIVE LONG POINTER TO TMRecord;
TMNull: TMIndex = TMIndex.LAST;
Links
ModuleIndex: TYPE = [0..1777b];
nullModule, NullModule: ModuleIndex = ModuleIndex.FIRST;
ProcIndex: TYPE = [0..37b];
ProcLimit: CARDINAL = ProcIndex.LAST + 1;
VarIndex: TYPE = [0..17b];
VarLimit: CARDINAL = VarIndex.LAST + 1;
MaxNMi: CARDINAL = 4;
EPLimit: CARDINAL = ProcLimit*MaxNMi;
MaxNDMi: CARDINAL = 64;
IRLinkLimit: CARDINAL = ProcLimit*MaxNDMi;
nullLink, NullLink: Link = [procedure[0, 0, FALSE]];
unboundLink, UnboundLink: Link = [procedure[0, 0, TRUE]];
LinkTag: TYPE = {variable, procedure, type};
VarTag: TYPE = MACHINE DEPENDENT {var(0), proc0(1), type(2), proc1(3)};
LinkFrag: TYPE = RECORD[frag: SEQUENCE length: NAT OF Link];
Link:
TYPE =
MACHINE
DEPENDENT
RECORD[
rep(0):
SELECT
OVERLAID LinkTag
FROM
-- decoded by self.vtag
variable => [vgfi(0:0..15): ModuleIndex, var(0:16..29): VarIndex, vtag(0:30..31): VarTag],
procedure => [gfi(0:0..15): ModuleIndex, ep(0:16..30): ProcIndex, tag(0:31..31): BOOL],
type => [typeID(0:0..15): TYPIndex, type(0:16..30): BOOL, proc(0:31..31): BOOL]
ENDCASE];
LFIndex: TYPE = Base RELATIVE LONG POINTER TO LinkFrag;
LFNull: LFIndex = LFIndex.LAST;
Atoms and REFs to literals
RefLitFrag: TYPE = RECORD[offset: CARDINAL, frag: SEQUENCE length: NAT OF RefLitIndex];
RefLitIndex: TYPE = RECORD[NAT];
RFIndex: TYPE = Base RELATIVE LONG POINTER TO RefLitFrag;
RFNull: RFIndex = RFIndex.LAST;
Types
TypeFrag: TYPE = RECORD[offset: CARDINAL, frag: SEQUENCE length: NAT OF TypeIndex];
TypeIndex: TYPE = RECORD[NAT];
TFIndex: TYPE = Base RELATIVE LONG POINTER TO TypeFrag;
TFNull: TFIndex = TFIndex.LAST;