[m-rev.] diff: use 32 bit offsets into the module string tables

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Apr 9 13:51:29 AEST 2003


Use 32 bits instead of 16 to index into module string tables, since our largest
file (make_hlds.m) is now bumping into the 64K limit. (It exceeded 32K some
time ago.) This increase the size of the Mercury compiler in debugging grades
by about 4%. (It also improves speed by almost 3%, but since this is probably
due to cache effects, I wouldn't count on it.)

runtime/mercuy_stack_layout.h:
	Change the types of data structure fields that are used to index into
	the string table from MR_uint_least16_t to MR_uint_least32_t.

compiler/layout_out.m:
	Change from MR_uint_least16_t (actually MR_int_least16_t due to a bug)
	to MR_uint_least32_t where appropriate.

compiler/stack_layout.m:
	Change from MR_uint_least16_t to MR_uint_least32_t where appropriate.

Zoltan.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/layout_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/layout_out.m,v
retrieving revision 1.21
diff -u -b -r1.21 layout_out.m
--- compiler/layout_out.m	21 Mar 2003 05:52:06 -0000	1.21
+++ compiler/layout_out.m	31 Mar 2003 11:04:38 -0000
@@ -321,7 +321,7 @@
 output_layout_name_storage_type_name(proc_layout_var_names(ProcLabel),
 		_BeingDefined) -->
 	io__write_string("static const "),
-	io__write_string("MR_int_least16_t "),
+	io__write_string("MR_uint_least32_t "),
 	output_layout_name(proc_layout_var_names(ProcLabel)),
 	io__write_string("[]").
 output_layout_name_storage_type_name(closure_proc_id(CallerProcLabel, SeqNo,
Index: compiler/stack_layout.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/stack_layout.m,v
retrieving revision 1.77
diff -u -b -r1.77 stack_layout.m
--- compiler/stack_layout.m	16 Mar 2003 08:01:30 -0000	1.77
+++ compiler/stack_layout.m	8 Apr 2003 04:07:51 -0000
@@ -998,7 +998,7 @@
 		stack_layout__get_next_cell_number(CNum2),
 		{ NumVector = create(0, VarNumRvals,
 			uniform(yes(uint_least16)), must_be_static,
-			CNum2, "stack_layout_num_name_vector", Reuse) }
+			CNum2, "stack_layout_var_num_vector", Reuse) }
 	;
 		{ NumVector = const(int_const(0)) }
 	).
@@ -1731,8 +1731,18 @@
 		{ Offset = OldOffset }
 	;
 		{ string__length(String, Length) },
-		{ TableOffset is TableOffset0 + Length + 1 },
-		{ TableOffset < (1 << (2 * stack_layout__byte_bits)) }
+		{ TableOffset = TableOffset0 + Length + 1 },
+		% We use a 32 bit unsigned integer to represent the offset.
+		% Computing that limit exactly without getting an overflow
+		% or using unportable code isn't trivial. The code below
+		% is overly conservative, requiring the offset to be
+		% representable in only 30 bits. The over-conservatism
+		% should not be an issue; the machine will run out of
+		% virtual memory before the test below fails, for the
+		% next several years anyway. (Compiling a module that has
+		% a 1 Gb string table will require several tens of Gb
+		% of other compiler structures.)
+		{ TableOffset < (1 << ((4 * stack_layout__byte_bits) - 2)) }
 	->
 		{ Offset = TableOffset0 },
 		{ map__det_insert(TableMap0, String, TableOffset0,
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_stack_layout.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_stack_layout.h,v
retrieving revision 1.69
diff -u -b -r1.69 mercury_stack_layout.h
--- runtime/mercury_stack_layout.h	4 Apr 2003 07:01:39 -0000	1.69
+++ runtime/mercury_stack_layout.h	7 Apr 2003 09:05:23 -0000
@@ -337,7 +337,7 @@
 	const MR_Proc_Layout		*MR_sll_entry;
 	MR_int_least8_t			MR_sll_port;
 	MR_int_least8_t			MR_sll_hidden;
-	MR_uint_least16_t		MR_sll_goal_path;
+	MR_uint_least32_t		MR_sll_goal_path;
 	MR_Integer			MR_sll_var_count; /* >= 0 */
 	const void			*MR_sll_locns_types;
 	const MR_uint_least16_t		*MR_sll_var_nums;
@@ -348,7 +348,7 @@
 	const MR_Proc_Layout		*MR_sll_entry;
 	MR_int_least8_t			MR_sll_port;
 	MR_int_least8_t			MR_sll_hidden;
-	MR_uint_least16_t		MR_sll_goal_path;
+	MR_uint_least32_t		MR_sll_goal_path;
 	MR_Integer			MR_sll_var_count; /* < 0 */
 } MR_Label_Layout_No_Var_Info;
 
@@ -605,13 +605,7 @@
 ** into the string table, with the offset at index i-1 giving the name of
 ** variable i (since variable numbers start at one). If a variable has no name
 ** or cannot be referred to from an event, the offset will be zero, at which
-** offset the string table will contain an empty string. The string table
-** is restricted to be small enough to be addressed with 16 bits;
-** a string is reserved near the start for a string that says "too many
-** variables". Stack_layout.m will generate a reference to this string
-** instead of generating an offset that does not fit into 16 bits.
-** Therefore using the stored offset to index into the string table
-** is always safe.
+** offset the string table will contain an empty string.
 **
 ** The max_named_var_num field gives the number of elements in the
 ** used_var_names table, which is also the number of the highest numbered
@@ -682,7 +676,7 @@
 	MR_TrieNode		MR_exec_tabling_pointer;
 	MR_Table_Info		MR_exec_table_info;
 	const MR_uint_least16_t	*MR_exec_head_var_nums;
-	const MR_uint_least16_t	*MR_exec_used_var_names;
+	const MR_uint_least32_t	*MR_exec_used_var_names;
 	MR_uint_least16_t	MR_exec_num_head_vars;
 	MR_uint_least16_t	MR_exec_max_named_var_num;
 	MR_uint_least16_t	MR_exec_max_r_num;
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list