RTTypesBasicPrivate.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Paul Rovner, June 17, 1983 8:35 am
Richard Koo, July 4, 1984 11:06:00 am PDT
Russ Atkinson (RRA) February 1, 1985 12:38:55 pm PST
Beach, February 22, 1985 3:02:36 pm PST
Doug Wyatt, February 24, 1985 8:51:25 pm PST
DIRECTORY
BcdDefs USING[SGIndex, SGNull, BcdBase],
RCMap USING[Index, nullIndex, Limit],
Rope USING[ROPE],
SafeStorage USING[TypeIndex, Type, nullType],
RTSymbolDefs USING[SymbolTableHandle, nullHandle, SymbolIndex, nullSymbolIndex],
TimeStamp USING[Stamp],
TypeHash USING [TypeKey],
TypeStrings USING[TypeString];
RTTypesBasicPrivate: DEFINITIONS
= BEGIN
Types
MapTiTd: TMapTiTd; -- The Runtime Type Table: maps SafeStorage.TypeIndex to TypeDesc
RMapTiTd: TYPE = RECORD[ptds: SEQUENCE length: NAT OF PTypeDesc];
TMapTiTd: TYPE = LONG POINTER TO RMapTiTd;
PTypeDesc: TYPE = LONG POINTER TO TypeDesc;
TypeDesc: TYPE = MACHINE DEPENDENT RECORD[
equivalentTypePad: [0..3] ← 0,
equivalentType: SafeStorage.Type ← SafeStorage.nullType, -- nullType means not "canonicalized"
finalized: BOOLFALSE,
numberPackageRefs: NAT ← 0, -- ucode does not depend on stuff below
rcmx: RCMap.Index ← RCMap.nullIndex,
fill: [0..LAST[CARDINAL]/RCMap.Limit] ← 0,
utf: UniqueTypeFinger,
symbolAccess: SymbolAccess,
next: PTypeDesc ← NIL, -- link in list of types with the same ts hash
myTypePad: [0..3] ← 0,
myType: SafeStorage.Type, -- a back pointer(logically)
typekey: TypeHash.TypeKey,
extension: PTypeExtension ← NIL -- LOOPHOLE
];
SymbolAccess: TYPE = RECORD[
sti: SymbolTableIndex ← 0,
sei: RTSymbolDefs.SymbolIndex ← RTSymbolDefs.nullSymbolIndex
];
SymbolTableIndex: TYPE = NAT; -- index into MapStiStd
PTypeExtension: TYPE = LONG POINTER TO TypeExtension; -- LOOPHOLE
RTypeExtension: TYPE = REF TypeExtension;
TypeExtension: TYPE = RECORD [
next: RTypeExtension, -- link in the list of them; stay honest
finalizationSet: REFNIL,
attachment: REF ANYNIL
];
Access to symbol table information
MapStiStd: TMapStiStd; -- The map from SymbolTableIndex to STDesc. DELICATE intialization.
TMapStiStd: TYPE = REF RMapStiStd;
RMapStiStd: TYPE = RECORD[stiv: SEQUENCE length: SymbolTableIndex OF RSTDesc];
LOOPHOLEDTMapStiStd: TYPE = LONG POINTER TO LOOPHOLEDRMapStiStd;
LOOPHOLEDRMapStiStd: TYPE = RECORD[
stiv: SEQUENCE length: SymbolTableIndex OF PSTDesc];
InitialSTIRangeSize: CARDINAL = 4000B;
RSTDesc: TYPE = REF STDesc;
PSTDesc: TYPE = LONG POINTER TO STDesc;
STDesc: TYPE = RECORD[
symbolsStamp: TimeStamp.Stamp,
bcd: BcdDefs.BcdBase ← NIL,
sgi: BcdDefs.SGIndex ← BcdDefs.SGNull,
sth: RTSymbolDefs.SymbolTableHandle ← RTSymbolDefs.nullHandle
];
A STDesc describes options for finding the bits of a particular symbol table as follows:
If bcd=NIL, the symbolsStamp identifies a compiler-created .bcd file with version=symbolsStamp, and sth is a valid SymbolTableHandle.
else if sgi # SGNull, the symbolsStamp matches a (possibly composite) .bcd or .symbols file version stamp, and the sgi identifies the symbol table within bcd.
else if sgi = SGNull, the symbolsStamp matches an entry in bcd's file table, which identifies a compiler-created .bcd file with version=symbolsStamp.
TypeStructure: TYPE = TypeStrings.TypeString;
Support for NARROW and runtime type-equivalence determination: canonical types.
UniqueTypeFinger: TYPE = RECORD[
umid: TimeStamp.Stamp, -- of original defining module
seIndex: RTSymbolDefs.SymbolIndex -- type seIndex therein
];
useCanonicalTypeMicroCode: BOOL; -- exported variable
Procedures
GetLastTypeIndex: PROC RETURNS[SafeStorage.TypeIndex];
NumberPackageRefs: PROC[type: SafeStorage.Type] RETURNS[NAT] = INLINE {
RETURN[MapTiTd[type].numberPackageRefs];
};
MapTiRcmx: PROC[ti: SafeStorage.TypeIndex] RETURNS[RCMap.Index] = INLINE {
RETURN[MapTiTd[ti].rcmx];
};
PutForFinalization: PROC[type: SafeStorage.Type, ref: REF ANY] RETURNS[done: BOOLEAN];
AssignComposite: PROC[rhs, lhs: LONG POINTER,
type: SafeStorage.Type, nwords: CARDINAL];
AssignCompositeNew: PROC[rhs, lhs: LONG POINTER,
type: SafeStorage.Type, nwords: CARDINAL];
FreeCollectibleObject: PROC[refObj: REF ANY]; -- nilifies REFs within
MapRefs: PROC[ptr: LONG POINTER, rcmx: RCMap.Index, procLeaf: PROC[p: REF ANY]];
MapRefOffsets: PROC[ref: REF ANY, procLeaf: PROC[offset: LONG CARDINAL]];
DoFREEify: PROC[ptr: LONG POINTER, rcmx: RCMap.Index, procLeaf: PROC[p: REF ANY]];
GetMapTiTd: PROC RETURNS[TMapTiTd];
NotifyAtomRecType: PROC[type: SafeStorage.Type];
AcquireTypeForLoader: PROC[utf: UniqueTypeFinger,
std: STDesc, sei: RTSymbolDefs.SymbolIndex,
ts: TypeStrings.TypeString, rcmi: RCMap.Index, canonicalize: BOOLEANFALSE,
initializing: BOOLFALSE -- TRUE => create MapStiStd entry from uncounted storage
] RETURNS[SafeStorage.Type];
For supporting RTTypes
MakeNewType: PROC[utf: UniqueTypeFinger, std: STDesc, sei: RTSymbolDefs.SymbolIndex,
ts: TypeStrings.TypeString, rcmx: RCMap.Index, canonicalize: BOOLEANFALSE,
initializing: BOOLEANFALSE, -- i.e. create MapStiStd entry from uncounted storage
type: SafeStorage.Type ← SafeStorage.nullType]
RETURNS
[SafeStorage.Type];
FindSTI: PROC[std: STDesc, initializing: BOOLFALSE] RETURNS[i: SymbolTableIndex];
initializing = TRUE => create MapStiStd entry from uncounted storage
BlessMapStiStd: PROC; -- copy initial (uncounted) MapStiStd to counted storage
FindCanonicalPTD: PROC[ts: TypeStrings.TypeString] RETURNS[ptd: PTypeDesc];
FindPTD: PROC[utf: UniqueTypeFinger, ts: TypeStrings.TypeString ← NIL]
RETURNS[ptd: PTypeDesc];
Enter: PROC[inner: PROC];
Errors
NotImplemented: ERROR[msg: Rope.ROPE];
END.
CHANGE LOG
Changes made by Koo on July 4, 1984 11:06:16 am PDT
The type of ts in TypeDesc is changed from TypeStrings.TypeString to TypeHash.TypeKey and the arguments to FindCanonicalPTD, FindPTD, and MakeNewType are changed to reflect the change in TypeDesc.