DIRECTORY Allocator USING [NHeaderP], PrincOps USING [GlobalFrameHandle], SafeStorage USING [Type]; CircularGarbageTraceAndSweep: DEFINITIONS = BEGIN maxNReferers: NAT = 10; APNodes: TYPE = ARRAY [0..maxNReferers) OF Allocator.NHeaderP; WhoPointsTo: PROC [nhp: Allocator.NHeaderP, cycleLimit: NAT _ 20] RETURNS [ referers: REF APNodes, gfh: PrincOps.GlobalFrameHandle, foundInLocalFrame, foundInCircularStructure: BOOL, cycles: NAT _ 0] ; WhoPointsToRef: PROC [ref: REF, cycleLimit: NAT _ 20] RETURNS [ referers: LIST OF REF, gfh: PrincOps.GlobalFrameHandle, foundInLocalFrame, foundInCircularStructure: BOOL, cycles: NAT _ 0] ; FindCircularGarbageTypes: PROC [nObjects: CARDINAL, reportRopes: BOOL _ TRUE] RETURNS [ nGarbage, nSeen: INT, garbage: LIST OF SafeStorage.Type _ NIL] ; FindCircularGarbage: PROC [nObjects: CARDINAL, reportRopes: BOOL _ TRUE] RETURNS [ nGarbage, nSeen: INT, garbage: LIST OF REF _ NIL] ; FindConnectedComponent: PROC [rootObject: REF ANY, nObjects: CARDINAL, reportRopes: BOOL _ TRUE] RETURNS [ allOnList: BOOL, countReturned: INT, circularObjects: LIST OF REF ]; REFToNHP: PROC[ref: REF ANY] RETURNS[Allocator.NHeaderP] ; NHPToREF: PROC[nhp: Allocator.NHeaderP] RETURNS[REF ANY]; END. °CircularGarbageTraceAndSweep.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Bob Hagmann August 13, 1985 11:17:29 am PDT Look up the referer chain. Stop if a gfh found, or if foundInLocalFrame, or if a loop is found, or if more than 1 referer is found, or if no referers are found (changed conserv scan) Same as WhoPointsTo but for REF's This procedure first does a standard incremental collection. Then it goes thru the motions of a TandS, but does not reclaim any garbage. Instead, it records the Types in a list. Do not do two of these at once!! This procedure first does a standard incremental collection. Then it goes thru the motions of a TandS, but does not reclaim any garbage. Instead, it records the REFs in a list. Do not do two of these at once!! This procedure takes the rootObject, and find all object that it recursively points to. nObjects is the maximum number of objects to return. ROPEs will not be returned if reportRopes is FALSE. allOnList indicates that the list is complete: it was not stopped because nObjects was reached. In any case, ROPEs and ATOMs once found and possibly reported, will not be processed any further for the circularity. Non-INLINE versions of the AllocatorOps procedures for use from an interpreter. Bob Hagmann August 9, 1985 5:07:50 pm PDT created Bob Hagmann August 12, 1985 9:26:19 am PDT added FindCircularStructure, WhoPointsToRef Bob Hagmann August 12, 1985 10:08:25 am PDT changes to: WhoPointsToRef Bob Hagmann August 12, 1985 10:09:26 am PDT changes to: WhoPointsToRef, FindCircularStructure, REFToNHP, NHPToREF Bob Hagmann August 13, 1985 11:17:29 am PDT renamed FindCircularStructure to FindConnectedComponent Κ\˜codešœ!™!Kšœ Οmœ1™K˜šΟn œžœ'žœžœ žœXžœ žœ˜ΙKšœΆ™ΆK™—šŸœžœžœžœžœ žœžœžœPžœ žœ˜½KšœΟo œ™!K™—šŸœžœ žœžœžœžœžœ žœžœžœ˜˜KšœΤ™ΤK™—šŸœžœ ž œ žœžœžœžœ žœžœžœžœ˜†KšœΣ™ΣK™—šŸœžœžœžœ žœžœžœžœžœžœžœžœžœ˜―Kšœš™šK™—Kš Ÿœžœžœžœžœ˜:š Ÿœžœžœžœžœ˜9KšœO™O—K™Kšžœ˜K™™)KšΟr™—™*Kšœ+™+—K™KšŸ™™+Kšœ ‘™—™+Kšœ ‘9™E—™+Kšœ7™7—K™—…—Δ Π