-- Transport Mechanism Filestore - private DEFS for heap object directory. --

-- [Juniper]<Grapevine>MS>ObjectDirXDefs.mesa

-- Andrew Birrell	 3-Jun-81 12:59:45 --
-- M. D. Schroeder        7-Feb-83 15:28:39


DIRECTORY
ObjectDirDefs	USING[ ObjectNumber, ObjectType, noObject ],
VMDefs		USING[ FullAddress ];

ObjectDirXDefs:	DEFINITIONS = BEGIN

ObjectNumber:	TYPE = ObjectDirDefs.ObjectNumber;

gapObjectNumber: ObjectNumber = ObjectDirDefs.noObject;
   -- an object number that 'NewObject' will never return --

NewObject:	PROCEDURE[ VMDefs.FullAddress, ObjectDirDefs.ObjectType ]
		RETURNS[ ObjectNumber ];
   -- sets reference count to one --

ObjectBase:	PROCEDURE[ ObjectNumber ]
		RETURNS[ VMDefs.FullAddress ];


-- Compactor interface --

DOPC:		TYPE = LONG CARDINAL;
   -- "DeletedObjectPageCount";  see comments in GetObjectState

ObjectState:	TYPE = { inUse, unused, duplicate };

GetObjectState:	PROCEDURE[ obj: ObjectNumber, where: VMDefs.FullAddress,
			   dorpc: DOPC -- "r" = read -- ]
		RETURNS[ ObjectState ];
   -- If object's reference count is non-zero, returns "inUse".
   -- If reference count is zero, but base#where, returns "duplicate"
   -- Otherwise returns "unused", and marks object as free with dopc=dorpc
   -- Object numbers are re-used only if their dopc is <= compactor's
   -- most recently reported dofpc.

ReportDofpc:	PROCEDURE[ dofpc: DOPC -- "f" = flushed -- ];
   -- Compactor has overwritten objects whose dopc is <= dofpc.

MoveObject:	PROCEDURE[ ObjectNumber, VMDefs.FullAddress ];
   -- Compactor has moved start of object to given address --

ReleaseObject:	PROCEDURE[ obj: ObjectNumber];
   -- To be used by Write.HeapAbandonWrite when a writer has been abandoned.
   -- The reference count for object must be zero.
   -- The object cannot be a "temp" object.

END.