[m-rev.] diff: bootstrap with lcc

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Jun 18 18:30:45 AEST 2003


Allow mars to bootstrap the changes to array.m when using lcc as the C
compiler.

runtime/mercury_hlc.types.h:
	Typedef MR_Array to MR_ArrayPtr while installed compilers still
	generate references to MR_Array.

deep_profiler/dense_bitset.m:
	Export the equivalence of the dense_bitset type to array. If the type
	definition remains private, then code in other modules (cliques.c)
	will use MR_Words in argument positions where dense_bitset.c expects
	MR_ArrayPtr, which lcc doesn't allow.

	For example, dense_bitset__init returns MR_ArrayPtr, and its callers
	inside dense_bitset.c depend on the return value being MR_ArrayPtr,
	but its callers from outside the module would expect the return value
	to be MR_Word.

	This problem is not specific to arrays: this issue will arise for
	any abstract type whose private definition uses a foreign type.
	Arrays just happened to be the first non-fully-builtin type
	to encounter the problem, but the problem has existed for e.g.
	strings for a long while.

	This fix is a temporary one. Ignoring the problem and recommending
	intermodule optimization as a workaround, as we have been doing,
	will do for a while, but not forever. The only two permament solutions
	I see are: (1) using the outside the type even within the module in
	function interfaces, casting to the actual type in the function body
	as necessary, and (2) having two functions with different names, one
	using the internal type and one using the generic type usable from
	outside the module, and doing the cast when the latter calls
	the former.

	In either case, Fergus seems the right person to implement the fix
	in the long term.

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
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
Index: deep_profiler/dense_bitset.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/dense_bitset.m,v
retrieving revision 1.1
diff -u -b -r1.1 dense_bitset.m
--- deep_profiler/dense_bitset.m	31 May 2001 05:59:57 -0000	1.1
+++ deep_profiler/dense_bitset.m	17 Jun 2003 09:27:58 -0000
@@ -18,7 +18,8 @@
 
 :- import_module array, int.
 
-:- type dense_bitset.
+% XXX should be abstract type; it is exported only as a workaround.
+:- type dense_bitset == array(int).
 
 :- func init = dense_bitset.
 :- mode (init = array_uo) is det.
@@ -52,8 +53,6 @@
 :- implementation.
 
 :- import_module list, require.
-
-:- type dense_bitset == array(int).
 
 init = array([0]).
 
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/error
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_hlc_types.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_hlc_types.h,v
retrieving revision 1.2
diff -u -b -r1.2 mercury_hlc_types.h
--- runtime/mercury_hlc_types.h	10 Feb 2003 17:03:57 -0000	1.2
+++ runtime/mercury_hlc_types.h	17 Jun 2003 06:53:34 -0000
@@ -82,7 +82,7 @@
   typedef MR_Word MR_Reference;
   typedef MR_Word MR_Pred;
   typedef MR_Word MR_Func;
-  typedef MR_Word MR_Array;
+  typedef MR_ArrayPtr MR_Array;
   typedef MR_Word MR_Univ;
   typedef MR_Word MR_Type_Desc;
   typedef MR_Word MR_Type_Ctor_Desc;
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