Commit Graph

8493 Commits

Author SHA1 Message Date
Fergus Henderson
eda6dba133 Address juliensf's review comments on my recent change to add an MLDS
Estimated hours taken: 0.25

Address juliensf's review comments on my recent change to add an MLDS
optimization to convert assignments into initializers.

compiler/ml_optimize.m:
doc/user_guide.texi:
	Fix some typos.

compiler/options.m:
	Wrap some long lines.
2001-02-12 04:39:58 +00:00
Fergus Henderson
90106ca1da Avoid the use of `long double', because this causes problems
Estimated hours taken: 1

library/string.m:
	Avoid the use of `long double', because this causes problems
	with lcc on Linux, since lcc does not use the same
	representation for `long double' as gcc and glibc.
	(lcc treats `long double' as 8 bytes, the same as `double',
	whereas `gcc' has a 12-byte `long double'.)
	The code here was using `long double' just in case `MR_Float'
	was `long double', but currently `MR_Float' is only ever
	`double' or `float', not `long double', so that isn't needed.

	This is a bug in lcc on Linux (lcc is not a conforming hosted
	C implementation), but we may as well work around it.
2001-02-12 04:31:07 +00:00
Fergus Henderson
78e6e30ce3 Fix a long-standing problem which caused occaisional failures
Estimated hours taken: 2

Fix a long-standing problem which caused occaisional failures
when running the nightly tests on hydra, due to problems with
dyn_load.o / gc.a caused by the use of parallel make (-j2)
on hydra.

boehm_gc/Makefile:
	Document that this Makefile is not safe for parallel makes
	(and why).

boehm_gc/Mmakefile:
	Pass `-j1' to make, so that we don't use parallel make.
2001-02-12 04:28:12 +00:00
Fergus Henderson
3360d1cb59 Fix some more bugs in the handling of `DEFAULT_GRADE' and the
Estimated hours taken: 0.5

scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
	Fix some more bugs in the handling of `DEFAULT_GRADE' and the
	`-s<grade>' option.  Obviously this code had never been exercised.
2001-02-11 14:53:41 +00:00
Fergus Henderson
e09f36c7dd Fix another cut-and-paste error: change the second "case 0)" to
Estimated hours taken: 0.25

scripts/parse_grade_options.sh-subr:
	Fix another cut-and-paste error: change the second "case 0)" to
	"case *)".
2001-02-11 14:20:44 +00:00
Fergus Henderson
47846f2160 Reorder some code to encourage better GC behaviour: move a
Estimated hours taken: 0.25

compiler/mercury_compile.m:
	Reorder some code to encourage better GC behaviour: move a
	reference to `Module' (the parse tree) so that it doesn't
	remain live after we have built the HLDS.
2001-02-11 13:13:11 +00:00
Fergus Henderson
e74fb9ca42 Fix a cut-and-paste error: change the second "case 0)" to "case *)".
Estimated hours taken: 0.25

scripts/init_grade_options.sh-subr:
	Fix a cut-and-paste error: change the second "case 0)" to "case *)".
	This broke the default grade setting.
2001-02-11 12:47:40 +00:00
Simon Taylor
80eb4c2d84 Change the copyright notices so that these files
Estimated hours taken: 0.1

library/enum.m:
library/sparse_bitset.m:
	Change the copyright notices so that these files
	are LGPL'd rather than GPL'd.
2001-02-11 11:45:13 +00:00
Fergus Henderson
e126281e87 Turn off ERROR_UNDEFINED for .gc.par grades, since
Estimated hours taken: 0.5

Mmake.common.in:
	Turn off ERROR_UNDEFINED for .gc.par grades, since
	(a) currently we get link errors when building the Mercury
	shared libraries in those grades, because the thread-safe
	version of the Boehm GC needs to be linked with some
	fairly system-specific libraries
	(b) it's easier and safer to just turn it off here than to
	try to explicitly link with all the necessary libraries
	in that case.
2001-02-11 04:58:26 +00:00
Fergus Henderson
787b241fc6 Fix a bug: s/allow_undefined/allow_undef/,
Estimated hours taken: 0.25

scripts/ml.in:
	Fix a bug: s/allow_undefined/allow_undef/,
	to match the variable name used elsewhere in this script.
2001-02-11 04:42:45 +00:00
Fergus Henderson
b595055dd5 Fix a problem with the install on roy, where it was not
Estimated hours taken: 0.5

tools/test_mercury:
	Fix a problem with the install on roy, where it was not
	installing asm_fast.gc and not setting DEFAULT_GRADE.

	Fixing a couple of bugs in the `rm' commands.  Also add back
	all the `rm' commands that I had previously commented out for
	safety.
2001-02-10 13:32:30 +00:00
Fergus Henderson
8c6ec7d6e7 Change the units for the size field in MLDS new_object
Estimated hours taken: 1

Change the units for the size field in MLDS new_object
statements from bytes to words.

compiler/mlds.m:
	Update the documentation for the size field.

compiler/ml_unify_gen.m:
	Generate the sizes in words rather than bytes.
	Delete the ml_sizeof_word_lval function, since it's
	no longer used.

compiler/mlds_to_c.m:
	Multiply the size passed to MR_new_object() by
	`sizeof(MR_Word)' to convert from words to bytes.

compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
	Simplify the code by deleting hacks needed to
	convert the size from bytes to words.

runtime/mercury.h:
	Document that the definition of SIZEOF_WORD should
	not be needed any longer, except for bootstraping.
2001-02-10 11:21:35 +00:00
Fergus Henderson
8dd91e0936 Back out stayl's recent change, since it broke the compiler.
Estimated hours taken: 0.25

compiler/mercury_compile.m:
	Back out stayl's recent change, since it broke the compiler.
	(In particular `mmake install' was dying.)
2001-02-10 09:23:47 +00:00
Ralph Becket
9693b9fdbd Added a new module, hash_table.m, implementing an efficient open
Estimated hours taken: 10

Added a new module, hash_table.m, implementing an efficient open
hash table ADT.

library/hash_table.m:
	Added.

library/library.m:
	Added reference to the new library module.

compiler/modules.m:
	Added reference to the new library module.

NEWS:
	Mentioned the new addition in the NEWS file.
2001-02-09 14:03:58 +00:00
Mark Brown
61727c021e Specify the full pathname when source'ing Mmake.thisdir, since
Estimated hours taken: 0.5

samples/tests/*/runtests:
	Specify the full pathname when source'ing Mmake.thisdir, since
	the current directory is not always searched.
2001-02-09 06:46:42 +00:00
Simon Taylor
e3c5c1e085 Fix bugs in :- pragma import' and :- pragma export' with
Estimated hours taken: 3

Fix bugs in `:- pragma import' and `:- pragma export' with
inter-module optimizaton reported by Peter Ross (bug #131069).

compiler/mercury_to_mercury.m:
	The code to output `:- pragma import' declarations was
	writing `:- pragma import(p(Arg1::in, Arg2::out), "imported")'.
	The correct output is `:- pragma import(p(in, out), "imported")'.

compiler/mercury_compile.m:
	For modules containing `:- pragma export' declarations, add
	":- pragma c_header_code("#include ModuleName.h")." to
	the `.opt' file so the C compiler can find the function
	prototypes for Mercury predicates exported to C when
	compiling the C code in the `.opt' file.

	Write the `.h' file for a module when writing the `.opt' file
	when using the LLDS backend to avoid trying to use the `.h' file
	before it has been created.

tests/valid/Mmakefile:
tests/valid/intermod_pragma_import.m:
tests/valid/intermod_pragma_import2.m:
	Test case.
2001-02-09 03:27:36 +00:00
Ralph Becket
6f3991bf05 Index: bitmap.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/bitmap.m,v
retrieving revision 1.1
diff -u -r1.1 bitmap.m
--- bitmap.m	2001/02/07 17:31:03	1.1
+++ bitmap.m	2001/02/08 17:15:29
@@ -98,7 +98,15 @@
     %
 :- func get(bitmap, int) = bool.
 :- mode get(bitmap_ui, in) = out is det.
+:- mode get(in, in) = out is det.
 
+    % Unsafe versions of the above: if the index is out of range
+    % then behaviour is undefined and bad things are likely to happen.
+    %
+:- func unsafe_get(bitmap, int) = bool.
+:- mode unsafe_get(bitmap_ui, in) = out is det.
+:- mode unsafe_get(in, in) = out is det.
+
     % Create a new copy of a bitmap.
     %
 :- func copy(bitmap) = bitmap.
@@ -269,6 +277,10 @@
 % ---------------------------------------------------------------------------- %
 
 get(BM, I) = ( if is_clear(BM, I) then no else yes ).
+
+%------------------------------------------------------------------------------%
+
+unsafe_get(BM, I) = ( if unsafe_is_clear(BM, I) then no else yes ).
 
 % ---------------------------------------------------------------------------- %
2001-02-08 17:24:37 +00:00
Ralph Becket
75fd5600e0 Added sorting, fold and permutation functions/predicates to array.m.
Estimated hours taken: 4

Added sorting, fold and permutation functions/predicates to array.m.

library/array.m:
	Added funcs sort/1, foldl/3, foldr/3.
	Added pred permutation/4.

NEWS:
	Recorded above in changes to library section.
2001-02-08 17:23:19 +00:00
Fergus Henderson
372645cc69 For Linux, when using `--no-undefined', test to see whether
Estimated hours taken: 0.5

configure.in:
	For Linux, when using `--no-undefined', test to see whether
	the linker supports it.  This is needed because it turns out
	that this option is a quite recent addition to GNU ld.
2001-02-08 16:48:31 +00:00
Fergus Henderson
ac1a0fb6e8 For sparc-sun-solaris2.*, use `gcc -shared -mimpure-text'
Estimated hours taken: 0.5

configure.in:
	For sparc-sun-solaris2.*, use `gcc -shared -mimpure-text'
	rather than `gcc -G', since the latter doesn't work with
	ERROR_UNDEFINED (`-Wl,-z,defs').
2001-02-08 16:10:45 +00:00
Fergus Henderson
15aff10428 Add a new test case. This one tests the use of cyclic
Estimated hours taken: 0.25

tests/invalid/cyclic_typeclass.m:
	Add a new test case.  This one tests the use of cyclic
	inheritence relationships between type classes.

tests/invalid/Mmakefile:
	Document that we do not yet pass the new test.
2001-02-08 12:57:40 +00:00
Fergus Henderson
0e8f55be3e Add an MLDS optimization to convert assignments into
Estimated hours taken: 1.5

Add an MLDS optimization to convert assignments into
initializers.

compiler/options.m:
doc/user_guide.texi:
	Add new option `--optimize-initializations'.

compiler/ml_optimize.m:
	Implement the new optimization.

compiler/ml_elim_nested.m:
compiler/ml_util.m:
	Move initializer_contains_var, rval_contains_var and related
	predicates from ml_elim_nested.m to ml_util.m, for use by
	ml_optimize.m.
2001-02-08 12:54:12 +00:00
Fergus Henderson
90ad99ebc3 Mention that using copy/2 won't necessarily solve the problems
Estimated hours taken: 0.1
	Mention that using copy/2 won't necessarily solve the problems
	with dl__close.
2001-02-08 12:51:22 +00:00
Fergus Henderson
0c6f6404ec Allow -n-' as a synonym for --no-line-numbers'.
Estimated hours taken: 0.25

compiler/options.m:
doc/user_guide.texi:
	Allow `-n-' as a synonym for `--no-line-numbers'.
2001-02-08 12:40:52 +00:00
Fergus Henderson
a11476790a Fix a bug: the hard-coded setting of the number of registers
Estimated hours taken: 0.25

configure.in:
	Fix a bug: the hard-coded setting of the number of registers
	available for the Alpha was wrong.
2001-02-08 12:37:54 +00:00
Fergus Henderson
9f03abee9a Add missing `import_module' statements in the interface section.
Estimated hours taken: 2

compiler/globals.m:
compiler/mode_errors.m:
compiler/mode_info.m:
compiler/transform_llds.m:
compiler/vn_order.m:
compiler/vn_verify.m:
samples/diff/globals.m:
	Add missing `import_module' statements in the interface section.
	(The current version of the compiler doesn't detect these errors.
	I have a fix for that bug, but I plan to commit it separately.)
2001-02-08 11:37:53 +00:00
Ralph Becket
62c030d488 Added dynamic_cast/2 supporting dynamic (semidet) run-time
Estimated hours taken: 0.1

library/std_util.m:
	Added dynamic_cast/2 supporting dynamic (semidet) run-time
	type casting for ground types.

NEWS:
	Mentioned the above change.
2001-02-08 11:01:14 +00:00
Ralph Becket
7a07bf3d54 Added dynamic_cast/2 supporting dynamic (semidet) run-time
Estimated hours taken: 0.1

library/std_util.m:
	Added dynamic_cast/2 supporting dynamic (semidet) run-time
	type casting for ground types.

NEWS:
	Mentioned the above change.
2001-02-08 10:47:58 +00:00
Ralph Becket
3350cb6741 An efficient, resizable bitmap implementation.
Estimated hours taken: 4

An efficient, resizable bitmap implementation.

library/bitmap.m:
	Added.

library/library.m:
	Added bitmap to import list.

compiler/modules.m:
	Added mercury_std_library_module/1 entry for bitmap.

NEWS:
	Recorded bitmap.m as a new library module.
2001-02-07 17:55:38 +00:00
Ralph Becket
e46b6f140f An efficient, resizable bitmap implementation.
Estimated hours taken: 4

An efficient, resizable bitmap implementation.

library/bitmap.m:
	Added.

library/library.m:
	Added bitmap to import list.

compiler/modules.m:
	Added mercury_std_library_module/1 entry for bitmap.

NEWS:
	Recorded bitmap.m as a new library module.
2001-02-07 17:41:08 +00:00
Ralph Becket
95b430aa5b An efficient, resizable bitmap implementation.
Estimated hours taken: 4

An efficient, resizable bitmap implementation.

library/bitmap.m:
	Added.

library/library.m:
	Added bitmap to import list.

compiler/modules.m:
	Added mercury_std_library_module/1 entry for bitmap.

NEWS:
	Recorded bitmap.m as a new library module.
2001-02-07 17:31:27 +00:00
Peter Ross
c163e5bda9 Back out the change to add dynamic_cast (rev 1.222), as this change
Estimated hours taken: 1

library/std_util.m:
    Back out the change to add dynamic_cast (rev 1.222), as this change
    deleted all the changes to make univ a user defined type and
    possibly some other changes.
2001-02-07 16:10:30 +00:00
Fergus Henderson
e912dbc0be On platforms which support it, check that there are no undefined
Estimated hours taken: 2

On platforms which support it, check that there are no undefined
symbols when linking the Mercury shared libraries.
Some platforms (AIX, Windows, and BeOS) require this when building
shared libraries.  This change means that we check it on our usual
platforms, including Linux.

configure.in:
	Set ERROR_UNDEFINED to `-Wl,--no-undefined' on x86 Linux.
	Using --no-undefined on Linux requires linking in ld-linux.so,
	so add some code to figure out the right version of that to
	link with.

Mmake.common.in:
	Set ALLOW_UNDEFINED and ERROR_UNDEFINED to the values
	determined by configure.in.  Also pass down the values of
	SOCKET_LIBRARY, NSL_LIBRARY, and DL_LIBRARY, since we need
	to link with those libraries to resolve all the undefined
	symbols.

runtime/Mmakefile:
library/Mmakefile:
browser/Mmakefile:
trace/Mmakefile:
	Pass $(ERROR_UNDEFINED) to $(LINK_SHARED_OBJ).

browser/Mmakefile:
trace/Mmakefile:
	Link in SOCKET_LIBRARY, NSL_LIBRARY, and DL_LIBRARY.
2001-02-07 14:37:39 +00:00
Fergus Henderson
fd3a109414 Move Ralph's documentation for his change on the main branch
Estimated hours taken: 0.1

NEWS:
	Move Ralph's documentation for his change on the main branch
	into the proper section for changes that are only on the main
	branch.
2001-02-07 14:36:39 +00:00
Fergus Henderson
6cb0b9f9a3 Add a test case that uses class', int', and `char' as module names.
Estimated hours taken: 0.25

tests/hard_coded/sub-modules/Mmakefile:
tests/hard_coded/sub-modules/class.m:
tests/hard_coded/sub-modules/class.exp:
	Add a test case that uses `class', `int', and `char' as module names.
	This test case is testing that module names which have the
	same syntax as keywords in the target language get properly
	mangled/escaped.
2001-02-07 13:50:52 +00:00
Peter Ross
aebad9e884 Add the .reuse_trunk_sync_tag on the *main* branch.
Estimated hours taken: 0.01

.nocopyright:
    Add the .reuse_trunk_sync_tag on the *main* branch.
2001-02-07 12:06:30 +00:00
Fergus Henderson
062f32b061 Support testing with lcc.
Estimated hours taken: 0.5

Support testing with lcc.

tools/run_all_test_from_cron:
	Add an optional second argument, namely the C compiler to test with.
	This defaults to `gcc'.  Pass this on to tools/test_mercury.

	Also preserve the last three copies of the log files,
	rather than just the last two.  This is useful when
	running different tests at different times.

tools/test_mercury:
	Add a fourth argument, namely the C compiler to test with.
	Set CC to this argument before running configure.
	Include this argument in various components, e.g. the
	name of the install directory, and the successful_tests
	log file, etc.
	Set things up for testing with lcc on venus.
2001-02-07 08:20:56 +00:00
Ralph Becket
85c2ad1f48 Added dynamic_cast/2 supporting dynamic (semidet) run-time
Estimated hours taken: 0.1

library/std_util.m:
	Added dynamic_cast/2 supporting dynamic (semidet) run-time
	type casting for ground types.

NEWS:
	Mentioned the above change.
2001-02-06 17:28:58 +00:00
Peter Ross
10781e098d Adapt the tests in the general directory so that the version of the
Estimated hours taken: 0.25

Adapt the tests in the general directory so that the version of the
Mercury compiler built with MSVC passes them in the hlc.gc grade.

float_test.exp2:
string_format_test.exp3:
    The MSVC runtime prints out floating points using three digits for
    the exponent.
2001-02-06 15:28:50 +00:00
Fergus Henderson
17f30128d1 Set TERM to vt100 before running lynx, to avoid errors when
Estimated hours taken: 0.5

compiler/notes/Mmakefile:
	Set TERM to vt100 before running lynx, to avoid errors when
	running this Mmakefile from cron.
2001-02-06 11:13:29 +00:00
Peter Ross
35ea6c9f46 Fix a problem where the none.gc.tr.debug grade doesn't compile using
Estimated hours taken: 1

Fix a problem where the none.gc.tr.debug grade doesn't compile using
MSVC.

compiler/layout_out.m:
    Avoid generating definitions in the following form
        type name[] = { };
    as not all C compilers (read MSVC) like an empty initializer list.
2001-02-06 10:10:20 +00:00
Fergus Henderson
96b842c0e2 Document the dangers of calling dl__close.
Estimated hours taken: 1

browser/dl.m:
	Document the dangers of calling dl__close.
2001-02-06 09:13:23 +00:00
Fergus Henderson
0289345454 New file. Documents how to install using lcc.
Estimated hours taken: 3

README.lcc:
        New file.  Documents how to install using lcc.
2001-02-06 08:20:49 +00:00
Fergus Henderson
cf99344e4a Fix SourceForge bug report #129892, "profiler map__lookup failed
Estimated hours taken: 3

Fix SourceForge bug report #129892, "profiler map__lookup failed
in grade hlc.gc.memprof".

The remaining problem that was still causing failures for this
test case was that demangling isn't implemented for the MLDS
back-end.  When symbols that the MLDS back end generates are
fed through the demangler, it demangles some distinct symbols
to the same name.  This causes the profiler to abort, because
it assumes that each distinct symbol demangles to a different
name.

The fix is to turn off demangling when profiling programs
built in MLDS grades.

NEWS:
	Mention that we haven't implemented symbol demangling
	in the profiler for the MLDS back-end yet.

doc/user_guide.texi:
	Document that for profiling of programs built with
	`--high-level-code' you need to use the `--no-demangle'
	option.

tools/test_mercury:
	When testing the profiler in hl* grades,
	pass `--no-demangle' to mprof, and compare with
	*.mprof-exp2 rather than *.mprof-exp.

tests/benchmarks/poly.mprof-exp2:
	New file.  Contains alternative expected output for this test
	case, to match what is output for grade hlc.gc.memprof (at -O2).

profiler/options.m:
	The `--(no-)demangle' option is not a filename option,
	so document it under the "Profiler options" section,
	rather than the "Filename options" section.
	Also fix a typo (s/Ouput/Output/) and a thinko
	(s/unmangled/mangled/) in the description of that option.
2001-02-06 07:11:48 +00:00
David Overton
3528bed5b2 Add `.mode-constraints-sync-tag' which is needed for the new
Estimated hours taken: 0.1

.nocopyright:
	Add `.mode-constraints-sync-tag' which is needed for the new
	mode-constraints branch.
2001-02-06 02:16:35 +00:00
Fergus Henderson
1a730e9f95 Fix a bug: it was not flushing stdout before calling execve().
Estimated hours taken: 0.25

boehm_gc/if_mach.c:
boehm_gc/if_not_there.c:
	Fix a bug: it was not flushing stdout before calling execve().
	This resulted in the output being lost when stdout was buffered
	(e.g. when redirected to a file).
2001-02-06 01:14:56 +00:00
Fergus Henderson
7f20a55444 Fix a couple of XXXs: don't output some unnecessary casts.
Estimated hours taken: 1

compiler/mlds_to_c.m:
	Fix a couple of XXXs: don't output some unnecessary casts.
	Only output the intermediate casts to `MR_Word' when
	casting to/from `character' or mlds__native_{char,bool,int}_type.
	This also fixes a bug that broke the hlc* grades when using
	lcc: casts from pointers to integers aren't allowed in
	constant expressions.
2001-02-05 16:51:32 +00:00
Ralph Becket
0b4e4cdd02 Added func versions of all preds implementing functions.
Estimated hours taken: 0.2

library/int.m:
	Added func versions of all preds implementing functions.
	Changed some comments to use the funcs instead.

NEWS:
	Made a note of the above in the section on changes to the
	library.
2001-02-05 16:16:59 +00:00
Fergus Henderson
34e3b922ff s/Explicit type quantification/Explicit type qualification/
Estimated hours taken: 0.1

NEWS:
	s/Explicit type quantification/Explicit type qualification/
	                   ^^                           ^
2001-02-05 16:13:41 +00:00
Ralph Becket
1257d362e6 Added func versions of all preds implementing functions.
Estimated hours taken: 0.2

library/int.m:
	Added func versions of all preds implementing functions.
	Changed some comments to use the funcs instead.

NEWS:
	Made a note of the above in the section on changes to the
	library.
2001-02-05 15:37:09 +00:00