SymbolAccessImpl.mesa
Copyright © 1984 by Xerox Corporation. All rights reserved.
BEWARE of assumptions below about RC activity. This module is used before the sun comes up, as well as after the world is safe for SafeStorage.
Paul Rovner On August 17, 1983 10:43 am
Russ Atkinson On June 19, 1984 6:22:01 pm PDT
DIRECTORY
PrincOps USING[SD],
RTSD USING[sMapStiStd],
RTSymbolDefs USING[nullHandle],
RTTypesBasicPrivate USING[STDesc, SymbolTableIndex, LOOPHOLEDTMapStiStd, RSTDesc, RMapStiStd, MapStiStd],
RTTypesBasicPrivateChanges USING [InitialSTIRangeSize],
SafeStorage USING[TypeIndex],
UnsafeStorage USING[GetSystemUZone];
SymbolAccessImpl:
MONITOR
-- protects MapStiStd
IMPORTS RTTypesBasicPrivate, UnsafeStorage
EXPORTS RTTypesBasicPrivate
= BEGIN OPEN RTTypesBasicPrivate, RTTypesBasicPrivateChanges, SafeStorage;
lastSTIndex: TypeIndex ← 0;
TooManyTypes: ERROR = CODE;
Bless
MapStiStd:
PUBLIC
ENTRY
PROC = {
ENABLE UNWIND => NULL;
t: LOOPHOLEDTMapStiStd = LOOPHOLE[RTTypesBasicPrivate.MapStiStd];
LOOPHOLE[RTTypesBasicPrivate.MapStiStd, LOOPHOLEDTMapStiStd] ← NIL;
RTTypesBasicPrivate.MapStiStd ← NEW[RMapStiStd[InitialSTIRangeSize]];
FOR i: SymbolTableIndex
IN [1..lastSTIndex]
DO RTTypesBasicPrivate.MapStiStd[i] ← NEW[STDesc ← t[i]^] ENDLOOP;
LOOPHOLE[
LONG[@PrincOps
.SD[
RTSD.sMapStiStd]],
LONG
POINTER
TO
LONG
POINTER]^
← LOOPHOLE[RTTypesBasicPrivate.MapStiStd, LONG POINTER];
};
FindSTI:
PUBLIC
ENTRY
PROC
[std: STDesc, initializing: BOOL] RETURNS[i: SymbolTableIndex] = {
ENABLE UNWIND => NULL;
FOR i
DECREASING
IN [1..lastSTIndex]
DO
desc: RTTypesBasicPrivate.STDesc ← RTTypesBasicPrivate.MapStiStd[i]^;
IF std.symbolsStamp.time # desc.symbolsStamp.time THEN LOOP;
IF std.symbolsStamp.host # desc.symbolsStamp.host THEN LOOP;
IF std.symbolsStamp.net # desc.symbolsStamp.net THEN LOOP;
IF std.bcd # NIL AND std.sgi # desc.sgi THEN LOOP;
IF desc.sth = RTSymbolDefs.nullHandle
THEN {
IF initializing
THEN LOOPHOLE[RTTypesBasicPrivate.MapStiStd, LOOPHOLEDTMapStiStd][i].sth ← std.sth
ELSE RTTypesBasicPrivate.MapStiStd[i].sth ← std.sth;
};
RETURN[i];
ENDLOOP;
IF lastSTIndex = InitialSTIRangeSize - 1 THEN ERROR TooManyTypes;
i ← lastSTIndex ← lastSTIndex + 1;
IF initializing
THEN
LOOPHOLE[RTTypesBasicPrivate.MapStiStd, LOOPHOLEDTMapStiStd][i]
← UnsafeStorage.GetSystemUZone[].NEW[STDesc ← std]
ELSE RTTypesBasicPrivate.MapStiStd[i] ← NEW[STDesc ← std];
};
END.