COMPILATION LISTING OF SEGMENT garbage_collect_kst Compiled by: Multics PL/I Compiler, Release 27d, of October 11, 1982 Compiled at: Honeywell LISD Phoenix, System M Compiled on: 10/28/82 1151.8 mst Thu Options: optimize list 1 /* *********************************************************** 2* * * 3* * Copyright, (C) Honeywell Information Systems Inc., 1982 * 4* * * 5* * Copyright (c) 1972 by Massachusetts Institute of * 6* * Technology and Honeywell Information Systems, Inc. * 7* * * 8* *********************************************************** */ 9 10 11 12 garbage_collect_kst: proc (a_code); 13 14 /* 15* 16* Designed and written by R. Bratt on May 31, 1976 17* 18* Last modified: 19* 11/12/76 by R. Bratt to retry parent collection 20* 21* This module is called to remove "two"'s (truly worthless objects) from a process' 22* address space. In essence this module walks the hierarchy subtree defined by this process' 23* KST from the leaves up and removes (via terminate_) all objects from the process' address 24* space which have zero usage counts in all rings and a zero inferior count. 25* 26**/ 27 28 dcl a_code fixed bin (35); 29 dcl code fixed bin (35), 30 collected fixed bin (17), 31 segno fixed bin (17); 32 dcl terminate_ entry (fixed bin (17), bit (36) aligned, bit (1) aligned, fixed bin (35)); 33 dcl error_table_$nrmkst ext fixed bin (35); 34 35 kstp = pds$kstp; 36 collected = 0; 37 do segno = kst.lowseg to kst.highest_used_segno; 38 call try_to_remove (segno); 39 end; 40 kst.garbage_collections = kst.garbage_collections + 1; 41 if collected > 0 42 then do; 43 kst.entries_collected = kst.entries_collected + collected; 44 a_code = 0; 45 end; 46 else a_code = error_table_$nrmkst; 47 return; 48 49 try_to_remove: proc (segno); 50 dcl segno fixed bin (17); 51 dcl psegno fixed bin (17); 52 dcl entryp ptr; 53 kstep = addr (kst.kst_entry (segno)); 54 if unspec (kste.usage_count) ^= "0"b | (kste.dirsw & kste.infcount ^= 0) then return; 55 if unspec (kste.entryp) = "0"b then return; /* look out for free and reserved */ 56 entryp = kste.entryp; 57 call terminate_ (segno, "0"b, "0"b, code); 58 if code = 0 59 then do; 60 collected = collected + 1; 61 if entryp ^= null () 62 then do; 63 psegno = binary (baseno (entryp)); 64 if psegno < segno then call try_to_remove (psegno); 65 end; 66 end; 67 return; 68 end try_to_remove; 69 70 /* */ 71 1 1 /* BEGIN INCLUDE FILE - - - kst.incl.pl1 - - - last modified March 1976 by R. Bratt */ 1 2 1 3 dcl pds$kstp ext ptr, 1 4 (kstp, kstep) ptr; 1 5 1 6 dcl 1 kst aligned based (kstp), /* KST header declaration */ 1 7 2 lowseg fixed bin (17), /* lowest segment number described by kst */ 1 8 2 highseg fixed bin (17), /* highest segment number described by kst */ 1 9 2 highest_used_segno fixed bin (17), /* highest segment number yet used */ 1 10 2 lvs fixed bin (8), /* number of private LVs this process is connected to */ 1 11 2 time_of_bootload fixed bin (71), /* bootload time during prelinking */ 1 12 2 garbage_collections fixed bin (17) unaligned, /* KST garbage collections */ 1 13 2 entries_collected fixed bin (17) unaligned, /* KST entries recovered by garbage collection */ 1 14 2 free_list bit (18) unaligned, /* relative pointer to first free kste */ 1 15 2 prelinked_ring (7) bit (1) unaligned, /* rings prelinked in process */ 1 16 2 template bit (1) unaligned, /* this is a template kst if set */ 1 17 2 unused_2 bit (10) unaligned, 1 18 2 uid_hash_bucket (0 : 127) bit (18) unaligned, /* hash buckets */ 1 19 2 kst_entry (0 refer (kst.lowseg):0 refer (kst.highseg)) aligned like kste, /* kst entries */ 1 20 2 lv (1:256) bit (36), /* private logical volume connection list */ 1 21 2 end_of_kst bit (36); 1 22 1 23 dcl 1 kste based (kstep) aligned, /* KST entry declaration */ 1 24 2 fp bit (18) unaligned, /* forward rel pointer */ 1 25 2 segno fixed bin (17) unaligned, /* segment number of this kste */ 1 26 2 usage_count (0:7) fixed bin (8) unaligned, /* outstanding initiates/ring */ 1 27 2 entryp ptr unaligned, /* branch pointer */ 1 28 2 uid bit (36) aligned, /* unique identifier */ 1 29 2 access_information unaligned, 1 30 3 dtbm bit (36), /* date time branch modified */ 1 31 3 extended_access bit (33), /* extended access from the branch */ 1 32 3 access bit (3), /* rew */ 1 33 3 ex_rb (3) bit (3), /* ring brackets from branch */ 1 34 2 hdr bit (3) unaligned, /* highest detectable ring */ 1 35 2 flags unaligned, 1 36 3 dirsw bit (1), /* directory switch */ 1 37 3 allow_write bit (1), /* set if initiated with write permission */ 1 38 3 priv_init bit (1), /* privileged initiation */ 1 39 3 tms bit (1), /* transparent modification switch */ 1 40 3 tus bit (1), /* transparent usage switch */ 1 41 3 tpd bit (1), /* transparent paging device switch */ 1 42 3 audit bit (1), /* audit switch */ 1 43 3 explicit_deact_ok bit (1), /* set if I am willing to have a user force deactivate */ 1 44 3 pad bit (3), 1 45 2 infcount fixed bin (12) unaligned; /* _i_f dirsw _t_h_e_n inferior count _e_l_s_e lv index */ 1 46 1 47 /* END INCLUDE FILE - - - - - - - - - - - - kst.incl.pl1 - - - - - - - - - - - - */ 72 73 74 end garbage_collect_kst; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 10/27/82 1126.6 garbage_collect_kst.pl1 >dumps>old>recomp>garbage_collect_kst.pl1 72 1 09/13/76 1100.1 kst.incl.pl1 >ldd>include>kst.incl.pl1 NAMES DECLARED IN THIS COMPILATION. IDENTIFIER OFFSET LOC STORAGE CLASS DATA TYPE ATTRIBUTES AND REFERENCES (* indicates a set context) NAMES DECLARED BY DECLARE STATEMENT. a_code parameter fixed bin(35,0) dcl 28 set ref 12 44* 46* code 000100 automatic fixed bin(35,0) dcl 29 set ref 57* 58 collected 000101 automatic fixed bin(17,0) dcl 29 set ref 36* 41 43 60* 60 dirsw 7(12) based bit(1) level 3 packed unaligned dcl 1-23 ref 54 entries_collected 6(18) based fixed bin(17,0) level 2 packed unaligned dcl 1-6 set ref 43* 43 entryp 3 based pointer level 2 in structure "kste" packed unaligned dcl 1-23 in procedure "garbage_collect_kst" ref 55 56 entryp 000102 automatic pointer dcl 52 in procedure "try_to_remove" set ref 56* 61 63 error_table_$nrmkst 000012 external static fixed bin(35,0) dcl 33 ref 46 flags 7(12) based structure level 2 packed unaligned dcl 1-23 garbage_collections 6 based fixed bin(17,0) level 2 packed unaligned dcl 1-6 set ref 40* 40 highest_used_segno 2 based fixed bin(17,0) level 2 dcl 1-6 ref 37 infcount 7(23) based fixed bin(12,0) level 2 packed unaligned dcl 1-23 ref 54 kst based structure level 1 dcl 1-6 kst_entry 110 based structure array level 2 dcl 1-6 set ref 53 kste based structure level 1 dcl 1-23 kstep 000106 automatic pointer dcl 1-3 set ref 53* 54 54 54 55 56 kstp 000104 automatic pointer dcl 1-3 set ref 35* 37 37 40 40 43 43 53 lowseg based fixed bin(17,0) level 2 dcl 1-6 ref 37 53 pds$kstp 000014 external static pointer dcl 1-3 ref 35 psegno 000100 automatic fixed bin(17,0) dcl 51 set ref 63* 64 64* segno 000102 automatic fixed bin(17,0) dcl 29 in procedure "garbage_collect_kst" set ref 37* 38* segno parameter fixed bin(17,0) dcl 50 in procedure "try_to_remove" set ref 49 53 57* 64 terminate_ 000010 constant entry external dcl 32 ref 57 usage_count 1 based fixed bin(8,0) array level 2 packed unaligned dcl 1-23 ref 54 NAMES DECLARED BY EXPLICIT CONTEXT. garbage_collect_kst 000007 constant entry external dcl 12 try_to_remove 000066 constant entry internal dcl 49 ref 38 64 NAMES DECLARED BY CONTEXT OR IMPLICATION. addr builtin function ref 53 baseno builtin function ref 63 binary builtin function ref 63 null builtin function ref 61 unspec builtin function ref 54 55 STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 256 274 174 266 Length 462 174 16 152 62 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME garbage_collect_kst 80 external procedure is an external procedure. try_to_remove 80 internal procedure calls itself recursively. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME garbage_collect_kst 000100 code garbage_collect_kst 000101 collected garbage_collect_kst 000102 segno garbage_collect_kst 000104 kstp garbage_collect_kst 000106 kstep garbage_collect_kst try_to_remove 000100 psegno try_to_remove 000102 entryp try_to_remove THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. call_ext_out call_int_this call_int_other return ext_entry int_entry THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. terminate_ THE FOLLOWING EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. error_table_$nrmkst pds$kstp CONSTANTS 000000 aa 404000000021 000001 aa 404000000043 000002 aa 077777000043 000003 aa 000001000000 BEGIN PROCEDURE garbage_collect_kst ENTRY TO garbage_collect_kst STATEMENT 1 ON LINE 12 garbage_collect_kst: proc (a_code); 000004 at 000001000001 000005 ta 000004000000 000006 da 000047300000 000007 aa 000120 6270 00 eax7 80 000010 aa 7 00034 3521 20 epp2 pr7|28,* 000011 aa 2 01045 2721 00 tsp2 pr2|549 ext_entry 000012 aa 000002000000 000013 aa 000000000000 STATEMENT 1 ON LINE 35 kstp = pds$kstp; 000014 la 4 00014 3735 20 epp7 pr4|12,* pds$kstp 000015 aa 7 00000 3735 20 epp7 pr7|0,* pds$kstp 000016 aa 6 00104 6535 00 spri7 pr6|68 kstp STATEMENT 1 ON LINE 36 collected = 0; 000017 aa 6 00101 4501 00 stz pr6|65 collected STATEMENT 1 ON LINE 37 do segno = kst.lowseg to kst.highest_used_segno; 000020 aa 6 00104 3715 20 epp5 pr6|68,* kstp 000021 aa 5 00002 2361 00 ldq pr5|2 kst.highest_used_segno 000022 aa 6 00110 7561 00 stq pr6|72 000023 aa 5 00000 2361 00 ldq pr5|0 kst.lowseg 000024 aa 6 00102 7561 00 stq pr6|66 segno 000025 aa 6 00102 2361 00 ldq pr6|66 segno 000026 aa 6 00110 1161 00 cmpq pr6|72 000027 aa 000011 6054 04 tpnz 9,ic 000040 STATEMENT 1 ON LINE 38 call try_to_remove (segno); 000030 aa 6 00102 3521 00 epp2 pr6|66 segno 000031 aa 6 00114 2521 00 spri2 pr6|76 000032 aa 6 00112 6211 00 eax1 pr6|74 000033 aa 004000 4310 07 fld 2048,dl 000034 aa 000032 3520 04 epp2 26,ic 000066 = 000120627000 000035 aa 0 00625 7001 00 tsx0 pr0|405 call_int_this STATEMENT 1 ON LINE 39 end; 000036 aa 6 00102 0541 00 aos pr6|66 segno 000037 aa 777766 7100 04 tra -10,ic 000025 STATEMENT 1 ON LINE 40 kst.garbage_collections = kst.garbage_collections + 1; 000040 aa 6 00104 3735 20 epp7 pr6|68,* kstp 000041 aa 7 00006 2351 00 lda pr7|6 kst.garbage_collections 000042 aa 000066 7330 00 lrs 54 000043 aa 000001 0760 07 adq 1,dl 000044 aa 000066 7370 00 lls 54 000045 aa 7 00006 5511 60 stba pr7|6,60 kst.garbage_collections STATEMENT 1 ON LINE 41 if collected > 0 then do; 000046 aa 6 00101 2361 00 ldq pr6|65 collected 000047 aa 000011 6044 04 tmoz 9,ic 000060 STATEMENT 1 ON LINE 43 kst.entries_collected = kst.entries_collected + collected; 000050 aa 7 00006 2351 00 lda pr7|6 kst.entries_collected 000051 aa 000022 7350 00 als 18 000052 aa 000066 7330 00 lrs 54 000053 aa 6 00101 0761 00 adq pr6|65 collected 000054 aa 7 00006 5521 14 stbq pr7|6,14 kst.entries_collected STATEMENT 1 ON LINE 44 a_code = 0; 000055 aa 6 00032 3715 20 epp5 pr6|26,* 000056 aa 5 00002 4501 20 stz pr5|2,* a_code STATEMENT 1 ON LINE 45 end; 000057 aa 000005 7100 04 tra 5,ic 000064 STATEMENT 1 ON LINE 46 else a_code = error_table_$nrmkst; 000060 aa 6 00044 3701 20 epp4 pr6|36,* 000061 la 4 00012 2361 20 ldq pr4|10,* error_table_$nrmkst 000062 aa 6 00032 3715 20 epp5 pr6|26,* 000063 aa 5 00002 7561 20 stq pr5|2,* a_code STATEMENT 1 ON LINE 47 return; 000064 aa 0 00631 7101 00 tra pr0|409 return STATEMENT 1 ON LINE 74 end garbage_collect_kst; BEGIN PROCEDURE try_to_remove ENTRY TO try_to_remove STATEMENT 1 ON LINE 49 try_to_remove: proc (segno); 000065 da 000056200000 000066 aa 000120 6270 00 eax7 80 000067 aa 7 00034 3521 20 epp2 pr7|28,* 000070 aa 2 01047 2721 00 tsp2 pr2|551 int_entry 000071 aa 000002000000 000072 aa 000000000000 STATEMENT 1 ON LINE 53 kstep = addr (kst.kst_entry (segno)); 000073 aa 6 00040 3735 20 epp7 pr6|32,* 000074 aa 7 00104 2361 20 ldq pr7|68,* kst.lowseg 000075 aa 000003 7360 00 qls 3 000076 aa 6 00104 7561 00 stq pr6|68 000077 aa 6 00032 3715 20 epp5 pr6|26,* 000100 aa 5 00002 2361 20 ldq pr5|2,* segno 000101 aa 000003 7360 00 qls 3 000102 aa 6 00104 1761 00 sbq pr6|68 000103 aa 7 00104 3535 20 epp3 pr7|68,* kstp 000104 aa 3 00110 3521 06 epp2 pr3|72,ql kst.kst_entry 000105 aa 7 00106 2521 00 spri2 pr7|70 kstep STATEMENT 1 ON LINE 54 if unspec (kste.usage_count) ^= "0"b | (kste.dirsw & kste.infcount ^= 0) then return; 000106 aa 2 00001 2351 00 lda pr2|1 000107 aa 2 00002 2361 00 ldq pr2|2 000110 aa 0 00000 1171 00 cmpaq pr0|0 = 000000000000 000000000000 000111 aa 0 00631 6011 00 tnz pr0|409 return 000112 aa 2 00007 2351 00 lda pr2|7 kste.dirsw 000113 aa 000040 3150 03 cana 32,du 000114 aa 000005 6000 04 tze 5,ic 000121 000115 aa 2 00007 2351 00 lda pr2|7 kste.infcount 000116 aa 000027 7350 00 als 23 000117 aa 000073 7330 00 lrs 59 000120 aa 0 00631 6011 00 tnz pr0|409 return STATEMENT 1 ON LINE 55 if unspec (kste.entryp) = "0"b then return; 000121 aa 2 00003 2351 00 lda pr2|3 000122 aa 0 00631 6001 00 tze pr0|409 return STATEMENT 1 ON LINE 56 entryp = kste.entryp; 000123 aa 2 00003 7611 00 lprp1 pr2|3 kste.entryp 000124 aa 6 00102 2515 00 spri1 pr6|66 entryp STATEMENT 1 ON LINE 57 call terminate_ (segno, "0"b, "0"b, code); 000125 aa 000000 2350 07 lda 0,dl 000126 aa 6 00104 7551 00 sta pr6|68 000127 aa 000000 2350 07 lda 0,dl 000130 aa 6 00105 7551 00 sta pr6|69 000131 aa 5 00002 3521 20 epp2 pr5|2,* segno 000132 aa 6 00110 2521 00 spri2 pr6|72 000133 aa 6 00104 3521 00 epp2 pr6|68 000134 aa 6 00112 2521 00 spri2 pr6|74 000135 aa 6 00105 3521 00 epp2 pr6|69 000136 aa 6 00114 2521 00 spri2 pr6|76 000137 aa 7 00100 3521 00 epp2 pr7|64 code 000140 aa 6 00116 2521 00 spri2 pr6|78 000141 aa 6 00106 6211 00 eax1 pr6|70 000142 aa 020000 4310 07 fld 8192,dl 000143 la 4 00010 3521 20 epp2 pr4|8,* terminate_ 000144 aa 0 00623 7001 00 tsx0 pr0|403 call_ext_out STATEMENT 1 ON LINE 58 if code = 0 then do; 000145 aa 6 00040 3735 20 epp7 pr6|32,* 000146 aa 7 00100 2361 00 ldq pr7|64 code 000147 aa 000024 6010 04 tnz 20,ic 000173 STATEMENT 1 ON LINE 60 collected = collected + 1; 000150 aa 7 00101 0541 00 aos pr7|65 collected STATEMENT 1 ON LINE 61 if entryp ^= null () then do; 000151 aa 6 00102 2371 00 ldaq pr6|66 entryp 000152 aa 777630 6770 04 eraq -104,ic 000002 = 077777000043 000001000000 000153 aa 0 00460 3771 00 anaq pr0|304 = 077777000077 777777077077 000154 aa 000017 6000 04 tze 15,ic 000173 STATEMENT 1 ON LINE 63 psegno = binary (baseno (entryp)); 000155 aa 6 00102 2351 00 lda pr6|66 entryp 000156 aa 077777 3750 03 ana 32767,du 000157 aa 000066 7730 00 lrl 54 000160 aa 6 00100 7561 00 stq pr6|64 psegno STATEMENT 1 ON LINE 64 if psegno < segno then call try_to_remove (psegno); 000161 aa 6 00032 3715 20 epp5 pr6|26,* 000162 aa 5 00002 1161 20 cmpq pr5|2,* segno 000163 aa 000010 6050 04 tpl 8,ic 000173 000164 aa 6 00100 3521 00 epp2 pr6|64 psegno 000165 aa 6 00110 2521 00 spri2 pr6|72 000166 aa 000001 7270 07 lxl7 1,dl 000167 aa 6 00106 6211 00 eax1 pr6|70 000170 aa 004000 4310 07 fld 2048,dl 000171 aa 777675 3520 04 epp2 -67,ic 000066 = 000120627000 000172 aa 0 00627 7001 00 tsx0 pr0|407 call_int_other STATEMENT 1 ON LINE 65 end; STATEMENT 1 ON LINE 66 end; STATEMENT 1 ON LINE 67 return; 000173 aa 0 00631 7101 00 tra pr0|409 return STATEMENT 1 ON LINE 68 end try_to_remove; END PROCEDURE try_to_remove END PROCEDURE garbage_collect_kst ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group BULL including BULL HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell BULL Inc., Groupe BULL and BULL HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, BULL or BULL HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by BULL HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved