DIRECTORY PrincOps USING[SD], RTFlags USING[takingStatistics], RTSD USING[sMapStiStd], RTSymbolDefs USING[nullHandle], RTTypesBasicPrivate USING[STDesc, SymbolTableIndex, InitialSTIRangeSize, MapStiStd, LOOPHOLEDTMapStiStd, RSTDesc, RMapStiStd], SafeStorage USING[TypeIndex], SafeStoragePrivate USING[PrivateHeapZone]; RTSymbolAccessImpl: MONITOR -- protects MapStiStd IMPORTS RTTypesBasicPrivate, SafeStoragePrivate EXPORTS RTTypesBasicPrivate = BEGIN OPEN RTTypesBasicPrivate, SafeStorage; -- Statistics stats: RECORD[ nSTIFound: INT _ 0, nSTDCreatedWhileInitializing: INT _ 0, -- from PrivateHeapZone nSTDCreatedAfterInitializing: INT _ 0 ]; Bump: PROC[p: POINTER TO INT, delta: INT _ 1] = INLINE {IF RTFlags.takingStatistics THEN p^ _ p^+delta}; lastSTIndex: TypeIndex _ 0; TooManyTypes: ERROR = CODE; BlessMapStiStd: PUBLIC ENTRY PROC = { ENABLE UNWIND => NULL; t: LOOPHOLEDTMapStiStd = LOOPHOLE[MapStiStd]; LOOPHOLE[MapStiStd, LOOPHOLEDTMapStiStd] _ NIL; MapStiStd _ NEW[RMapStiStd[InitialSTIRangeSize]]; LOOPHOLE[LONG[@PrincOps.SD[RTSD.sMapStiStd]], LONG POINTER TO LONG POINTER]^ _ LOOPHOLE[MapStiStd, LONG POINTER]; FOR i: SymbolTableIndex IN [1..lastSTIndex] DO MapStiStd[i] _ NEW[STDesc _ t[i]^] ENDLOOP; }; FindSTI: PUBLIC ENTRY PROC[std: STDesc, initializing: BOOL] RETURNS[i: SymbolTableIndex] = { ENABLE UNWIND => NULL; FOR i IN [1..lastSTIndex] DO IF MapStiStd[i].symbolsStamp = std.symbolsStamp AND (std.bcd = NIL OR std.sgi = MapStiStd[i].sgi) THEN { IF MapStiStd[i].sth = RTSymbolDefs.nullHandle THEN { IF initializing THEN LOOPHOLE[MapStiStd, LOOPHOLEDTMapStiStd][i].sth _ std.sth ELSE MapStiStd[i].sth _ std.sth; }; Bump[@stats.nSTIFound]; RETURN[i]; }; ENDLOOP; IF lastSTIndex = InitialSTIRangeSize - 1 THEN ERROR TooManyTypes; i _ lastSTIndex _ lastSTIndex + 1; IF initializing THEN { Bump[@stats.nSTDCreatedWhileInitializing]; LOOPHOLE[MapStiStd, LOOPHOLEDTMapStiStd][i] _ SafeStoragePrivate.PrivateHeapZone.NEW[STDesc _ std]; } ELSE { Bump[@stats.nSTDCreatedAfterInitializing]; MapStiStd[i] _ NEW[STDesc _ std]; }; }; END. ²RTSymbolAccessImpl.mesa BEWARE of assumptions below about RC activity. This module is used before the sun comes up. Last Modified By Paul Rovner On June 27, 1983 2:29 pm ΚV˜Jšœ™Jšœ\™\šœ5™5J˜šΟk ˜ Jšœ œœ˜Jšœœ˜ Jšœœ ˜Jšœ œ ˜Jšœœe˜~Jšœ œ ˜Jšœœ˜*—J˜šœœΟc˜2Jšœ(˜/Jšœ˜—Jšœœœ"˜.˜Iprocšž ˜ šœœ˜Kšœ œ˜Kšœœž˜?Kšœœ˜%Kšœ˜K˜—Kš Οnœœœœœ œ˜/Kšœœœ˜8K˜Jšœ˜Jšœœœ˜J˜š ŸΠbn œœœœ˜%Jšœœœ˜Jšœœ ˜-J˜Jšœ#œ˜/Jšœ œ"˜1J˜šœœ œœœœœœœ˜LJšœœ œœ˜$—J˜šœœ˜+Jšœœœ˜.—Jšœ˜J˜—š Ÿœœœœœ˜;Jšœ˜ Jšœœœ˜šœœ˜š˜šœ-˜/šœ œœœ˜8šœ+˜-šœ˜šœ ˜Jšœœ1˜>Jšœ˜ —Jšœ˜——Jšœ˜Jšœ˜ Jšœ˜———Jšœ˜—Jšœ'œœ˜AJšœ"˜"šœ ˜šœ˜Jšœ*˜*Jšœ#˜+Jšœ0œ˜BJ˜—šœ˜Jšœ*˜*Jšœœ˜!J˜——Jšœ˜——J˜Jšœ˜—J˜—…— "