SafeStorage.mesa
Copyright Ó 1985, 1986, 1991, 1992 by Xerox Corporation. All rights reserved.
Paul Rovner, September 19, 1983 9:01 pm
Russ Atkinson (RRA) February 1, 1985 11:32:30 am PST
Beach, February 22, 1985 11:20:38 am PST
Doug Wyatt, November 14, 1986 4:20:51 pm PST
Carl Hauser, March 30, 1988 3:21:37 pm PST
Willie-s, March 3, 1992 12:19 pm PST
Michael Plass, November 22, 1991 10:48 am PST
SafeStorage: CEDAR DEFINITIONS
= BEGIN
Zones
GetSystemZone: PROC RETURNS [ZONE];
this is the default ZONE used by NEW
GetPermanentZone: PROC RETURNS [ZONE];
use this for NEW objects that will never be collected
GetUntracedZone: UNSAFE PROC RETURNS [ZONE];
use this for NEW objects that are known to contain no REFs
Access to the underlying allocator
NewObject: PRIVATE PROC [nUnits: INT, type: SafeStorage.Type] RETURNS [REF] ~ TRUSTED MACHINE CODE {
"XR←NewObject"
};
NewUntracedObject: PROC [nUnits: INT, type: Type] RETURNS [REF] ~ TRUSTED MACHINE CODE {
"XR←NewUntracedObject"
};
GetTypeIndex: PRIVATE PROC [typeString: STRING, struct, rcmap: POINTER] RETURNS [Type] ~ TRUSTED MACHINE CODE {
"XR←GetTypeIndex"
};
Controlling the garbage collector
SetCollectionInterval: PROC [newInterval: CARD] RETURNS [previous: CARD];
establishes the number of bytes allocated between collections
ReclaimCollectibleObjects: PROC [suspendMe: BOOL ¬ TRUE, traceAndSweep: BOOL ¬ FALSE];
perform a garbage collection
Monitoring the garbage collector
ReclamationReason: TYPE = {clientRequest, clientTAndSRequest, clientNoTraceRequest, rcTableOverflow, allocationInterval, quantaNeeded, finalizationThreshold};
IsCollectorActive: PROC RETURNS[active: BOOL, previousIncarnation: INT];
WaitForCollectorStart: PROC RETURNS[incarnation: INT, reason: ReclamationReason,
wordsAllocated, objectsAllocated: INT -- since previous collection was initiated --];
WaitForCollectorDone: PROC RETURNS[incarnation: INT, reason: ReclamationReason,
wordsReclaimed: INT, objectsReclaimed: INT];
Statistics
CurrentByteCount: PROC RETURNS [CARD];
The current number of bytes allocated. This number increases continuously (at each allocation) but shrinks only after collections.
CurrentObjectCount: PROC RETURNS [CARD];
The current number of objects allocated. This number increases continuously (at each allocation) but shrinks only after collections.
TotalByteCount: PROC RETURNS [CARD];
The total number of bytes allocated since startup. This number increases continuously.
TotalObjectCount: PROC RETURNS [CARD];
The total number of objects allocated since startup. This number increases continuously.
HeapSize: PROC RETURNS [CARD];
The size of the heap in bytes.
Types
TypeIndex: TYPE = CARDINAL;
Type: TYPE = MACHINE DEPENDENT {null(0), last(TypeIndex.LAST)};
nullType: Type = VAL[0];
unspecType: Type = VAL[1]; -- the distinguished type of UNSPECIFIED
fhType: Type = VAL[2]; -- the distinguished type of localFrames
gfhType: Type = VAL[3]; -- the distinguished type of globalFrames
anyType: Type = VAL[4]; -- the distinguished type of ANY
lastPredefinedTypeIndex: TypeIndex = 4;
Predefined Types. All of these are treated specially by the implemention
There will be other predefined Types.
GetReferentType: PROC[ref: REF ANY] RETURNS[type: Type];
GetCanonicalReferentType: PROC[ref: REF ANY] RETURNS[type: Type];
... gets the canonical type for the given type
EquivalentTypes: PROC[t1, t2: Type] RETURNS[BOOL];
... tests the two types for equivalence (GetCanonicalType[t1] = GetCanonicalType[t2])
GetCanonicalType: PROC[type: Type] RETURNS[Type];
... gets the canonical type for the given type
IsReferentType: PROC[ref: REF ANY, type: Type] RETURNS[BOOL];
... tests the given ref for having the given referent type
NarrowRef: PROC[ref: REF ANY, type: Type] RETURNS[REF ANY];
Like NARROW, but uses a type code.
Raises NarrowRefFault if the given ref does not have that type.
Signals and Errors
MemoryExhausted: ERROR;
NarrowFault: ERROR;
NarrowRefFault: ERROR [ref: REF ANY, targetType: Type];
UnsafeProcAssignment: SIGNAL [proc: PROC ANY RETURNS ANY];
InvalidType: ERROR [type: Type];
END.
Willie Sue Orr, July 25, 1991 3:36:17 pm PDT: folded in SafeStorageExtras
Michal Plass, November 22, 1991: removed finalization procs; use Finalization instead. Also added UnsafeProcAssignment check, rationalized statistics, removed other unimplemented procedures.
Willie Sue Orr, March 3, 1992 12:18:52 pm PST: changed TypeIndex to be CARDINAL instead of CARD16.