SafeStorage: CEDAR DEFINITIONS = BEGIN TrimSystemZone: PROC; GetSystemZone: PROC RETURNS[ZONE]; GetPermanentZone: PROC RETURNS[ZONE]; SetCollectionInterval: PROC[newInterval: INT] RETURNS[previous: INT]; ReclaimCollectibleObjects: PROC[suspendMe: BOOL _ TRUE, traceAndSweep: BOOL _ FALSE]; 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]; NWordsAllocated: PROC RETURNS[INT]; NWordsReclaimed: PROC RETURNS[INT]; PinObject: PROC[ref: REF ANY]; UnpinObject: PROC[ref: REF ANY]; TypeIndex: TYPE = [0..LAST[CARDINAL]/4]; -- 14 bits Type: TYPE = RECORD[TypeIndex]; nullType: Type = [0]; unspecType: Type = [1]; -- the distinguished type of UNSPECIFIED fhType: Type = [2]; -- the distinguished type of localFrames gfhType: Type = [3]; -- the distinguished type of globalFrames anyType: Type = [4]; -- the distinguished type of ANY lastPredefinedTypeIndex: TypeIndex = 4; GetReferentType: PROC[ref: REF ANY] RETURNS[type: Type]; GetCanonicalReferentType: PROC[ref: REF ANY] RETURNS[type: Type]; EquivalentTypes: PROC[t1, t2: Type] RETURNS[BOOL]; GetCanonicalType: PROC[type: Type] RETURNS[Type]; IsReferentType: PROC[ref: REF ANY, type: Type] RETURNS[BOOL]; NarrowRef: PROC[ref: REF ANY, type: Type] RETURNS[REF ANY]; maxNPackageRefs: CARDINAL = 2; FinalizationQueue: TYPE = PRIVATE RECORD[REF ANY]; EstablishFinalization: PROC[type: Type, npr: [0..maxNPackageRefs], fq: FinalizationQueue]; ReEstablishFinalization: PROC[type: Type, npr: [0..maxNPackageRefs], fq: FinalizationQueue]; EnableFinalization: PROC[ref: REF ANY]; IsFinalizationEnabled: PROC[ref: REF ANY] RETURNS[BOOL]; NewFQ: PROC[length: CARDINAL _ 100] RETURNS [FinalizationQueue]; FQNext: PROC[fq: FinalizationQueue] RETURNS[REF ANY]; FQEmpty: PROC[fq: FinalizationQueue] RETURNS[BOOL]; PutTypeAttachment: PROC[type: Type, attachment: REF ANY]; GetTypeAttachment: PROC[type: Type] RETURNS[REF ANY]; MemoryExhausted: ERROR; NarrowFault: ERROR; NarrowRefFault: ERROR[ref: REF ANY, targetType: Type]; UnsafeProcAssignment: SIGNAL[proc: PROC ANY RETURNS ANY]; InvalidType: ERROR[type: Type]; CantEstablishFinalization: ERROR[type: Type]; END. RSafeStorage.mesa Copyright c 1985 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, February 24, 1985 8:32:21 pm PST Zones returns free VM pages to the operating system this is the default ZONE used by NEW use this for NEW objects that will never be collected Controlling the garbage collector establishes the number of words allocated between collections perform a garbage collection Monitoring the garbage collector Statistics returns total # words allocated since the last boot returns total # words reclaimed Pinning objects in real memory pins the object (and its header) in real memory unpins the given object Types Predefined Types. All of these are treated specially by the implemention There will be other predefined Types. ... gets the canonical type for the given type ... tests the two types for equivalence (GetCanonicalType[t1] = GetCanonicalType[t2]) ... gets the canonical type for the given type ... tests the given ref for having the given referent type Like NARROW, but uses a type code. Raises NarrowRefFault if the given ref does not have that type. Package finalization BEWARE: Establish finalization for a type BEFORE allocating any objects of the type. Allocate objects of the type ONLY in the same program module in which the calls to establish finalization appear. Use exactly the same type expression in these calls and in NEW expressions for objects of the type. Invoke EnableFinalization after each new finalizable object has been inserted in its package data structure (i.e. after its "package refs" have been created). EstablishFinalization will raise CantEstablishFinalization if type was previously finalizable. Use this to specify a new FinalizationQueue for a previously established finalizable type. This is useful during the edit-compile-test loop for running new versions of a program that establishes finalization for a Type. ReEstablishFinalization will raise CantEstablishFinalization if type was not previously finalizable or if the new number of package refs is different than before. Use this for a new finalizable object after establishing its package refs. Use this in conjunction with a finalizable cache. Returns a new FinalizationQueue with the given capacity for holding REFs to be finalized. ... waits for the given FinalizationQueue to be non-empty ... tests the given FinalizationQueue for being empty Type attachments ... associates a given REF with a given type ... gets the REF associated with the given type Signals and Errors Κh˜codešœ™Kšœ Οmœ1™Kšœ‘’˜5šœ'˜'KšœI™IKšœ%™%—K˜š  œŸœŸœŸœŸœ ˜8K˜—š  œŸœŸœŸœŸœ ˜AK™.K˜—š œŸœŸœŸœ˜2KšœU™UK˜—š œŸœ Ÿœ˜1K™.K˜—š  œŸœŸœŸœŸœŸœ˜=K™:K˜—š  œŸœŸœŸœŸœŸœŸœ˜;KšœŸœ™"Kšœ?™?K˜——šœ™šœ™KšœL™LKšœ­Ÿœ%™ΥKšœž™ž—K™KšœŸœ˜Kš œŸœŸœŸœŸœŸœ˜2K˜š œŸœ?˜ZKšœ^™^K™—šΟbœŸœ?˜\Kšœά™άKšœ’™’K˜—š œŸœŸœŸœ˜'KšœJ™JK˜—š ΠbnœŸœŸœŸœŸœŸœ˜8Kšœ1™1K˜—š œŸœ ŸœŸœ˜@KšœY™YK™—š  œŸœŸœŸœŸœ˜5Kšœ9™9K™—š œŸœŸœŸœ˜3Kšœ5™5K™——™š œŸœŸœŸœ˜9KšœŸœ™,K™—š  œŸœ ŸœŸœŸœ˜5Kšœ Ÿœ™/K˜——šœ™KšœŸœ˜Kšœ Ÿœ˜KšœŸœŸœŸœ˜6Kš œŸœŸœŸœŸœŸœ˜9Kšœ Ÿœ ˜KšœŸœ ˜-—K˜KšŸœ˜—…— (β