DIRECTORY Allocator USING[bsiEscape], AllocatorOps USING[DoubleFreeHeader, Rover, DFHeaderP, DoCreateMediumSizedObject, DoFreeMediumSizedObject, nonNullType], VM USING[PagesForWords, AddressForPageNumber, Allocate, CantAllocate]; UnsafeAllocatorImpl: MONITOR IMPORTS AllocatorOps, VM EXPORTS AllocatorOps = BEGIN OPEN AllocatorOps; InsufficientVM: ERROR = CODE; UZHandle: TYPE = LONG POINTER TO UZObject; UZObject: TYPE = MACHINE DEPENDENT RECORD [ procs(0:0..31): LONG POINTER TO UZProcs ]; UZProcs: TYPE = MACHINE DEPENDENT RECORD [ new(0): PROC[self: UZHandle, size: CARDINAL] RETURNS[LONG POINTER], free(1): PROC[self: UZHandle, object: LONG POINTER] ]; ppzProcs: UZProcs _ [new: PPZNew, free: NIL]; ppzObject: UZObject _ [procs: @ppzProcs]; permanentPageZone: PUBLIC UNCOUNTED ZONE _ LOOPHOLE[LONG[@ppzObject]]; heapRoot: DoubleFreeHeader _ [ eh: [extendedSize: 0, normalHeader: [blockSizeIndex: Allocator.bsiEscape]], nextFree: @heapRoot, prevFree: @heapRoot ]; heapRover: Rover _ @heapRoot; PPZNew: PROC[self: UZHandle, size: CARDINAL] RETURNS[lp: LONG POINTER] = { nPages: INT = VM.PagesForWords[size]; lp _ VM.AddressForPageNumber [VM.Allocate[count: nPages, in64K: TRUE ! VM.CantAllocate => GOTO noVM].page]; EXITS noVM => ERROR InsufficientVM; }; CreateMediumSizedHeapObject: PUBLIC ENTRY PROC[size: NAT] RETURNS[LONG POINTER] = {ENABLE UNWIND => NULL; RETURN[ AllocatorOps.DoCreateMediumSizedObject[size, nonNullType, @heapRover, FALSE]]; }; FreeMediumSizedHeapObject: PUBLIC ENTRY PROC[ptr: DFHeaderP] = { ENABLE UNWIND => NULL; AllocatorOps.DoFreeMediumSizedObject[ptr, heapRover]; }; END. ΄UnsafeAllocatorImpl.Mesa last edited November 9, 1983 8:33 am by Paul Rovner protects the systemUZone free list and rover. Procs herein are simply entry procs that call back into AllocatorImpl. ERRORS TYPES UNCOUNTED ZONES and their data the permanentPageZone permanentPageZone requires no ENTRY procs permanentPageZone is ready for use the systemUZone free list and rover dummy entry; the "uncountedHeap" free list never has NIL ptrs IMPLEMENTATION of permanentPageZone Referenced only from permanentPageZone (its NEW proc) IMPLEMENTATION support for the systemUZone; here because these need their own monitor Called only from AllocatorImpl.NewHeapObject. size includes overhead, has been quantized and is >= SIZE[DoubleFreeHeader]. This proc may return an object of a larger size than requested. Returns NIL if free list needs expansion. Called only from ExpandDoubleFreeList and FreeHeapObject in AllocatorImpl. Assume header is made Κ#˜Jšœ™Jšœ3™3J˜šΟk ˜ Jšœ œ ˜Jšœ œœS˜xJšœœ>˜F—J˜šœ˜Jšœu™u—Jšœ˜Jšœ ˜J˜šœ œ ˜J˜šœ™Jšœœœ˜J˜—™Iprocš œ œœœœ ˜*š œ œœ œœ˜+Kšœœœœ˜'Kšœ˜—š œ œœ œœ˜*Kš œœœœœœ˜CKšœ œœœ˜3Kšœ˜—K˜—šœ™šœ™Kšœ(œ˜-Kšœ)˜)—š Οbœœ œœœœ˜FJšœ)™)Jšœ"™"—K˜šœ#™#šœ˜Jšœ=™=JšœK˜KJšœ˜Jšœ˜Jšœ˜—Jšœ˜—J™—šœ#™#K™Kšœ5™5š Οnœœœœœœ˜JKšœœœ˜%šœœ˜Kš œœ œœœ ˜N—Kšœ œ˜#šœ˜J™———šœU™UJ™Jšœ-™-Jšœ5œ™LJšœ?™?Jšœ)™)š Ÿœœœœœ˜9Jš œœœœœœ˜/šœ˜JšœFœ˜N—J˜J˜—JšœJ™JJšœ™šŸœ œœ˜@Jšœœœ˜Jšœ5˜5Jšœ˜——J˜—Jšœ˜J˜—…—P '