Alloc.mesa
Copyright Ó 1985, 1986, 1991 by Xerox Corporation. All rights reserved.
Sweet, 19-Aug-81 12:14:14
Satterthwaite, June 10, 1986 3:02:18 pm PDT
Russ Atkinson (RRA) October 12, 1987 6:42:32 pm PDT
DIRECTORY SmallCards;
Alloc: DEFINITIONS = {
OPEN SmallCards;
Selector: TYPE = Card16;
Base: TYPE = LONG ORDERED BASE POINTER;
Index: TYPE = Base RELATIVE LONG POINTER;
OrderedIndex: TYPE = Base RELATIVE LONG ORDERED POINTER;
Handle: TYPE = REF InstanceData;
InstanceData: TYPE;
allocation from the tables as stacks
Units: PROC [h: Handle, table: Selector, size: Card16] RETURNS [OrderedIndex];
Allocates a given number (size) of addressing units worth of storage from the given table.
Trim: PROC [h: Handle, table: Selector, size: INT];
allocation from free list
defaultChunkType: Selector = Selector.FIRST;
GetChunk: PROC
[h: Handle, size: Card16, table: Selector ¬ defaultChunkType] RETURNS [Index];
FreeChunk: PROC
[h: Handle, index: Index, size: Card16, table: Selector ¬ defaultChunkType];
inquiries
Bounds: PROC [h: Handle, table: Selector] RETURNS [base: Base, size: INT];
Top: PROC [h: Handle, table: Selector] RETURNS [OrderedIndex];
Bias: PROC [h: Handle, table: Selector] RETURNS [INT];
inquiries and notification of moving subtables
BaseSeq: TYPE = RECORD [SEQUENCE length: NAT OF Base];
Notifier: TYPE = PROC [base: REF BaseSeq];
AddNotify: PROC [h: Handle, proc: Notifier];
DropNotify: PROC [h: Handle, proc: Notifier];
initialization and termination
addrSpan: CARD = 01000000H;
24 bits of address
TableInfo: TYPE = RECORD [
tag: [0..100H),
8 bits of tag
initialPages: NAT,
initial pages for the table
maxPages: INT
max pages for the table
];
Create: PROC [weights: DESCRIPTOR FOR ARRAY OF TableInfo] RETURNS [Handle];
Destroy: PROC [Handle];
Reset: PROC [Handle];
Chunkify: PROC [
h: Handle, table: Selector¬defaultChunkType,
firstSmall: NAT¬5, nSmall: NAT¬4];
UnChunkify: PROC [h: Handle, table: Selector];
ResetChunk: PROC [h: Handle, table: Selector];
ResetTable: PROC [h: Handle, table: Selector, info: TableInfo];
Failure: ERROR [h: Handle, table: Selector];
Overflow: SIGNAL [h: Handle, table: Selector] RETURNS [extra: CARD];
}.