Commit Graph

8584 Commits

Author SHA1 Message Date
Fergus Henderson
76e05f6b23 Add a work-around for an lcc 4.1 bug which caused lcc to
Estimated hours taken: 10

runtime/mercury_wrapper.c:
	Add a work-around for an lcc 4.1 bug which caused lcc to
	miscompile this file.
stable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O2 stable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O4 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O4-hlc unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O5 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O2 unstable-version-0_10_x-sparc-sun-solaris2_7 stable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O3 unstable-version-0_10_x-i586-pc-linux-libc2_1-gnu-O0 unstable-version-0_10_x-alpha-dec-osf3_2 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O3 unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O4 stable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O5 stable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O4-hlc
2001-02-17 08:01:30 +00:00
Fergus Henderson
dfa28ce06a 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-17 07:22:57 +00:00
Zoltan Somogyi
c750d30073 Loosen a sanity check, to enable us to compile var.m in
Estimated hours taken: 1

var_locn.m:
	Loosen a sanity check, to enable us to compile var.m in
	extras/trailed_update at -O3 without a compiler abort.
2001-02-13 00:39:40 +00:00
David Jeffery
3d4caeac5e Fix a bug reported by petdr on October 30th last year.
Estimated hours taken: 12

[ Committing this on the version-0_10_x branch ]

Fix a bug reported by petdr on October 30th last year.

compiler/polymorphism.m:
        When looking up the variable which contains a typeclass info for
        a particular constraint to be passed to a call, handle the case where
        there is *no* variable for such a constraint. This occurs in the case
        where the producer of the variable occurs later on in the goal (but
        will get re-ordered by the mode checker). The solution is to just
        create a variable for the typeclass info, and whenever creating
        a `head' variable to hold a constraint being produced by a call,
        check first whether there is already a variable allocated for that
        constraint.

doc/reference_manual.texi:
        Delete mention of this bug from the "Known Bugs"  in the existential
        types section.

tests/hard_coded/typeclasses/Mmakefile:
tests/hard_coded/typeclasses/reordered_existential_constraint.exp:
tests/hard_coded/typeclasses/reordered_existential_constraint.m:
        A test case for this. (Not the same as petdr's original test case,
        but much simpler and exhibits the same bug).
2001-02-12 23:36:40 +00:00
Fergus Henderson
876264d473 Fix a bug that broke profiling in MLDS grades on the release branch
Estimated hours taken: 0.5

Fix a bug that broke profiling in MLDS grades on the release branch
(-rversion-0_10_x).

library/exception.m:
        Define function versions of mercury__exception__builtin_catch_3_p_*.
	This was already done on the main branch, in revision 1.42 of
	exception, for the GCC back-end interface.  But it's also needed
	for profiling, so I merged those changes onto the release branch.
2001-02-12 07:58:43 +00:00
cvs2git
b3b00c0ce3 This commit was manufactured by cvs2svn to create branch 'version-0_10_x'. 2001-02-12 05:14:59 +00:00
David Jeffery
29baab7783 Fix a bug reported by petdr on October 30th last year.
Estimated hours taken: 12

Fix a bug reported by petdr on October 30th last year.

compiler/polymorphism.m:
        When looking up the variable which contains a typeclass info for
        a particular constraint to be passed to a call, handle the case where
        there is *no* variable for such a constraint. This occurs in the case
        where the producer of the variable occurs later on in the goal (but
        will get re-ordered by the mode checker). The solution is to just
        create a variable for the typeclass info, and whenever creating
        a `head' variable to hold a constraint being produced by a call,
        check first whether there is already a variable allocated for that
        constraint.

doc/reference_manual.texi:
        Delete mention of this bug from the "Known Bugs"  in the existential
        types section.

tests/hard_coded/typeclasses/Mmakefile:
tests/hard_coded/typeclasses/reordered_existential_constraint.exp:
tests/hard_coded/typeclasses/reordered_existential_constraint.m:
        A test case for this. (Not the same as petdr's original test case,
        but much simpler and exhibits the same bug).
2001-02-12 05:14:58 +00:00
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
e4e41d43f2 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:29:09 +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
436aac64b7 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:54:53 +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
Simon Taylor
3c9a8cc63c 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 14:26:29 +00:00
Fergus Henderson
fce3013302 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:21:45 +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
da887f8d7a 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:48:40 +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
3a6b96414c 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:43:12 +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
e75b14799e 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:25:14 +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
40668d963c 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.
unstable-version-0_10_x-i686-pc-linux-libc2_1-gnu-O5-lcc
2001-02-09 06:48:03 +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
a344fce5fb 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:59:04 +00:00
cvs2git
d9e2cb38ec This commit was manufactured by cvs2svn to create branch 'version-0_10_x'. 2001-02-09 03:27:37 +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
Simon Taylor
00811462da 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:21:42 +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
2f4a1f1d03 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:52:05 +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