RCMicrocodeOps.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Paul Rovner, December 6, 1983 2:33 pm
Russ Atkinson (RRA) February 1, 1985 12:52:03 pm PST
Beach, February 22, 1985 2:55:56 pm PST
Doug Wyatt, February 24, 1985 9:59:13 pm PST
Definitions for control of the Cedar incremental collector
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];
Makes a hash for the FoundOnStack table. The pointer presented need not be valid, since there is no dereferencing.
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:
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];
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.
DISABLEMICROCODE: PROC[z: ZeroCountTable];
ENABLEMICROCODE: PROC[z: ZeroCountTable] RETURNS[ucVersion: NAT];
END.