RCMicrocodeOps.mesa
Definitions for control of the Cedar incremental collector
Paul Rovner, December 6, 1983 2:33 pm
DIRECTORY
Allocator USING[NHeaderP, BlockSizeIndex, FNHeaderP],
CedarMicrocode USING[CREATEREF, RECLAIMEDREF, ALLOCATE, FREEPLEASE],
Collector USING[Disposition],
SafeStorage USING[Type],
ZCT USING[FOSTableIndex, FOSTableResidue, ZeroCountTable];
RCMicrocodeOps: DEFINITIONS IMPORTS CedarMicrocode = BEGIN OPEN Allocator, ZCT;
rcBottom: RefCount = 32;
RCOverflowOccurred: ERROR;
RCUnderflowOccurred: ERROR;
LookFurtherAtReclaimedRef: ERROR;
ZCTFull: ERROR;
NormalFreeListEmpty: ERROR;
FOSTableHash: PROC[nhp: NHeaderP--maybe bogus--]
RETURNS[x: FOSTableIndex, r: FOSTableResidue];
ASSIGNREF: PROC[rhs: REF, lhs: LONG POINTER TO REF];
OnZ: PROC [nhp: NHeaderP];
rcMicrocodeExists: BOOL;
rcMicrocodeWasEnabled: BOOL;
ALLOCATE: PROC[--requested--size: CARDINAL, type: SafeStorage.Type] RETURNS[REF];
Allocate: PROC[size: CARDINAL, type: SafeStorage.Type] RETURNS[r: REF] =
INLINE{
r ← IF rcMicrocodeExists
 THEN CedarMicrocode.ALLOCATE[size, type]
 ELSE SoftwareAllocate[size, type];
};
SoftwareAllocate: PROC[--requested--size: CARDINAL, type: SafeStorage.Type]
RETURNS[REF];
FREEPLEASE: PROC[nhp: NHeaderP] RETURNS[success: BOOL];
Free: PROC[nhp: NHeaderP] RETURNS[success: BOOL] =
INLINE{
success ← IF rcMicrocodeExists
 THEN CedarMicrocode.FREEPLEASE[nhp]
 ELSE SoftwareFree[nhp];
};
SoftwareFree: PROC[nhp: NHeaderP] RETURNS[success: BOOL];
InsertQuanta: PROC[bsi: BlockSizeIndex, first, last: FNHeaderP];
DoFREE: PROC[fnhp: FNHeaderP, bsi: BlockSizeIndex];
CREATEREF: PROC[nhp: NHeaderP];
CreateRef: PROC[nhp: NHeaderP] =
INLINE{
IF rcMicrocodeExists
THEN CedarMicrocode.CREATEREF[nhp]
ELSE SoftwareCreateRef[nhp];
};
SoftwareCreateRef: PROC[nhp: NHeaderP];
RECLAIMABLEREF: PROC[nhp: NHeaderP] RETURNS[Collector.Disposition];
RECLAIMEDREF: PROC[ref: REF] RETURNS[REF];
ReclaimedRef is called by the reclaimer on each ref that it finds within an object being reclaimed. ReclaimedRef will decrement the reference count on ref^ and return a non-NIL result if the referenced object can be reclaimed.
ReclaimedRef: PROC[ref: REF] RETURNS[REF ANY] =
INLINE{
IF rcMicrocodeExists
THEN RETURN[CedarMicrocode.RECLAIMEDREF[ref]]
ELSE RETURN[SoftwareReclaimedRef[ref]];
};
SoftwareReclaimedRef: PROC[ref: REF] RETURNS[REF ANY];
DISABLEMICROCODE: PROC[z: ZeroCountTable];
ENABLEMICROCODE: PROC[z: ZeroCountTable] RETURNS[ucVersion: NAT];
END.