-- RTTypesBasicPrivate.Mesa -- last edited December 21, 1982 8:58 am by Paul Rovner DIRECTORY BcdDefs USING[SGIndex, SGNull], BcdOps USING[BcdBase], RCMap USING[Index, nullIndex, Limit], RTBasic USING[TypeIndex, Pointer, Type, nullType], RTQueue USING[Q, qNil], RTSymbols USING[SymbolTableHandle, nullHandle, SymbolIndex, nullSymbolIndex], TimeStamp USING[Stamp], TypeStrings USING[TypeString]; RTTypesBasicPrivate: DEFINITIONS SHARES RTBasic = BEGIN OPEN RTBasic, RTSymbols; -- Cedar System Internal goodies -- Types -- -- The Runtime Type Table: maps TypeIndex to TypeDesc RMapTiTd: TYPE = RECORD[ptds: SEQUENCE length: NAT OF PTypeDesc]; TMapTiTd: TYPE = LONG POINTER TO RMapTiTd; MapTiTd: TMapTiTd; PTypeDesc: TYPE = LONG POINTER TO TypeDesc; TypeDesc: TYPE = MACHINE DEPENDENT RECORD [ equivalentTypePad: [0..3] _ 0, equivalentType: Type _ nullType, -- nullType means not "canonicalized" nPackageRefsPad: [0..1] _ 0, nPackageRefs: 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: Type, -- a back pointer(logically) typeStructure: TypeStructure, extension: PTypeExtension _ NIL -- LOOPHOLE ]; 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: RTQueue.Q _ RTQueue.qNil, attachment: REF ANY _ NIL]; -- Access to symbol table information PreDefinedSEI: TYPE = CARDINAL[0..249]; SymbolAccess: TYPE = RECORD[sti: SymbolTableIndex _ 0, sei: SymbolIndex _ nullSymbolIndex]; SymbolTableIndex: TYPE = NAT; -- index into MapStiStd MapStiStd: TMapStiStd; -- The map from SymbolTableIndex to STDesc TMapStiStd: TYPE = LONG POINTER TO RMapStiStd; RMapStiStd: TYPE = RECORD[stiv: SEQUENCE length: SymbolTableIndex OF PSTDesc]; -- 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. PSTDesc: TYPE = LONG POINTER TO STDesc; STDesc: TYPE = RECORD [symbolsStamp: TimeStamp.Stamp, bcd: BcdOps.BcdBase _ NIL, sgi: BcdDefs.SGIndex _ BcdDefs.SGNull, sth: SymbolTableHandle _ nullHandle]; 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: SymbolIndex];-- type seIndex therein useCanonicalTypeMicroCode: BOOLEAN; -- exported variable -- Procedures -- -- for CedarProbe GetLastTypeIndex: PROC RETURNS[TypeIndex]; -- for RTStartImpl GetCanonicalReferentTypeSDTrap: PROC[ref: REF ANY] RETURNS[type: Type]; GetReferentTypeTrap: PROC[ref: REF ANY] RETURNS[type: Type]; GetCanonicalReferentTypeTrap: PROC[ref: REF ANY] RETURNS[type: Type]; CheckForNarrowRefFault: PROC[ref: REF ANY, targetType: Type] RETURNS[REF ANY]; NPackageRefs: PROC[type: Type] RETURNS[NAT] = INLINE {RETURN[MapTiTd[type].nPackageRefs]}; MapTiRcmx: PROC[ti: TypeIndex] RETURNS[RCMap.Index] = INLINE {RETURN[MapTiTd[ti].rcmx]}; PutForFinalization: PROC[type: Type, ref: REF ANY] RETURNS[done: BOOLEAN]; 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: Pointer, rcmx: RCMap.Index, procLeaf: PROC[p: REF ANY]]; GetMapTiTd: PROC RETURNS[TMapTiTd]; NotifyAtomRecType: PROC[type: Type]; AcquireTypeForLoader: PROC[utf: UniqueTypeFinger, std: STDesc, sei: SymbolIndex, ts: TypeStructure, rcmi: RCMap.Index, canonicalize: BOOLEAN _ FALSE] RETURNS[Type]; -- for supporting RTTypes MakeNewType: PROC[utf: UniqueTypeFinger, std: STDesc, sei: SymbolIndex, ts: TypeStructure, rcmx: RCMap.Index, canonicalize: BOOLEAN _ FALSE, type: Type _ nullType] RETURNS[Type]; FindSTI: PROC[std: STDesc] RETURNS[i: SymbolTableIndex]; FindCanonicalPTD: PROC[ts: TypeStructure] RETURNS[ptd: PTypeDesc]; FindPTD: PROC[utf: UniqueTypeFinger, ts: TypeStructure _ NIL] RETURNS[ptd: PTypeDesc]; Enter: PROC[inner: PROC]; END.