MimZonePort.mesa
Copyright Ó 1988, 1991 by Xerox Corporation. All rights reserved.
Russ Atkinson (RRA) October 11, 1988 11:25:43 am PDT
MimZonePort: DEFINITIONS = BEGIN
UZone:
TYPE =
UNCOUNTED
ZONE;
AllocProc: TYPE = PROC [self: UZone, size: CARDINAL] RETURNS [LONG POINTER];
FreeProc: TYPE = PROC [LONG POINTER];
UZoneProcs: TYPE = RECORD [alloc: AllocProc, free: FreeProc];
UZoneProcsPtr:
TYPE =
LONG
POINTER
TO UZoneProcs;
OldUZone: TYPE = LONG POINTER TO UZoneProcsPtr;
NewUZone: TYPE = LONG POINTER TO UZoneProcs;
ScratchPtr: TYPE = LONG POINTER TO Scratch;
Scratch:
TYPE =
ARRAY [0..
WORDS[UZoneProcs]+
WORDS[UZoneProcsPtr])
OF
WORD;
MakeZone:
PROC [alloc: AllocProc, free: FreeProc, scratch: ScratchPtr]
RETURNS [UZone] =
INLINE {
up: UZoneProcsPtr;
IF
BITS[
WORD] = 16
THEN {
Old style of zone
oz: OldUZone = LOOPHOLE[scratch];
up ¬ LOOPHOLE[scratch+SIZE[UZoneProcsPtr]];
oz ¬ up;
}
ELSE {
New style of zone
up ¬ LOOPHOLE[scratch];
};
up.alloc ¬ alloc;
up.free ¬ free;
RETURN [LOOPHOLE[scratch]];
};
END.