COMPILATION LISTING OF SEGMENT get_map_index Compiled by: Multics PL/I Compiler, Release 28d, of October 4, 1983 Compiled at: Honeywell LCPD Phoenix, System M Compiled on: 11/02/83 1309.0 mst Wed Options: optimize map 1 /* ****************************************************** 2* * * 3* * * 4* * Copyright (c) 1972 by Massachusetts Institute of * 5* * Technology and Honeywell Information Systems, Inc. * 6* * * 7* * * 8* ****************************************************** */ 9 10 get_map_index: proc (P_header, P_location, R_index, R_ptr); 11 12 /* given a pointer to the symbol header of a standard object segment, and an offset from the base of the seg 13* finds the map entry for the source statement that generated the code, then returns the index and addr of the entry 14* 15* Created: 23 Feb 79 James R. Davis 16**/ 17 18 dcl P_header ptr parameter; 19 dcl P_location fixed bin (18) unsigned parameter; 20 dcl R_index fixed bin parameter; /* Output - index of entry in statement map array */ 21 dcl R_ptr ptr parameter; /* Output - ptr to the entry */ 22 23 dcl location fixed bin (18) unsigned; /* copy of P_location */ 24 dcl highest fixed bin (35); /* highest location in object seg */ 25 dcl lowest fixed bin (35); /* lowest address in object seg */ 26 dcl number_entries fixed bin; /* number of entries in stmnt map */ 27 dcl map_ptr ptr; /* to statement map for seg */ 28 dcl map_end_ptr ptr; /* to last entry in map */ 29 dcl map_size fixed bin; /* size of an entry in the map */ 30 31 dcl 1 map_array (number_entries) aligned based (map_ptr) like statement_map; 32 33 dcl stu_$get_statement_map entry (ptr, ptr, ptr, fixed bin); 34 dcl (addr, bin, divide, fixed, null, rel) builtin; 35 36 R_index = -1; 37 R_ptr = null; /* assume the worst */ 38 call stu_$get_statement_map (P_header, map_ptr, map_end_ptr, map_size); 39 if (map_ptr = null) | (map_end_ptr = null) then return; /* no mpa for seg */ 40 number_entries = divide (bin (rel (map_end_ptr)) - bin (rel (map_ptr)), map_size, 17, 0); 41 location = P_location; 42 lowest = fixed (map_array (1).location, 18); 43 highest = fixed (map_array (number_entries).location, 18); 44 if location < lowest | location > highest then return; /* canty be in text */ 45 46 R_index = search_stmnt_map (); 47 R_ptr = addr (map_array (R_index)); 48 return; 49 50 search_stmnt_map: proc () returns (fixed bin); 51 52 /* does a binary search through statement map for a statement entry whose range of locations 53* includes the location we want. We know the statement map is in order of object seg location. 54* Lets hope there are no gaps in the generated code itself! 55**/ 56 57 dcl guess fixed bin; 58 dcl low fixed bin; 59 dcl high fixed bin; 60 dcl first_loc_this_stmnt fixed bin (35); 61 dcl first_loc_next_stmnt fixed bin (35); 62 63 low = 1; 64 high = number_entries; 65 guess = divide (high + low, 2, 17, 0); /* start in the middle */ 66 67 do while ("1"b); 68 first_loc_this_stmnt = fixed (map_array (guess).location, 18); 69 first_loc_next_stmnt = fixed (map_array (guess + 1).location, 18); 70 if first_loc_this_stmnt <= location & location < first_loc_next_stmnt 71 then return (guess); 72 73 if (high - low = 1) /* special case to avoid infinite loop */ 74 then if guess = high /* switch the guess */ 75 then guess = low; 76 else guess = high; 77 else do; /* refine the limits and make better guess */ 78 if first_loc_this_stmnt > location /* we were too high */ 79 then high = guess; 80 else low = guess; 81 guess = divide (high + low, 2, 17, 0); 82 end; 83 end; 84 end search_stmnt_map; 85 1 1 dcl 1 statement_map aligned based, 1 2 2 location bit(18) unaligned, 1 3 2 source_id unaligned, 1 4 3 file bit(8), 1 5 3 line bit(14), 1 6 3 statement bit(5), 1 7 2 source_info unaligned, 1 8 3 start bit(18), 1 9 3 length bit(9); 86 87 88 end get_map_index; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 11/02/83 1237.0 get_map_index.pl1 >spec>on>pascal>get_map_index.pl1 86 1 05/06/74 1751.6 statement_map.incl.pl1 >ldd>include>statement_map.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. P_header parameter pointer dcl 18 set ref 10 38* P_location parameter fixed bin(18,0) unsigned dcl 19 ref 10 41 R_index parameter fixed bin(17,0) dcl 20 set ref 10 36* 46* 47 R_ptr parameter pointer dcl 21 set ref 10 37* 47* addr builtin function dcl 34 ref 47 bin builtin function dcl 34 ref 40 40 divide builtin function dcl 34 ref 40 65 81 first_loc_next_stmnt 000124 automatic fixed bin(35,0) dcl 61 set ref 69* 70 first_loc_this_stmnt 000123 automatic fixed bin(35,0) dcl 60 set ref 68* 70 78 fixed builtin function dcl 34 ref 42 43 68 69 guess 000120 automatic fixed bin(17,0) dcl 57 set ref 65* 68 69 70 73 73* 76* 78 80 81* high 000122 automatic fixed bin(17,0) dcl 59 set ref 64* 65 73 73 76 78* 81 highest 000101 automatic fixed bin(35,0) dcl 24 set ref 43* 44 location 000100 automatic fixed bin(18,0) unsigned dcl 23 in procedure "get_map_index" set ref 41* 44 44 70 70 78 location based bit(18) array level 2 in structure "map_array" packed unaligned dcl 31 in procedure "get_map_index" set ref 42 43 68 69 low 000121 automatic fixed bin(17,0) dcl 58 set ref 63* 65 73 73 80* 81 lowest 000102 automatic fixed bin(35,0) dcl 25 set ref 42* 44 map_array based structure array level 1 dcl 31 set ref 47 map_end_ptr 000106 automatic pointer dcl 28 set ref 38* 39 40 map_ptr 000104 automatic pointer dcl 27 set ref 38* 39 40 42 43 47 68 69 map_size 000110 automatic fixed bin(17,0) dcl 29 set ref 38* 40 null builtin function dcl 34 ref 37 39 39 number_entries 000103 automatic fixed bin(17,0) dcl 26 set ref 40* 43 64 rel builtin function dcl 34 ref 40 40 statement_map based structure level 1 dcl 1-1 stu_$get_statement_map 000010 constant entry external dcl 33 ref 38 NAMES DECLARED BY EXPLICIT CONTEXT. get_map_index 000021 constant entry external dcl 10 search_stmnt_map 000127 constant entry internal dcl 50 ref 46 THERE WERE NO NAMES DECLARED BY CONTEXT OR IMPLICATION. STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 262 274 222 272 Length 454 222 12 143 37 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME get_map_index 99 external procedure is an external procedure. search_stmnt_map internal procedure shares stack frame of external procedure get_map_index. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME get_map_index 000100 location get_map_index 000101 highest get_map_index 000102 lowest get_map_index 000103 number_entries get_map_index 000104 map_ptr get_map_index 000106 map_end_ptr get_map_index 000110 map_size get_map_index 000120 guess search_stmnt_map 000121 low search_stmnt_map 000122 high search_stmnt_map 000123 first_loc_this_stmnt search_stmnt_map 000124 first_loc_next_stmnt search_stmnt_map THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. call_ext_out return signal ext_entry divide_fx3 THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. stu_$get_statement_map NO EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 10 000014 36 000026 37 000031 38 000033 39 000047 40 000057 41 000071 42 000074 43 000077 44 000105 46 000112 47 000120 48 000126 50 000127 63 000131 64 000133 65 000135 68 000140 69 000147 70 000152 73 000164 76 000176 78 000201 80 000207 81 000211 83 000215 84 000216 ----------------------------------------------------------- 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