[m-rev.] for review: fix problems with --split-c-files

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Aug 8 13:28:19 AEST 2002


For review by Simon or Fergus.

Zoltan.

Fix a bug that caused duplicate symbol definitions with --split-c-files.

compiler/ll_pseudo_type_info.m:
	Represent type_ctor_infos directly; do not misrepresent them as arity
	zero pseudo_type_infos, even if they do have the same memory layout.

compiler/llds_out.m:
	Allow the caller to ask for static declarations even with
	--split-c-files.

compiler/rtti_out.m:
	Ask llds_out.m to generate static declarations even with
	--split-c-files. The data structures affected by this are typeinfos
	and pseudotypeinfos. With --split-c-files, we now generate a copy
	of a typeinfo or a pseudotypeinfo in each C file that refers to that
	typeinfo or pseudotypeinfo, rather than one per Mercury module.
	This will increase the size of the split archive, but only minimally.

cvs diff: Diffing .
cvs diff: Diffing bench
cvs diff: Diffing bench/progs
cvs diff: Diffing bench/progs/compress
cvs diff: Diffing bench/progs/icfp2000
cvs diff: Diffing bench/progs/icfp2001
cvs diff: Diffing bench/progs/nuc
cvs diff: Diffing bench/progs/ray
cvs diff: Diffing bench/progs/tree234
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/ll_pseudo_type_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ll_pseudo_type_info.m,v
retrieving revision 1.5
diff -u -b -r1.5 ll_pseudo_type_info.m
--- compiler/ll_pseudo_type_info.m	2002/04/12 01:24:07	1.5
+++ compiler/ll_pseudo_type_info.m	2002/08/07 00:36:02
@@ -128,9 +128,7 @@
 
 convert_compound_pseudo_type_info(RttiTypeCtor, ArgRvals0, Args,
 		Rval, LldsType, C0, C) :-
-	TypeCtorInfoData = pseudo_type_info(
-		plain_arity_zero_pseudo_type_info(RttiTypeCtor)),
-	TypeCtorInfoDataAddr = rtti_addr(RttiTypeCtor, TypeCtorInfoData),
+	TypeCtorInfoDataAddr = rtti_addr(RttiTypeCtor, type_ctor_info),
 	TypeCtorInfoRval = yes(const(data_addr_const(TypeCtorInfoDataAddr))),
 	LldsType = data_ptr,
 	counter__allocate(CNum, C0, C1),
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.197
diff -u -b -r1.197 llds_out.m
--- compiler/llds_out.m	2002/08/07 02:05:22	1.197
+++ compiler/llds_out.m	2002/08/08 02:58:26
@@ -102,11 +102,12 @@
 	% or static after initialization should have this prefix.
 :- func mercury_data_prefix = string.
 
-	% Given the default linkage of a data item, and a bool saying whether
-	% it is being defined, return a C string that gives its storage class.
+	% c_data_linkage_string(Globals, DefaultLinkage, StaticEvenIfSplit,
+	%	BeingDefined):
+	% Return a C string that gives the storage class appropriate for the
+	% definition of a global variable with the specified properties.
 
-:- pred c_data_linkage_string(globals::in, linkage::in, bool::in, string::out)
-	is det.
+:- func c_data_linkage_string(globals, linkage, bool, bool) = string.
 
 	% Given a boolean that states whether a data item includes code
 	% addresses or not, return a C string that gives its "const-ness".
@@ -3071,11 +3072,12 @@
 	output_data_addrs_decls(DataAddrs, FirstIndent, LaterIndent, N1, N,
 		DeclSet1, DeclSet).
 
-c_data_linkage_string(Globals, DefaultLinkage, BeingDefined, LinkageStr) :-
+c_data_linkage_string(Globals, DefaultLinkage, StaticEvenIfSplit, BeingDefined)
+		= LinkageStr :-
 	globals__lookup_bool_option(Globals, split_c_files, SplitFiles),
 	(
 		( DefaultLinkage = extern
-		; SplitFiles = yes
+		; SplitFiles = yes, StaticEvenIfSplit = no
 		)
 	->
 		(
@@ -3123,8 +3125,8 @@
 	;
 		{ data_name_linkage(DataVarName, Linkage) },
 		globals__io_get_globals(Globals),
-		{ c_data_linkage_string(Globals, Linkage, BeingDefined,
-			LinkageStr) },
+		{ LinkageStr = c_data_linkage_string(Globals, Linkage,
+			no, BeingDefined) },
 		io__write_string(LinkageStr),
 
 		{ InclCodeAddr =
Index: compiler/rtti_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti_out.m,v
retrieving revision 1.30
diff -u -b -r1.30 rtti_out.m
--- compiler/rtti_out.m	2002/08/01 11:52:21	1.30
+++ compiler/rtti_out.m	2002/08/07 08:36:09
@@ -984,7 +984,8 @@
 	output_rtti_type_decl(RttiName),
 	{ rtti_name_linkage(RttiName, Linkage) },
 	globals__io_get_globals(Globals),
-	{ c_data_linkage_string(Globals, Linkage, BeingDefined, LinkageStr) },
+	{ LinkageStr = c_data_linkage_string(Globals, Linkage, yes,
+		BeingDefined) },
 	io__write_string(LinkageStr),
 
 	{ InclCodeAddr = rtti_name_would_include_code_addr(RttiName) },
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/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
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/structure_reuse
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/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