Inter-OfficeMemorandumToCedarInterestDateOctober28,1982FromPaulRovnerLocationPaloAltoSubjectTheCedarRuntimeSystemOrganizationPARC/CSLXEROXFiledon:[Indigo]Documentation>SafeStorage.tiogaFornoviceusageoftheCedarsystemitisnotnecessarytoreadthismemoorusethefeaturesdescribedinit.INTRODUCTIONThismemoisintendedtobeusedasreferencematerialbyCedarimplementorsandadvancedusers.ItdocumentstheruntimesupportforCedarlanguagefeaturesthatdealwithstoragemanagement,universalreferences(REFANY)andATOMs.UsefulinformationforCedarWizardsappearsbelowinthisfont.TheinterfacesdescribedhereinareallexportedbyRT.bcd,whichisincludedinCedarCore.bcd,whichisincludedintheCedarbootfile.Thisdocumenthasthefollowingsections:1.StorageManagement1.1TheSafeStorageInterface1.1.1Bases1.1.2ZONEs1.1.3ControllingtheCollector1.1.4ERRORs1.2TheUnsafeStorageInterface2.UniversalReferencesandRuntimeTypes:TheRTTypesBasicInterface2.1Types2.2Typeattachments2.3Finalizationofcollectibleobjects2.4ERRORs3.ATOMs:TheAtomsPrivateInterface4.ConfigurationParameters1.StorageManagementTheCedarruntimesystemprovidessupportbothforautomaticstoragemanagementandforexplicitstoragemanagementintheMesa6.0style.TheprogrammerindicateswhichofthesehewantswhenheusestheNEWexpressionby(perhapsimplicitly)specifyingastoragezonefromwhichtogetnewstoragespaceforaCedardatavalue.ThemaximumallowedstoragespaceforaCedardatavalueis64Kwords.TheCedarstoragemanagementfacilityisbuiltontopofthePilotSpacemachinery.Normally,aclientofCedarwillnotexplicitlyusePilotSpacesfordatastorage.1pî ®ïaï î­ qî ®ï_brînï_bî†qî#ïï_brî+¯ï_bî0ýî3:qî ®ï\Õrînï\Õî“qî#ïï\Õrî+¯ï\Õî.Éqî ®ïZHrînïZHîFî^î!qî+¯ïZH rî3oïZHsî{ïR˜rî ®ïHŽîLîÌð.tî ®ïFîoîÕîÖî¦î1î jî%î&žî(Aî*×î1,î3î6Aî9î=Gî?,îAÍîDXî ®ïDZîªîMrî ®ïAÍ îoï?@îŽîËî;îûî®î!£î$äî&–î,˜î1ôî3ôî8 î@¿îCzîoï=˜îsîî:îÈî$/î)iî+Öî0î6î;mî>jîA“îDÝîoï;ñ îáî½ î$?î(î,Eî.ýqîoï9dîü îîÏîî"[î&dî)¢î*úî-rîoï6×î/ îAîSî"î$»î&’î,6î.î3Nî7Dî8˜î>&î?¼ îoï50î}îéî�î=î�î"µî%åîoï2¢î‰îöîkîËî#Ýîoï0îûîð îxï.eî´uîŒï.eî‰ï.e rîôï.eîxï.eî€ï,µîÅî€ï+îÅî€ï)TîÅ îîwî€ï'¤îÅîxï%óî´uîŒï%óîŸï%ó rî Áï%óî!Fï%óîoï$Cîûî/ î6î íî&©î+/uî.ï$Cî/ï$C rî8Îï$Cî9Rï$Cîxï"’î´îxï âî´î= îxï2î´ îIî î"„îxï�î´îoïÑîûîÖuî®ïÑîÁïÑ rî#ñïÑî$vïÑîoï!îû îÑ î ®ï”î:î/ îoïîcî—îëî ‚î&-î+Uî.®î1î7zîrîBtîD!îGžîoï¸îLîüîèîÝvî8ï¸î5ï¸rî!çï¸î"�ï¸î(›î*’î04 î6Ç î=:wî>_ï¸î>ãï¸îCrîF(ï¸îF¡ï¸îoïîzî%îkîWîî"¸î$óî&î*/î-1wî1/ïî2ïî3ïî:Jî?%îCËîGgîoïiî¤î¦î«î6î¡î�rîoï ÜîCîWî î#î'œî)î,Gî.Hî0¹î2nî4Éwî8 ï Üî8çï Ürî;þï Üî=(ï ÜîC îoï 5î™îYîî*îÖîK î%2î'§î*íî/jî1§î4¬vî)ÈïöÿéTVm$ÒInCedar,therearetwotypesofstoragezone:ZONEsandUNCOUNTEDZONEs.ThecharacteristicthatdistinguishesZONEsfromUNCOUNTEDZONEsisthedeallocationmethod:storagefromaZONEisdeallocatedautomatically;storagefromanUNCOUNTEDZONEisdeallocatedexplicitlybytheclientprogramviatheFREEstatement.IfauserdoesnotspecifyastoragezoneparametertoNEW,storagewillbeallocatedfromadistinguished,predefined(collectible)ZONE,calledSystemZone(morebelow).Itisoftenconvenientandnaturaltousedifferentstoragezonesorstoragemanagementstrategiesfordifferentpurposes.TheSafeStorageandUnsafeStorageinterfacesprovidefacilitiesforcreatingdistinctzonesandforchoosingamongseveralalternatestoragemanagementstrategies.EachzonecreatedbyeitherSafeStorage.NewZoneorUnsafeStorage.NewUZonegetsitsstorageinunitsofstoragequantafromasingleBase.Azone'sBaseisspecifiedasaparameterwhenthezoneiscreated(seethedescriptionsofNewZoneandNewUZone,below).ABaserepresentsacontiguousregionofvirtualmemory.Basesareusedtodefineregionsofvirtualmemoryfromwhichzonesgettheirdataquanta.Thisisusefulbothforcircumscribingandforlimitingthestoragethatcanbeacquiredbyzones.ABasemaynotbemovedorextendedafteritiscreated.Foranapplicationthatdoesnotrequirecircumscribedregionsofvirtualaddressspace,theprogrammerneednotuseBasesexplicitly.IftheprogrammerdoesuseoneoftheproceduresthattakesaBaseparameter,hemayoptforthepre-definedRootBase,definedbelow,bydefaultingtheparameter.Astoragequantumisacontiguousblockofstoragecellsinvirtualmemory.Thequantumsizeisacompile-timeparameteroftheruntimesystem;thelocationofaquantumisdeterminedwhenthequantumisacquiredfromitsBase(atruntime).Eachzonerepresentsasetof(notnecessarilycontiguous)storagequanta.AtanygiventimeazonemayhaveasfewaszeroquantaorasmanyquantaasitsBaseowns(seethedescriptionsofExtendZoneandExtendUZone,below).Theidentificationofazone'sBaseismadewhenthezoneiscreatedanddoesnotchangethereafter.Theruntimesystemmaintainsatable,calledthequantummap,thathasaonewordentryforeachquantuminvirtualmemory.Thistableisindexedbythemostsignificantbitsofavirtualmemoryaddress.Therewillbeonenon-nullentryinthequantummapforeachquantumthathasbeenacquiredbyaZONE.EachquantummapentrycontainsenoughinformationaboutaquantumtofindtheZONEtowhichitbelongs,amongotherthings.(Notationalpoint:wewilloccasionallyusethewordobjectbelowtomeancontiguouswordsofstoragespaceforaCedardatavalue.)1.1TheSafeStorageInterfaceThisisaSAFEinterfacetothefeaturesoftheCedarstoragemanagementfacilitythatallowtheprogrammertodealwithBases,(counted)ZONEs,andthereference-countingcollector.ZONEmanagementSizeRepresentation:TYPE={quantized,prefixed};ThisisanargumentusedwhenanewzoneiscreatedbyNewZoneorNewUZonetoindicatehowsizeinformationistoberepresentedforobjectsfromthezone.Thequestforgoodperformancemotivatesachoiceofsizerepresentation:quantizedzonesaregoodiftherewillbemanyobjectsofthesamesizeandtype,orofafewdifferentsizesandtypes.Prefixedzonesaremoregeneral(e.g.forTEXTobjects),but2rîoïb)î„î;î î¤î–î#qî%pî*hî.mî3Áî6¿îA îF·îoï`‚ î…î+ î"î'î*Dî4#î9 î:Nî<† îD îoï^Úî2î©îãî|îø î&< î/8î3ûî7rî9sîCŠîH#îoï]3 î¢ îŠî†î åî$¥î*4î,qî.Ñî3 îoïZ¥îî?îJî�îîÃî ÿî%Ãî)î/°vî1pïZ¥î2mïZ¥rî4 ïZ¥î5ŽïZ¥î:Sî=î?îDìîHeîoïXý î% î î&‹î+lî/d î70î;=îoïVoîËîî“ îrîî#¥î%8î'‘î-î1±î5_î7î;ž îCœ îoïTÇîÓîŸîäuî âïTÇî!ßïTÇ rî*pïTÇî+ïTÇuî-NïTÇî.aïTÇ rî8©ïTÇî9 ïTÇî>úîD+ îoïS îî–îÄî çî#÷î&Žî,¢î1�î6kîZîoïI wî ïI îýïI rî`ïI îäïI îñî) î#)î'{î)Cî-¬î3î7Mî9°î<úî>·îBÿîGÖîoïGfîÏîAî­î Àî$�î&Þî**î-4î2#î5Bî6³î:Ñî>î@U îoïE¿îZîËîî³î!™î$›î'Zî)~î/Xî1ˆî5Ýî7�î; î>Dî@íîCîGËîoïDîWî“îéîUîoïA‰îFîb î îšî!öî$–î)‹ î2‚î7vî9[î=áîBöîG/îoï?â î_îÊîMîÐî#� î)êî+zî-è î5Øî9î;šî>Sî@îBˆ îoï>:îyî2î—î î"$î$Pî'�î*@î,¹î/T î6úî=·îBóîG“îoï<“ îòîQ îoï:wîï:î†ï:î°rîYï:î½ï:îËîû î$ñî(·î*vî/.î2Cî3÷î8Wî>"îAîFäîoï8]îôî8 î£î!?î#î%Šî*Ûî/éî2bî7³î9†î:Éî@ÀîBF îoï6¶î$î„îaîÍî"sî%Úî'µî*ðî-îoï4'îêî8 îÂîôî î!Ùî$Ð î+± î3#î7Þî<Ðî>ÓîA|îE8îHeîoï2€î·î¼îî´îWîî" î& î(fî*î-âî2vî4&î6î9?î<Éî?—îAø îoï0ÙîD î-î î%`î*Yî-M î5Æî7›î8áî=î@vîAþîEÚîoï/1îÏîî€îJîî!1î#¦î(N îoï,£îRî”îî"dî#™î'dî+fwî-Ðï,£î.€ï,£î3~rî5õï,£î6Üï,£î9µî<5î=iî@ îC³îGRîoï*üîŸî|î)î‚î$Fî'_î*Æî,1î1gî3bî5Áî9 î?³îBTîD îE4îoï)TîÚîîî Áî"¯î%Xî*ðî.�î0,î2‰î8dî;|î=·î@åîFÁîoï'­îßî8îÙîÐîöî"Òî&@î,î//î2¾î8î= îDˆîHeîoï&îMîûîêîIî Òî"�î&�î'åî-Hî1Íî5lîoï#w îÁîÞî î¼ î'aî)Ûî,@wî/Îï#wî0~ï#wrî3Áï#wî4ˆï#wî7Óî9‡wî=Lï#wî=çï#wîDîGëîoï!Ðîî·îßîîî"rî%yï!ÐîoïAî¬uî„ïAî�ïA rîëïAîpïAî1ï³îvî îaî¯î"€î$Yî&äî,;î.î0©î4íî9Ê îBîFÁî1ï î÷ît î tî"?î%Vî(Žî,Ãî3î8šî;nî=ëî1ïd î1ïÖîº uîòïHî$î(Lî*0 î2ò rîòï¹îî€îtî!¢î$âî(›î)Èî,ºî0î1sî6Aî8@î>�î@eîGàîòïîî#îÎ î'Yî(Äî*sî,c î3Îî6 î:¨î>î@nîòï ƒîÙî“îßî!` î)rî/«î0ãî57î6ÿî9¹îC8îòï ÜîÑî:îÁî 6î#Ôî&•î(šî,yî1+î2ùî5nî9î;Àî>ŒîB îCâîE¯îFîîòï 5î’î¼î mî$Sî)Æî-‹î/Ùî3fî83î;0î=gîA¥îGvî)Èïö UTVm$]theirallocatorisslower,eachobjectrequiresextrastoragecellstocarrysizeandtypeinformation,andprefixedzonesaresusceptibletofragmentationproblems.Thesizeandtypeofanobjectfromazonethathasaprefixedsizerepresentationiscarriedin2prefixwordsoftheobject.Forpurposesofallocationefficiencyandflexibilityinprefixedzones,thesizeofanobjectmaybebiggerthanisrequiredforavalueoftheobject'stype.Eachquantuminazonethathasaquantizedsizerepresentationsuppliesobjectsofonlyonesizeandtype.Thesizeandtypeofanobjectfromsuchaquantumisdeterminedfromtheinformationinthequantummap.Effectively,thequantummapentrypointstoadescriptorforallquantainthezonethathavethesamesizeandtype.Thisdescriptoridentifiesthesizeandtype.(Notethataquantizedzonecansupplystorageforobjectsofdifferentsizesandtypes.Eachquantuminaquantizedzoneisuniformwithrespecttosizeandtype,butdifferentquantainthezonemayhavedifferentobjectsizeandtypeattributes).NewZone:PROC[sr:SizeRepresentation_prefixed,base:Base_nullBase,--defaultwillusetheRootBaseinitialSize:LONGCARDINAL_0--words]RETURNS[ZONE];ZONEsarecollectibleobjects.AZONEwillbereclaimedautomaticallyifnoreferencestoitremainaccessibleandifnoreferencesremainaccessibletostorageinanyofitsquanta.TrimZone:PROC[zone:ZONE];Thismergesadjacentblocksonzone'sfreelistsandthenreleasesallquantathatdonotcontainallocatedstorage.Releasedquantaarereturnedtothezone'sBase.TrimAllZones:PROC;ThisinvokesTrimZoneforeachZONE.MergeAllPrefixedZones:PROC[zone:ZONE]RETURNS[BOOL];ForeachprefixedZONE,mergeadjacentfreeblocksonitsfreelist.IsZoneEmpty:PROC[zone:ZONE]RETURNS[BOOL];ThisreturnsTRUEiftherearenoquantaassignedtothespecifiedzone.GetSystemZone:PROCRETURNS[ZONE];Thisreturnsapredefined,prefixedZONEintheRootBase.ThiszoneisusedforNEWexpressionsinwhichthezoneargumentiselided.ControllingthegarbagecollectorSetCollectionInterval:PROC[newInterval:LONGCARDINAL--words--]RETURNS[oldInterval:LONGCARDINAL];Thecollectorisautomaticallyinvokedwheneverncollectiblewordshavebeenallocatedsincethelastcollection.SetCollectionIntervalallowstheclienttospecifyn.Garbagecollectionwillalsobeinvokedautomaticallybythereference-countingmachinerywhenitstablesbecomefullorwhenmorequantathanareavailablearerequiredfromaBase.Ifthetablesoverflowduringacollectionthenreferencecountingandtheincrementalcollectorwillbedisabled.Thetrace-and-sweepcollectorwillbeinvokedatthistimetoperformamoreleisurelyandthoroughcollection(recoveringcircular3rîòïb)î>îÜîMî#øî'-î+Kî0œî4î8Êî;Þî=‘îAîCÃîFîòï`‚ îÔîŒî$úî(Äî+ î2î3à î<˜îòï]øî×î�îTî qî"7î$4î(Zî+Îî-î0Wî33î5µî6ëîî§î" î)–î+Gî-©î3‰î6ý î>2î@”îFtîòïQƒîtî†î#î: î%•î'Áî)Ÿî. î/¼î2 î5>î7úî;/î=}î@èîC‚îF'îòïOÜî) î³ î$Ãî'?î*î,Üî0`î4mî7Xî8Ÿî?îBvîEîòïN5î±îûî ¤î"iî(î+Xî.î2î5“î;}î=8î>nîDÑîH#îòïL�î{îÇî"¡î$�î']î*Fî-ßî0‘î6hî;,î= î?œîCîFHîòïJæî˜î±î!\î$î'# uîòïH]î¢îïF®î7îªî,Cî-Ïî¥ïEî 'î$;î%Çvî-‚ïEî-ûïEî.ùî3áî6vî9Cî;Íuî¥ïCQ î#·î(Oî0‚î2vî4ïCQî4�ïCQî5~uîïA£î7 rî´ï?îôîz î&/î+Vî-î1Ñî4¯î6Òî=P îEõîG‰î´ï=r î+îÐî!î%¸ î+îî.›î/òî1î î8fî= îC8îDÝî´ï;Ëîbîî¼î–uîòï9Bî î%òrî´ï6¹îÊîwî$âî)"uî+$ï6¹î+êï6¹rî.ˆï6¹î.áï6¹î/åî2®î5kî8î;Aî@FîB2îFÁî´ï5î²îî õî&³î+µî1~î6î8Sî=æî?ŒîAãîEüuîòï2ˆ î‚rî´ï/ÿîÎuîÍï/ÿî ³ï/ÿrî'$ï/ÿî'�ï/ÿî)aî,’uîòï-vî&Ä î/ôî5 rî´ï*ìî_î�î"þî'àî,î1}î4Iî8Žî:”îIîAdîEçîòï Îîÿ îîºî"£î'Pî)›î+  î1¿î6Qî8“î:?î>ýîAbîòï &îSîcîÞî!î"5î$>î&°î'öî,*î-î/Ðî4î68î:é î?Î îE}vî)Èï TTVm$üstructuresandinaccessibleobjectswithpinnedreferencecounts)andreconstructthereferencecounttable.SetMaxDataQuanta:PROC[nQuanta:CARDINAL]RETURNS[CARDINAL];ThisestablishesthemaximumnumberofstoragequantathattheCedarruntimesystemwillrequestfromthePILOTSpacemachinery.Whenanallocationrequestoccursthatwouldcausethislimittobeexceeded,acollectionfollowedbyTrimAllZones[];TrimRootBase[];willoccurandtheallocationrequestwillthenberetried.SetMaxDataQuantareturnsthepreviousvalueofthisthreshold.Athresholdvalueof0meansthatnolimitisenforcedbytheCedarruntimesystem(thisisthedefaultsetting).ReclaimCollectibleObjects:PROC[suspendMe:BOOLEAN_TRUE,traceAndSweep:BOOLEAN_FALSE];Thiscausesacollectiontobeinitiated(returntothecallerwillbedelayeduntilcompletiononlyifsuspendMe=TRUE).Whenthecollectionfinishes,apassismadeoverthefreelistofeachprefixedzonetomergeadjacentfreeblocks.IftraceAndSweep=TRUEthenaTraceAndSweepcollectionwilloccurratherthananincrementalone.ATraceAndSweepcollectioncausestheworldtowedgeforroughly30seconds.TheCedar"garbagecollection"strategyisbasedonthemaintenanceofreferencecountsbyanincrementalcollectorthatrunsconcurrentlywithclientprograms.Thesystemwilldoatrace-and-sweepcollectioniftheincrementalcollectorrunsintotrouble,forexampleifitstablesoverflowduringacollection.Acompactifyingcollectorisplanned,butisnotyetdesigned.MonitoringthegarbagecollectorTheproceduresbelowareintendedforusebya"collectorwatcher"process(seetheexample).ReclamationReason:TYPE={clientRequest,clientTAndSRequest,clientNoTraceRequest,rcTableOverflow,allocationInterval,quantaNeeded};IsCollectorActive:PROCRETURNS[active:BOOLEAN,previousIncarnation:CARDINAL];WaitForCollectorStart:PROCRETURNS[incarnation:CARDINAL,--identifiesthecollectioneventreason:ReclamationReason,wordsAllocated:LONGCARDINAL,--sincepreviouscollectionwasinitiatedobjectsAllocated:LONGCARDINAL--ditto--];Thisreturnscontrolsometime(soon)afterthecollectorbecomesactive.Returnsimmediatelyifthecollectorisalreadyactive.WaitForCollectorDone:PROCRETURNS[incarnation:CARDINAL,reason:ReclamationReason,wordsReclaimed:LONGCARDINAL,objectsReclaimed:LONGCARDINAL];Thisreturnscontrolsometime(soon)afterthecollectorceasesactivity.Returnsimmediatelyifthecollectorisinactive.4qîòïbX îóî î"î%¿î(;î+ôî0¿î4œî6È îWîC"îF4uîòï_Âî#Í î/²î†ï^ rîòï[vîñ î›î ßî'Eî,Wî-ôî2Œî7î9¶î;úî?÷îEîòïYÏî�îXî±î"î&³î*ž î1¡î5¬î7� î=ÂîB‰îFÁîòïX'î!îÖîwî"¾î$lî&]î,¨î-Ò î4î9«yî¢ïVrî$ rîòïT½îšîVî î e î&¡î+qî.î1:î3'vî7ëïT½î8ÓïT½rîDÜïT½îE`ïT½îòïSîxî-î ýî"Üî%£ î,5î-èî4#î7òî9Ñî;,î?–îBŠîD·îH#îòïQnî£îžîþî#î(Mî,Éî/ãî1Oî3¯î8WuîòïNØî))î7(î>¿î@Jî) ïM" î5Šî= î>¬rîòïJŒîMîÆî1 î$¦î&”î(Åî.iî3Rî5@î7àî;Õî>Áî@òîFHîòïHä îîvî NïHäî þïHärî(ïHävî)åïHäî*ÂïHärî-¤ïHäî.ïHäî.áî2âî5* î;Gî@‡îA™îD{îEÏîòïG=îàîî´îÆî Sî#Xî(šî+´î-6î18î6{î9î=Œvî>âïG=î?PïG= rîòïE–vîÏïE–î¬ïE–rî ïE–îxïE–î'îH î)‚ î/¯î2Qî6 î:î=,î? îFŒîòïCîî î Á î&öî+/î-�î1zî3)î7mî9ªî>Àî@¥qîòïAXî5îwî î$šî(§î)Æî,Ýî.wî0Y î6¿î8î<âî@ZîAìîCu îòï?°îaî›î î$pî&çî)ãî/î1Cî4Õî6óî8Žî9xîA† îFxîGŽîòï> îÜî8î!�î#Îî'Òî)†î-Ñî.Õî0:î3Gî7½î;4î< îA3îBZ îòïî7Ï îòï,õî"cî'î3úî*ï+@î9ˆ îòï(©î%Çîï&ôî*Êrî$÷ï%? î+Ýî.< î4quîÄï#Šî%²îÄï!Õî, î0¤rî!Ôï î"Nï î#Kî'Bî,Ñ î3î5²uîÄïjî-î1 rî9Pïjî9Éïjuî=øïjî>’ïjrîòïÓîdîoî"zî)î-—î1*î3âî9Éî?»îDWîòï, îÊî+î Šî&î'…î,Yuîòï•î%Ýîïàî*Êî Hï+î&6î Hïvî-@î1Øî HïÁî.<î2Ô rîòï*îuî�î"«î)Hî-éî1�î4Uî:Mî>ÎîDWîòï ƒ îÊî+î Šî&î'…vî)ÈïöŸTVm$9Exampleofa"collectorwatcher"process:...CollectorWatcher:PROC={DOni,incarnation:CARDINAL;reason:ReclamationReason;wordsAllocated:LONGCARDINAL;--sinceprevcollectionstartobjectsAllocated:LONGCARDINAL;wordsReclaimed:LONGCARDINAL;objectsReclaimed:LONGCARDINAL;[incarnation,reason,wordsAllocated,objectsAllocated]_WaitForCollectorStart[];IFstopPleaseTHEN{cwStopped_TRUE;RETURN};WriteString[SELECTreasonFROMclientRequest=>"[clientRequest",clientTAndSRequest=>"[clientTAndSRequest",clientNoTraceRequest=>"[clientNoTraceRequest",rcTableOverflow=>"[rcTableOverflow",allocationInterval=>"[allocationInterval",quantaNeeded=>"[quantaNeeded",ENDCASE=>ERROR];WriteString["Collectioninitiatedafterallocating"];WriteLongOctal[wordsAllocated];WriteString["words,"];WriteLongOctal[objectsAllocated];WriteLine["objects]"];[ni,,wordsReclaimed,objectsReclaimed]_WaitForCollectorDone[];IFstopPleaseTHEN{cwStopped_TRUE;RETURN};IFni#incarnationTHENWriteLine[""];WriteString["["];WriteString["Collectionfinished,"];WriteLongOctal[wordsReclaimed];WriteString["wordsreclaimed,"];WriteLongOctal[objectsReclaimed];WriteLine["objectsreclaimed]"]ENDLOOP};...Process.Detach[FORKCollectorWatcher[]];StatisticsNWordsAllocated:PROCRETURNS[LONGCARDINAL];Thisreturnsthenumberofwordsofcollectiblestoragethathavebeenrequestedsincethebeginningoftime.NWordsReclaimed:PROCRETURNS[LONGCARDINAL];5rîòïb)î­îfî� î#Ðî)¢îòï_¬yîòï^î$ î(XîÊï\Zîzî*ïZ²î‰ î'€î*ïY îéî*ïWaî&¨î*àî9ïU¸î$øî)0 î2wî*ïTî(Xî,�î*ïRgî&¨î*àî*ïP¾î(Xî,�î*ïMm î$øî+¸î96îaïKÅîî*ïJî± î$øî)0 î2wî4'î96î*ïHt îaïFËî#Iî)0îïE" î*àî-gîïCzî/î1ŸîïAÑî0Çî3Oîï@)î,�î/îï>€î/î1Ÿîï<Ø î*î,�î9ï;/î$øî'€î*ï9‡ î$ø î.?î6®î;¾ îEî*ï7Þî*ï65 î$øî*àî*ï4�ð!î*ï2ä î#I î*ï1<îaîî,�îaï/“îî*ï-ëî± î$øî)0 î2wî4'î96î*ï,Bî±î9îé î*îòï(òî$ø î.?î2wî96î*ï'Jî*ï%¡ î$ø î.?î6®î*ï#øî*ï"P î$øî* î3Oî*ï §ð!î*ïÿ î#Iî* îRïVîòïîòï]î%Ðrî1ïb uîòïäî"nî'' î3? rî´ïgîÐî†î!çî'î(Ñî,áî.œ î5!î9Õî<¦î?ïîCNî´ï ¿î&î†î#òî%ªuîòï Bî#î'Ö î3ï vî)ÈïýÿpTVm$‹Thisreturnsthenumberofwordsofcollectiblestoragethathavebeenreclaimedsincethebeginningoftime.BasesRTBasic.Base:TYPE...ABaserepresentsacontiguousregionofvirtualmemory.Basesareusedtodefinetheoriginforrelativereferencetypes(whicharenotimplementedyet)andtodefineregionsofvirtualmemoryfromwhichzonesgettheirdataquanta.Thislatterpropertyisusefulbothforcircumscribingandforlimitingthestoragethatcanbeacquiredbyzones.ABasemaynotbemovedorextendedafteritiscreated.GetRootBase:PROCRETURNS[Base];ThispredefinedBaserepresentstheentireaddressspace,notincludingtheMDS.ItisthedefaultBaseforcreatingnewBasesandzones.NewBase:PROC[size:LONGCARDINAL,baseParent:Base_nullBase]RETURNS[Base];sizeisinwords,roundedtothenearestnumberofstoragequanta.Aquantumisasectionoftheaddressspacethatincludesaddresses[j*Q..(j+1)*Q)whereQisafixedvaluecalledthequantumsize(currently4pages)andjiscalledaquantumindex.AquantumisthesmallestamountofaddressspacethataBasecanoccupy.ThenewBaseobtainsitsstoragequantafromitsparentBase.UseofthenullBasedefaultforthebaseParentargumentcausesRootBasetobeusedastheparent.Basesarecollectibleobjects.ABasewillbereclaimedautomaticallyifnoreferencestoitremainaccessible(thiscanbetrueonlyiftherearenozonesinit).ItsquantawillbereturnedtoitsparentBase.TrimRootBase:PROCRETURNS[nSpacesDeleted:CARDINAL];TrimRootBaseattemptstofindanddeletePilotspacesthatareassignedtotheRootBasebutfromwhichnostoragequantaarecurrentlyassignedtoanyZONE.Afteracollectionfinishes,thecollectorinvokesTrimAllZones[]followedbyTrimRootBase[]ifthecollectionwasinitiatedbecausevirtualspaceisexhausted.UnusualoperationsonZONEsforsophisticatedclientsZoneFullProc:TYPE=PROC[zone:ZONE,size:LONGCARDINAL];ExtendZone:ZoneFullProc;ThisaddsstoragequantatoaZONE.Thequantacomefromzone'sBase.sizeisanumberofwordstobeadded,andisroundeduptothenextmultipleofthequantumsize.IftheBasecannotsupplytheneededquanta,agarbagecollectionfollowedbyTrimAllZones(seebelow)willoccur.SetZoneFullProc:PROC[zone:ZONE,proc:ZoneFullProc]RETURNS[oldProc:ZoneFullProc];WhentheallocatorfindsthatinadequatespaceisleftinthespecifiedZONEtosatisfyanewrequest,itcallstheZoneFullProcfortheZONE,andthenre-attemptstheallocation.Theinitial(default)ZoneFullProcforeveryZONEisExtendZone.SetZoneFullProcestablishesprocaszone'sZoneFullProc.6rî´ïb)îÏî„î!åî'î(Íî,Üî.– î5î9Îî<žî?æîCDî´ï`‚î&î†î#òî%ªî1ï^xîòï[ƒuîï[ƒîï[ƒîžî"ærî´ïYuîvïYî~ïYrîÀïYîDïYî$xî%× î,þî1wî3fî7öî=ðîAåîDnîGàî´ïW\îâî6î",î$^î)1î/#î2¬î7(î9pî;Ú îD!îFØî´ïUµî_î•î"Yî$î(eî-Ïî13î5=î9î;Iî>�îAŽîFuî´ïTîSî øî"nî&‘î)Øî, î5eî8'î:oî?šîBîFÁî´ïRfîvîžî"{î$®î)î*Êî.<î1wî4$î6Kî; î=îC#îF–îH#î´ïP¿uîòïN@ îKî$ rî´ïKÀîÉ î!¶î$í î+jî-Åî1­î6“î:œî= îCîEwî´ïJî+î—îöî!Ÿî$Úî'î,Nî/<î2ûî5³uîòïGšî¢ î%Nî)æîAïEð î(’î,¦î.2î5‰ î´ïCqrîïCqî{ïCqî„î2î"—î(î)Êî,)î0Üî6î7ÁîÂîBnîE3îFTî´ï;üî?î´ï9|îjî7î Pî$øî&±î+Aî/²î2øî4±î8ßîüî@“uîBÑï9|îC¸ï9|rî´ï7ÕîTîŠuî áï7Õî!Ýï7Õrî)±ï7Õî*Wï7Õî/Óî4î:&î;Íî=µî@êîB�îDçî´ï5VîNî} î#Ûî(«î*î-)î/¯î1{î7¡ î?ïîA,îC î´ï3®îRî˜î. î%^î(iî*ãî,Äî/—î2¡î3ñî7jî9­î;£î?]î@úîCîDüî´ï2î_îPî!ëî#™î%tî)Äuîòï/ˆ î î$Êî9 rî´ï- î øî&«î(|î+�î.gî2—î6î:\î=Mî?ÃîE^îG/î´ï+aîÔî Mî#«î'°î)®î.Wî2áî5,î;î@pîBîD®î´ï)ºî±î9 î#Íî)ƒî,Aî2/î7� îA�îG“î´ï( î!œî"ýî%\ î+‘î.=î3 î8Âî=î@ÒîB> î1ï%“îµ îcî iî%wî'´ î/Ûuîòï# î‚î#Êî%® î.Þî3Ëî7¨î<@ îòï • îa rî´ïîÔîî"Ïî'gî)î*Lî/3î2î6ªî:Yuî=Çïî>ŒïrîA+ïîAƒïîB’uîF*ïîFûïrî´ïnîîCîmî!#î%-î&Øî(Æî-?î/ôî1]î6ßî8îî:™î<öî@îEyîG/î´ïÇî™î ¤î".î$•î'Øî,\î0Õî3<î8 î=î>1îCZ î´ïîXîT î(3î*ÿî/†î21uîòï î!êîïöî7î˜î¥ïMîæ îï£î7î)> rî´ï$îÞîOî#ûî'€î*` î1zî5Aî6¿î9Fî;î=wîCEîGàî´ï }îÂîÌîšî$¦î%Ýî(Ìî+ î3Ÿî5½î7üî<¾î?UîB[ î´ï Õî î Ÿî#qî'Wî,í î5›î7Òî;�î@îAk î´ï .î"C uî)ï .î)îï .rî,Ïï .î-tï .uî.}ï .î/Bï .rî1áï .î29ï .î3B vî)ÈïýÿÎTVm$%SIGNALsandERRORsInvalidSize:ERROR[size:LONGCARDINAL];RaisedbytheallocatorandbyNewBase,NewZone,andExtendZoneiftheirsizeargumentistoobig.MemoryExhausted:ERROR[base:Base];RaisedbytheallocatorandbyExtendZoneandExtendUZone.NarrowRefFault:ERROR[ref:REFANY,targetType:Type];RaisedbyNARROW.NarrowFault:ERROR;RaisedbyNARROW.UnsafeProcAssignment:SIGNAL[proc:PROCANYRETURNSANY];1.2TheUnsafeStorageInterfaceThisisanUNSAFEinterfacetofeaturesthatallowtheprogrammertodealwithUNCOUNTEDZONEs.NewUObject:PROC[size:CARDINAL,--wordszone:UNCOUNTEDZONE,type:RTTypesBasic.Type_RTTypesBasic.nullType]RETURNS[LONGPOINTER];ThisisausefulalternativetotheMesaNEWexpressionforallocatingobjectsfromanUNCOUNTEDZONEthatcarrytheirtypes.GetHeapReferentType:PROC[ptr:LONGPOINTER]RETURNS[type:Type];ThisreturnstheTypethatisassociatedwiththespecifiedobject.THISISUNSAFE.ItisintendedonlyforobjectsthathavebeenallocatedfromanUNCOUNTEDZONEthatwascreatedbyNewUZonewithtypeRepresentation=TRUE.Ifptr=NIL,GetHeapReferentTypereturnsnullType.NewUZone:PROC[initialSize:LONGCARDINAL_0--wordssr:SizeRepresentation_prefixed,typeRepresentation:BOOL_FALSE]RETURNS[UNCOUNTEDZONE];NewUZonecreatesanewUNCOUNTEDZONEthatwillgetitsquantafromtheRootBase.FreeUZone:PROC[uz:UNCOUNTEDZONE];FreeUZoneexplicitlydeallocatesuz,whichisassumedtobeanobjectthatwascreatedbyNewUZone.ExtendUZone:UZoneFullProc;ExtendUZoneaddsquantatoanUNCOUNTEDZONEthatwascreatedbyNewUZone.ThequantacomefromtheRootBase.sizeisanumberofwordsthatisroundeduptothenextmultipleofthequantumsize.AgarbagecollectionfollowedbyTrimAllZonesisinvokedifRootBasecannotsupplytheneededquanta.UZoneFullProc:TYPE=PROC[zone:UNCOUNTEDZONE,size:LONG7rî1ïb)îÁîxuîòï_« îÊ î'Oî+ç rî´ï].î6î-î ˆî&î(Ñî*Èî1î7Éî:| îBEîC¡îFäî´ï[‡îÞîIî!³uîòïY î#& î-Orî´ïVŒî:î6î •î&/î(çî*â î2¯î5f uîòïTî!P î*î-Oî1o î:Grî´ïQ‘î:î6uîòïO îÝrî´ïL–î:î6uîòïJî&Ú î13î5ìî9“î@ýrîoïG›î¬uî„ïG›î—ïG› rî¹ïG›î =ïG›î1ïEî¸î�îîî ¾î&Ñî(ìî.†î1Áî5×î8£ î@òîCîFtî1ïCvî7uî1ï@ø îGîXï?PîuîSî%ƒî'%îäï=§îEî'îäï;þxîï;þîáï;þ uî%¤ï;þî&‹ï;þî)­xî+9ï;þî, ï;þ uî3Ðï;þî4¶ï;þîXï:Vîuîàî%rîòï7ØîîhîŠî› î%Lî&òî)Jvî,ëï7Øî-éï7Ørî0˜ï7Øî1=ï7Øî7Hî9} î?ªîD?îGžîòï61îùî#‚î&Pî)Îî-uî1ï3´î#î+î/šîPï2 î!ûrîòï/�îîÈî,î"¹î%Œî&ü î-lî0‹î2ïî8°î=$îAîBÔîòï-æîTîªîQî Vî"}î'î)¾î,ïî06î5èî9:î;îEîòï,?îêîÀî´î!Ùî){î,Àî8ñî;î?üuîA¨ï,?îB�ï,?vîDpï,?îF€ï,?rîH²ï,?vîòï*—rî#Áï*—î$Eï*—vî(tï*—î)Fï*—rî-íï*—uî1ï(îóîXï&qîu î ‡î%î-Sî.Þvî0Øï&qî1Qï&qî2Ouî`ï$ÉîÓî)kî*÷î`ï# î'“î,6î-ÁîXï!xîuî)±vîòïúrî¸ïúîSïúî!gî"¸î%Íî/ûî4¬î7¢î:uî<åî>çîC¡îG/îòïSuî1ïÕ îî"Œî,HvîòïXrî‹ïXî0ïXî"V uî)+ïXî*ïXrî*×ïXî+—ïXî/‰î0Ùî6Lî7Þî9³î;‡î?„îB6îDÅîòï°uîîï°îöï°rî³ï°uî1ï3 î² vîòïµ rîÀïµîfïµî"~î'“î)Ãî,6î6¾î;Êî?îBHîG“vîòïrî ïî`ïî 2î$¾î(aî+Âî.uî4•ïî5fïrî7óïî8Vïî9Xî:|î?¢îATîE[îH#îòïgî‰î®îoî áî$î)Žî+Zî-Ìî3¼î6Ñî8pî=£ îCêîòï ¿îî îÌî!8î&zî'Úî.î2€î6ñî9Pî>uî1ï B î“î#œî&@ î00î:¬î@YîDövî)ÈïöfTVm$CARDINAL];SetUZoneFullProc:PROC[zone:UNCOUNTEDZONE,proc:UZoneFullProc]RETURNS[oldProc:UZoneFullProc];Whenzone'sallocatorfindsthatthereisinadequatestoragespacetosatisfyanewrequest,itcallszone'sUZoneFullProcandthenre-attemptstheallocation.Theinitial(default)UZoneFullProcforeveryUNCOUNTEDZONEisExtendUZone.SetUZoneFullProcestablishesthespecifiedprocedureasthespecifiedUNCOUNTEDZONE'sUZoneFullProc.MergeUZone:PROC[zone:UNCOUNTEDZONE];MergeUZonemergeszone'sfreelists.ForprefixedUNCOUNTEDZONEs.TrimUZone:PROC[zone:UNCOUNTEDZONE];TrimUZonemergeszone'sfreelistsandthenreleasesallquantathatdonotcontainallocatedobjects.Releasedquantaarereturnedtotheoperatingsystem.IsUZoneEmpty:PROC[zone:UNCOUNTEDZONE]RETURNS[BOOL];IsUZoneEmptyreturnsTRUEiftherearenoquantaassignedtothespecifiedzone.GetSystemUZone:PROCRETURNS[UNCOUNTEDZONE];Thisreturnsapredefined,prefixedUNCOUNTEDZONEthatwillgetitsquantafromtheRootBase.Ithasnotyperepresentation.InvalidPointer:ERROR[ptr:LONGPOINTER];RaisedbyFREE.2.UniversalReferencesandRuntimeTypes:TheRTTypesBasicInterfaceOneofthe"delayedbinding"featuresofsafeCedaristheabilitytomanipulategeneralreferenceswithouteithercompile-timeknowledgeofthereferenttypeortheuseofaLOOPHOLEtospecifythereferenttypewhenitcomestimetode-reference.Suchreferencesaretermed"universalreferences"andhavetypeREFANY.TheCedarlanguagefacilities(REFANY,NARROW,WITH...SELECT)fordealingwithuniversalreferencesaresupportedatruntimebyasystemthatcanallocateanobjectofagiventype,determinethereferenttypeofaspecifieduniversalreference,anddeterminewhethertwogiventypesareequivalent.Inadditiontosuchbasicsupportforcompiledprograms,theCedarruntimesystemprovidesanimplementationfortheRTTypesBasicinterfacedescribedbelow.Anotherclientoftheruntimetypesystemisthegarbagecollector,whichmustbeabletodetermineforeachobjectinmemorywherewithinthestorageforthatobjecttherearereferencestootherobjects.Forthispurpose,theruntimetypesystemmaintainsadatastructurethatrepresentsthisinformation(calleda"referencecontainingmap")foreachtypeforwhichacollectibleobjecthasbeencreated.2.1TypesType:TYPE=RTBasic.TypeATypeisadatumthatrepresentsaCedarTYPEatruntime.Conceptually,everycollectibleobjectincludesaTyperepresentingtheTYPEofthedatavalue.Thisisstoredwiththeobject.TheCedarNEWexpressionautomaticallyattachestheappropriateTypetothenewlycreatedobject.TheNEWexpressionistheonlywayinthelanguagetocreateacollectibleobject.8uî1ïb î1ï_¢î ;îXï]ùîuî×î&’îäï\Pî$ îXïZ§îuî&}rîòïX)uî)ïX)îïïX)rî�ïX)îåïX)î î#Åî'Vî*Cî-êî/u î6›î;kî??îA îEYîF¡îòïV‚îîeuîlïV‚î2ïV‚rî!ÐïV‚î")ïV‚î#) î,ôî/£î2Á î9íîî@L îòïS3î ˜ î'Tî)«î/^î5Øî7~î9Õî?ˆîòïQŒîX uî1ïO îH î%xî/3vîòïL� rîÑïL�îúïL�uî"ƒïL�î#HïL�rî%çïL�î&?ïL�î'Hî*î-.î/Ùî5Gî?Nuî1ïJ î î$Dî-ÿvîòïG’rî®ïG’î×ïG’uî!fïG’î"+ïG’rî$ÊïG’î%"ïG’î&1î)î+Ìî.‰î1µî6Åî8»î=Tî@(îB5îD°îòïEëî¹î®î%î*î,eî2î3¯î6î<-uî1ïCm îŽ î&¾î0zî5‡ vîòï@î rîÚï@îî^ï@îî#�î(î)hî,ñî/Eî1Kî5Þî;Wî=î?dîE uî1ï>pî¬î$eî5¡rîòï;òî?î%î‚ î%ýî+Ÿî5Øî:”î=•î@sîBïîDüîòï:JîYî¹î!9î"±î%&î',î*<uî1ï7Ìî9 î%ùî*‘rîòï5Nîyvîtï5NîFï5Nrîï5Nî ®ï2Ðî:în îtî+î#çî(muî+Fï2Ðî,Mï2Ð rî6 ï2Ðî6‘ï2Ðîoï0Qî¼î¾îfîvî#†î(ûî*ýî.î2tî4)î6Ñî;Sî=K îD¼îoï.ª î`îÚî 6 î(öî0Iî2qî5?î:Úî>Yî@‹îCZîF=îHeîoï-îáî›îCî ®î%æî)î,Áî.#î2\î5�î7G î?�îC îoï+[î®îL îÄ î#áî&„î)¶î,±î/ùî3óî6¶î:ºî@k îE¹îoï)´î™îAîËî!pî'êî*Bî//î2dî8Z î>öîAdîGöîoï( î§î¤îÏîKîî!¦î&§î(˜î,²î.lî/–î3Lî6µî=8î?˜îDÅîGÖîoï&eî™îUî1 î"†î%>î+Àî1î3ºî7nî;î=V îoï#çîUîÚîŸîæîpî$’î&æî,úî3|î5òî: î?nîDîoï"@î_ î>î{îÛ î(çî.�î4¸qîoïÁîÆîÅî%î î5î §î$;î%]î'Bî+[ î0î3Qî6 î7•î9õî;Mî@€îBJîDÖîHîoïîÖî-î§î�î oî"Iî$˜î'ïî*Óî,À î2î3lî6bî:iî<œî>ÆîCRîEHîoïsîêîˆî�î†îøî"—î$Þ î*î,> î2Nî5ãî6Ù î<9 îA¢îEîFçîoïËîâî­îëîÙ îî Vî"Mî$ýrîoïMî¬uî1ïÏî³îûxîßïÏî²ïÏuî!ýïÏî"äïÏrîòïPuî£ïPî‰ïPrîÏïPî2ïPî_î¬î" î% î+¸î-î1Bî5’î7Oî= îEÚîòï© î�îÄî%Cuî&ˆï©î'oï©rî*¬ï©î+0ï© î2Ÿî5î9bî;6î=±î@ÑîDíîH#îòïîî0î�îòï ƒîÄvîÖï ƒîÔï ƒrî„ï ƒî *ï ƒî&6 î.£î3Öî6/ uî=ˆï ƒî>oï ƒrîA‹ï ƒîAúï ƒîC4îE�îòï Üîÿî³vî!Ïï Üî"Ìï Ürî%Çï Üî&lï Üî,Ãî.rî1î4sî7Žî9€î<#îB-îDîHeîòï 5 îuvî)Èï ITVm$-ACedarexpressionoftheformCODE[<>]returnsaTypeforthespecifiedTYPE.(NOTE:thisisaninterimsyntax.TherewillbebettersyntaxinCedarforacquiringTypesfromTYPEexpressions).nullType:Type=...Byconvention,thisisadistinguished,predefinedTypethatistheTypeofthereferentofNIL.Otherdistinguished,predefinedTypesarelistedbelow:unspecType--thedistinguishedtypeofUNSPECIFIEDfhType--thedistinguishedtypeoflocalFramesgfhType--thedistinguishedtypeofglobalFramesGetReferentType:PROC[ref:REFANY]RETURNS[type:Type];ThisreturnstheTypethatiscarriedbythespecifiedobject.Ifref=NIL,GetReferentTypereturnsnullType.GetCanonicalType:PROC[type:Type]RETURNS[Type];ThiscomputesthecanonicalTypeforthespecifiedType.EachTypehasacanonicalType.CanonicalTypesareusedfortestingTypeequivalenceefficiently(ift1andt2arecanonicalTypes,thent1=t2IFFt1andt2representequivalentTYPEs).Undernormalcircumstances,theCedarclientwillnotusethisfunction.NotethatGetCanonicalType[nullType]=nullType.GetCanonicalReferentType:PROC[ref:REFANY]RETURNS[type:Type];Thisisincludedforconvenience.ItreturnsGetCanonicalType[GetReferentType[ref]].EquivalentTypes:PROC[t1,t2:Type]RETURNS[BOOL];Thisisincludedforconvenience.ItreturnsGetCanonicalType[t1]=GetCanonicalType[t2]ThiswillbeTRUEifthecorrespondingCedarTYPEsareequivalent..IsReferentType:PROC[ref:REFANY,type:Type]RETURNS[BOOL];Thisisincludedforconvenience.Itreturns(EquivalentTypes[GetReferentType[ref],type])NarrowRef:PROC[ref:REFANY,type:Type]RETURNS[REFANY];Thisisusefulforchecking,andisincludedforconvenience.Ifref=NIL,NarrowRefreturnsNIL.Otherwise,NarrowRefreturnsrefifGetCanonicalType[type]=GetCanonicalReferentType[ref]orraisesSafeStorage.NarrowRefFaultifnot.2.2TypeattachmentsPutTypeAttachment:PROC[type:Type,attachment:REFANY];GetTypeAttachment:PROC[type:Type]RETURNS[REFANY];TheseprovideawaytoassociateanarbitraryobjectwithaspecifiedType,forexampleauser-definedprintprocedure.Thisfacilityisviewedasaninterimoneuntilthereareappropriatelanguagefeaturesforusefulapplications.9rîòïb î|î‘ î!Fî"üî%Xvî(¼ïb î)¹ïb î1Ä rî;ïb î;�ïb î?Èuî@ïïb îAÖïb rîDõïb îEnïb îG/îòï`yî™îî$nî&úî(Pî*+î.éî3oî7\î9òî;Íî?¯îCÞîEwîòï^Ñî/îDî!Pî$·î(ä uî1ï\Lî\îeîIrîòïYÆî î^î òî"Qî#n î, î2ûî6vî97î:–î<éî@dîBîDcîòïXî«îî î& î-³î1Àî4î7¾î´ïU˜ îÚî!Qî#° î,î/î0Ö î´ïSìî Ÿî"î$u î,Óî/ãî1œ î´ïR?î Ëî"Bî$¢ î,ÿî0î1È uî1ïN îuî'Qî*œî.Ü î:†rîòïK†î‰î¹î –î$œî'çî)Ðî.éî1bî4?î:xî?evîAdïK†îAèïK†îDîF€rîH²ïK†vîòïIßrî fïIßî êïIßvî%ïIßî%êïIßrî*‘ïIßuî1ïGYî \ î)Uî-ø rîòïDÓîîQwî ½ïDÓî!XïDÓî&Ørî*BïDÓî*»ïDÓî,Œî.øî4Áî8­î<-î?ÃîBEîC{îòïC,îáîeî#€î%âî)-î+xî/ìî3ƒ î; îAŒîCtîE&îGëîòïA…î^î‹î" î%Gî)ƒî,tî.0î1î2¼î8Ò î?šîE4îòï?ÝîB î#âî&Õî+î/Òî3î6î9î6î'Äî)©rî/"ï>6uî1ï;°î& î.|î1ÇîPï: î!ûrîòï7~î îxîî!\ î)€î*øvîï5Ñîï5Ñð%rî1sï5Ñuî1ï3Kîî&Pî(ÎîPï1ž rîòï/î îxîî!\ î)€î*øvîï-lîï-lî%‘î'vrî5ï-lîòï+¿î î¸î¨î!#î"„î$ä î-Úî1òî6¤î8÷ uî1ï)9îBî&î)hî-ˆî1²îPï'Œ rîòï%î îxîî!\ î)€î*øvîï#Zî}ï#Zð%î1uî1ï Ô îèî"Äî&î*.î.Yî2ü î=ÇrîòïNî îxî�îÎî%âî(™î*î/«î1é îòï¡vîtï¡îøï¡rî±ï¡vî–ï¡î“ï¡rîÈï¡vî¥ï¡î¢ï¡rî%ï¡î%…ï¡vî)´ï¡î*±ï¡rî+æï¡îòïô vîÌïôîÊïôrî#(ïôî#­ïôvî'Ûïôî(`ïôrî*ïôî*{ïôvîûïHîïHrî& ïHvî'ðïHî)ïHrî9TïHvî9·ïHrî;pïHîòï›î¶zîuï›î.ï› vî!ï›î"ï› rî+¦ï›î, ï›î-îoïî¬î4 uî1ï�î!� î*ˆî/ î8;î;†î1ï î!šî&Sî+î/º î:†rîòï ƒîáîÙîïî!´î#Oî(âî*¿î0Qî4Wî7_î8uî>îAìîDîòï Üî îñî!L î(î+'î/¡î1î5šî7<î9î=æî@…îC¿îG;îòï 5 îRî"î'Dî)�î-š yî4¬ï 5vî)Èï¾TVm$†2.3FinalizationofcollectibleobjectsItisoftenconvenienttospecifyactionstotakewhenanobjectofaparticularTypeisnolongeraccessibletoanyclientofthepackagethatcreatedit.Suchpackagefinalizationactionsmightinclude(forexample)removalofareferencetotheobjectfromapackage-maintainedcache.Abuilt-infacilityforobjectfinalizationismorethanaconvenience.Inapplicationswhereapackagemustmaintaincopiesoftheobjecthandlesthatitgivestoclients,thealternativestopackagefinalizationareexpensive,andduplicateinonewayoranotherthestoragemanagementfunctionsthatthecollectorprovides.TheCedarfinalizationmechanismisspecificallytailoredtosuchapplicationsandtotherequirementsofefficiencyandsafety.Thoughonecanimaginemoregeneralfacilitiesforfinalization,webelievethatthefeaturesdescribedbelowareapowerfulandusefulset.TheyareinexpensiveandSAFE.BEWARE:Untilappropriatelanguagechangesaremade,itisnecessarytoestablishfinalizationforaTypeBEFOREallocatinganyobjectsoftheType.AllocateobjectsoftheTypeONLYintheprogrammodulethatmakesthecallstoestablishfinalization.UsetheexactsameTYPEexpressioninthefinalization-establishingcallsandinNEWexpressionsforobjectsoftheType.ProceduresEstablishFinalization:PROC[type:Type,npr:[1..maxNPackageRefs],fq:FinalizationQueue];typeisaTypeforwhichfinalizationactionsaretobeenabled.fqisaqueueonwhichthecollectorwillputREFstofinalizableobjectsofthatType.NotethatfinalizationisapropertyoftheobjectType,notoftheREFType.ThecollectorputsaREFtoanobjectonthequeueforitsTypewhenitfindsthatexactlynprreferencesremaintotheobjectinotherobjects.Inotherwords,npristhenumberofreferencesthatareconsidered"packagereferences"forthispurpose.NotethattheremustbeatleastonepackagereferenceforafinalizableType.Smallpoints:(1)Ifthefinalizationqueueisfull,thecollectorwilltryagainnexttimeacollectionoccurs.(2)Referencesonthestack(i.e.inlocalvariablesofaprocedure)arenotincludedinthecountingtodeterminewhetheranobjectshouldbefinalized.Referencesinglobalframes(i.e.inprogramvariables)AREincludedinthiscounting.Ifanyreferencestotheobjectappearonthestack,theobjectwillnotbefinalized.Typically,aclientwillFORKaprocessthatinvokesFQNexttodequeueREFsfromfqandthenperformsthedesiredfinalizationactions.FQNextwillwaituntilfqisnon-empty,sothisprocesswillbeinactivemostofthetime.TheuserprocedurethatinvokesFQNextshouldbeexternaltothemonitorthatprotectsthedatastructurebeingfinalized.ThisprocedureshouldthencallanENTRYproceduretodothefinalizationactions.Seetheexamplebelow.ReEstablishFinalization:PROC[type:Type,npr:[1..maxNPackageRefs],fq:FinalizationQueue];Thisisusefulwhen(forexample)anewversionofaprogramthatestablishes10rîoïb)î¬ î@îù î!|î1ï_›î°î$îÀ îÄî!zî&î*Äî,{î/|î3:î52î9Sî;î”ïF¦î?‘ïF¦rîBRïF¦îB÷ïF¦ î1ïDþînî îÄî#wî1ïBp uîòï?âî$æîï>1îÖîï<î‰îï:ÎîŒîï9î´ï6�rîbï6�îÅï6�îÊîñî!vî#°î'» î.Þî3xî5Èî7sî9auî>âï6�î?pï6�rî@Øï6�îA;ï6�îB@îCgîGˆî´ï4èîÚîQî#ùî&¼î)Uî-Mî/ î5Îî:ƒîýï/ rî?±ï/ î@5ï/ îA…îE)uî´ï-crî£ï-cîï-cîî_î#„î%6 î+°î.wî0à î7¡î=Œ îD·îFíî´ï+¼îVî Ôî#«î'<î*¬î,¤î.Eî1rî4&î9pî?vîA»îBí î´ï*qî´ï'†îçî°î ‚î!Ðî#Ï î)¡î- î.Eî0®î2­î78î9tî;Fî>Mî@ÙîCvîD} î´ï%ßî†îa î#!î$âî&êî)Îî,î-”î0Tî5 î6Žî7ž î=Vî?UîAnîFîGŽî´ï$7îlîîî#Nî'¶î)nî,ßî0 î2W î7C î= î>ŽîBîEÇîHî´ï"�î î!î#Ñî(Oî) î+³î0€î1­î3À î8îî:?î<î?]îBõîD�îFkî´ï éîšîáîî ûî"ˆ rî´ïZ î&îlî#Ivî&ïZî&âïZrî*‡ïZî+ÍïZî0½î3¨vî8ÄïZî9•ïZrî>6ïZî>¥ïZî@îE®î´ï³uî ï³î™ï³rîôï³î™ï³î›î"°î(|î*Ëî/„ î6švî;~ï³îäîA\îGî´ï[Œuî�ï[Œî¢ï[Œrî/êï[Œî3 ï[Œî:«î?¨îEuî´ïYärî(�ïYäî)oïYäî,Lî0;î2ëî4àî8çî<î=äî?ï îGî´ïX=îî ßî#%î&?î( î)vî,î-Š î3‘î6rî:Gî< îAåîH#î´ïV–î`îî yî#eî%(î'cî)Áî,€ î5Uî9ðî=üî?öîBSîGàî´ïTîî¤ î Gî"òî$ãî'dî)jî+Êî.¸uîòïRgî#Uî+ˆî-lîòïOàî"åî'.îòïMYî î%dî-—î/#î2$rî´ïJÒî„î“î guî,&ïJÒî,”ïJÒrî1ïJÒî1–ïJÒî6qî8·î?îD1vîEÐïJÒîFÍïJÒrîH†ïJÒî´ïI*î‚îØîcuîòïF£î7î"xî0Œ î;Xrî´ïDî<î’vî"™ïDî#–ïDrî%ËïDî&:ïDî'qî)Yî.êuî2HïDî2×ïDrî3¾ïDî4‘ïDî7äî:[î;|îA“îFÁî´ïBuîî Uî$ î&iî+øî0¡î1Ëî5'vî7-ïBuî7›ïBurî8lïBuî9jïBuvî:ËïBuî;9ïBurî<�ïBuî<òïBuî=ûuîòï?îîgî#©î1½ rîòï=gî*î¥vî ï=gî tï=grî!Éï=gî"-ï=gî#5î1ï:ßîî©yîòï8X î9î"qî$ îòï6«îÚî*î+¸îòï4ýîòï3Pî$ î.?î>EîÊï1£îzî*ï/õîaî Áî)0î*àî*ï.Hî‰ï,šîî.?î0Çî3Oî8^î‰ï*íîî#Iî'€î-gî2wî96îRï)@îòï'’îòï%åð&î5Öî8^îòï$7î%Ðîòï"Šîòï ÝrîoïVî¬î<îóxî1ïÎ uîÇïÎî@ïÎ î$ î-êxî1ïG uîÇïGîÚïGî. î7ñrî1ïÀî·vî³ïÀîšïÀrî%ÕïÀî ®ï9vî:ï9î,ï9rîGï9îËï9îÉuî¡ï9î´ï9 rî äï9î!hï9îoï²î›îîŠîÕîNî î$Cî)Œî.ªî0ùî6Äî:Í îB(îG/îoï î(îî®îî"Óî%}î(1 î.¦î0ìî4qî9¦î<¿î?RîAñîC‘îoïcîÇî îî"éî$¢î*î+²vîoï Ürî ï Üîƒï Üî«îõ vîï Üîï Ürî!`ï Üî!Îï Üî$�î&]î*ìî.&î2‰î5wvî7‡ï Üî8yï Ürî<8ï Üî<Óï Üî>ãî@óîF—îHevîoï 5î×rîlï 5îåï 5îOîâî¾vî!ï 5î"ï 5î$~rî(ï 5î(Ùï 5î.Âî0´î6Zî86vî9Žï 5î:‹ï 5î<örî@‹ï 5îA;ï 5îFÁvî)eïöZTVm$�ATOMcanappearastheTYPEexpressioninanarmofaWITH<>SELECTconstruct,andthatNILcanbeassignedtoanATOMvariableorpassedasanATOMparameter.TheCedarruntimesystemmaintainsanATOMdictionary.ThisisanamespacethatisglobaltothecurrentCedarexecution.ItisusedasauniquemapbetweenprintnamesandATOMs.ThecompilerrecognizesasanATOMconstantanyidentifierthathas$asitsfirstcharacter.ATOMsareacquiredfromtheATOMdictionaryforsuchconstantsbytheCedarruntimeloader.TheAtomsPrivateinterfaceprovidesthefollowingoperations:GetAtom:PROC[pName:Rope.ROPE]RETURNS[ATOM];GetAtomisusedtoacquiretheuniqueATOMwiththespecifiedprintname.AnewATOMwillbecreatedifnecessary.UnsafeMakeAtom:PROC[pName:LONGPOINTERTOREADONLYTEXT]RETURNS[ATOM];LikeGetAtom,butunsafe.Includedforconvenience.EnumerateAtoms:PROC[callee:PROC[ATOM]RETURNS[stop:BOOL]]RETURNS[ATOM];EnumerateAtomsmaybeusedtoenumeratetheATOMsthatareknowntotheruntimesystem.Itwillinvokethespecifiedprocedure("callee")exactlyonceforeachATOM.EnumerateAtomswillreturneitherwhenaninvocationofcalleereturnsTRUEorwhentherearenomoreATOMstoenumerate.Intheformercase,thevaluereturnedbyEnumerateAtomswillbetheATOMthatwaspassedtocallee.Inthelattercase,thevaluereturnedbyEnumerateAtomswillbeNIL.Neverfear:nomonitorlockisheldbyEnumerateAtomswhencalleeisinvoked.WhilethecallonEnumerateAtomsisactive,ATOMsthatarecreatedeitherbyexplicitcallsonMakeAtomorbyloadingaprogrammodulethatdefinesnewATOMconstantsmayormaynotbeincludedintheenumeration.AnATOMvaluecanbeLOOPHOLEdtoaREFAtomsPrivate.AtomRec,whichisdefinedasfollows:AtomRec:TYPE=RECORD[pName:Rope.Text,--theargtoGetAtompropList:REFANY_NIL,link:ATOM_NIL--usedbyGetAtom];4.ConfigurationParametersThecurrentstoragemanageruses1024-wordquanta(4pages),a22-bitaddressspace,andrequiresroughly65Kwordsofstorageforitsinternaldatastructures,whichincludethereferencecounttable,thequantummap,andvariousauxilliarytablestosupportruntimetypes.Onlyonepageofthisdataispinned.Thecodeisdesignedtoworkwithanyquantumsizethatisapowerof2between2^8and2^15,andwithanaddressspaceofanysizebetween16and28bits.ChanginganyoftheseparametersrequiresmodificationoftheruntimesystemandtheCedarmicrocode,butdoesnotrequireclientrecompilation.12vîoïb)rîïb)î›ïb)îŒîîÁvî ïb)îýïb)rî#Cïb)î#èïb)î)ûî+©î-šî0rî2+vî/ï`‚î<îØî$Ÿrîoï^Ú î¢îJvî ï^Úîï^Úrî±ï^ÚîLï^Úî .î"î'zî)vî*ûï^Úî+îï^Úrî/~ï^Úî0.ï^Úî4¦î6[î:²î2ï^Úî?%ï^ÚrîBµï^ÚîC|ï^Úîoï\_îNînî¬î /î&uvî(mï\_î)`ï\_rî-ï\_î-Ìï\_ î3Ûî6ýî8pî9¡î=gîA$îCùîElîoïZ¸îî}îGî_ î"ëî$cî%Îî) î*¸î+âî0‹î3¥î9 î@;vîBóïZ¸îCåïZ¸rîG°ïZ¸îoïX=îcî: îøî Ávî"ÍïX=î#ÀïX=rî'{ïX=î(ïX=î-î/ î5Ðî8ºî;Kî<›î>eî@[îCO vîoïV–rî•ïV–î:ïV–îÌîWî¢vî!åïV–î"ØïV–rî&[ïV–î'"ïV–î,¶î.×î1íî7Äî9¤î;çî?ãîDþîoïRsvîGïRsî:ïRs rîGïRsîªïRsî íî&|î(Ûî.í uî1ïOøîr xî$.ïOøî%ïOøuî'zïOøî(‚ïOøîPïNQ vîòïKÖrî.ïKÖî‘ïKÖî­îüî!¾î&°î)#vî-ßïKÖî.ÑïKÖrî2ƒïKÖî3�ïKÖî5±î8$î=ó îEîF¡vîòïJ/rî„ïJ/î�ïJ/î/î î"éî$J uî1ïG´îØ î*”î/,î6î8›îA.îPïF rîòïC‘î"î˜î!î%Ëî+“î-Ð uî1ïAî} î)” î3Ö î?vîPï?o vîòï<ô rî Âï<ôî!ìï<ôî$ î&Bî)Äî+¸î2Âvî5gï<ôî6Zï<ôrî9tï<ôî:Ãï<ôî=×î@pîE;îG/îòï;Mî'îöî kî#î'‹î)çî/ î6 î*î@jîCôîòï6Wvîüï6Wîãï6W rî"”ï6Wî#’ï6Wî%Nî'Lvî)ºï6Wî*­ï6Wrî.Yï6Wî.Èï6Wî16î3ðî8cî: î>[î@8îB¦îFHîòï4¯îXîî ©vî"«ï4¯î#’ï4¯ rî.;ï4¯î/9ï4¯î0ívî2äï4¯î3áï4¯rî5ï4¯qî5øï4¯î6áï4¯î9Oî;óî=–îAÐîD5îE]îGÞîòï3 î«{î ¢ï3î!&ï3qî#Åï3î$ï3î$èrîòï0�îïî3î¢vî�ï0�î uï0� rî*üï0�î+_ï0�î,Lvî0vï0�î1hï0�rî4ƒï0�î5pï0�î8#î:[î? îBÚîD»îòï.æîêvîÚï.æîï.ærî!ï.æî!Ðï.æî"Âî$¦î)yî*‹î0î4ìî7£îîöîºî¾î3î!$î&Êî(xî*Ø qîoï*ÃîKî/îî'î´î# î$dî%Rî( xî.kï*Ãqî.Ìï*Ãî4î7?î8bî