Commit Graph

171 Commits

Author SHA1 Message Date
Simon Taylor
98c2fbf51b Bug fixes.
Estimated hours taken: 12

Bug fixes.

tests/term/arit_exp.m still fails with --intermodule-optimization
due to a slightly different (but correct) trans_opt file being produced.

compiler/simplify.m
	Don't produce singleton disjunctions, since the code generator
	barfs on them. Use a `some' instead.
	Test case: tests/general/partition.m compiled with --deforestation.

compiler/unused_args.m
	Deconstructions where the arguments included `any' insts were
	not being handled correctly, due to inst_matches_binding
	failing for any->any.
	Test case: extras/trailed_update/samples/vqueens.m at -O3.
	Don't warn about predicates from `.opt' files having unused
	arguments, because in most cases the warning will be generated
	when compiling the imported module.

compiler/higher_order.m
	Fix a bug that caused compiler/modules.m to be miscompiled at
	-O3 --intermodule-optimization, due to curried arguments for
	multiple known higher-order arguments being passed to a
	specialised version in the wrong order.
	Test case: tests/hard_coded/ho_order2.m

compiler/mercury_compile.m
	Call intermod__update_pred_import_status when compiling to
	C at the same stage of the compilation as the `.opt' file
	was written to ensure that the same information is being used.
	Test case: tests/hard_coded/rational_test.m compiled with
	--intermodule-optimization failed because of a link error.
	Make sure polymorphism has been run before doing unused argument
	checking with --errorcheck-only. Otherwise the argument indices
	read in from `.opt' files are incorrect.

compiler/intermod.m
	Use code_util__compiler_generated to test if a called predicate
	is compiler generated, rather than looking for a call_unify_context
	(function calls have a call_unify_context).
	Add a progress message for updating the import status of predicates
	exported to `.opt' files.
	Fix a bug where the unused_args pragmas read in from the current
	module's `.opt' file were given an import_status of `imported' rather
	than `opt_imported' resulting in an error message from make_hlds.m.

compiler/dead_proc_elim.m
	Ensure that predicates used by instance declarations and
	`:- pragma export's are not eliminated by the dead_pred_elim
	pass before typechecking.
	Test case: most of the typeclass tests compiled with
	--intermodule-optimization.

compiler/hlds_goal.m
	Remove obsolete comments about the modes of a higher-order
	unification being incorrect after polymorphism, since that
	was fixed months ago.

compiler/options.m
	Reenable deforestation.
	Enable --intermodule-optimization and --intermod-unused-args
	at -O5 so they get tested occasionally.

compiler/handle_options.m
	Disable deforestation if --typeinfo-liveness is set, since
	there are bugs in the folding code if extra typeinfos are
	added to a new predicate's arguments by hlds_pred__define_new_pred.
	Disable higher_order.m if --typeinfo-liveness is set, since
	higher_order.m currently does not pass all necessary typeinfos
	to specialised versions or update the typeinfo_varmap of
	specialised versions.
	Test case: tests/valid/agc_ho_pred.m

tests/hard_coded/ho_order2.m
tests/hard_coded/ho_order2.exp
	Test case for higher_order.m.

tools/test_mercury
	Added --intermod-unused-args to the options for murlibobo.

extras/trailed_update/{samples,tests}/Mmakefile
	Add "-I.." to MGNUCFLAGS so gcc can find unsafe.h which
	is #included in c_header_code read from unsafe.opt.
1998-06-03 00:44:04 +00:00
Fergus Henderson
731ae2051f Allow a predicate to have matching cc' and non-cc' modes.
Estimated hours taken: 3

Allow a predicate to have matching `cc' and `non-cc' modes.

compiler/det_analysis.m:
	If there is a call to a cc procedure in a non-cc context,
	then search for a mode of that predicate which is
	identical to the called mode except that it is not cc.
	If such a mode is found, use it, rather than reporting
	an error.

compiler/modecheck_call.m:
	Add predicate modes_are_identical_bar_cc, for use by
	det_analysis.m.

NEWS:
LIMITATIONS:
doc/reference_manual.texi:
	Document the new feature and delete documentation about the
	lack of this feature.

tests/hard_coded/Mmakefile:
tests/hard_coded/cc_and_non_cc_test.m:
tests/hard_coded/cc_and_non_cc_test.exp:
	Add a test case for the new feature.
1998-05-30 15:23:14 +00:00
Fergus Henderson
eae7eec887 Allow modules to be put in source files whose names do not directly match
Estimated hours taken: 10

Allow modules to be put in source files whose names do not directly match
their the module names.  When looking for the source for a module such
as `foo:bar:baz', search for it first in `foo.bar.baz.m', then in `bar.baz.m',
and finally in `baz.m'.

compiler/prog_io.m:
	Change prog_io__read_module so that it returns the name of
	the module read, as determined by the `:- module' declaration.
	Add predicate `check_module_has_expected_name', for checking
	that this name matches what was expected.

compiler/modules.m:
	Add read_mod_from_file, for reading a module given the file name,
	and generated_file_dependencies, for generating the dependencies
	of a module given the file name.  (As opposed to the module name.)
	Change read_mod and read_mod_ignore_errors so that they
	search for `.m' files as described above, and return the name
	of the source file read.
	Also improve the efficiency of read_dependencies slightly:
	when reading in `.int' files, there's no need to call
	split_into_submodules, because we generate a seperate
	`.int' file for each submodule anyway.

compiler/mercury_compile.m:
	Change the handling of command-line arguments.
	Arguments ending with `.m' are assumed to be file names,
	and other arguments are assumed to be module names.
	For file names, call read_mod_from_file instead of read_mod.

compiler/handle_options.m:
	Change help message to reflect the above change to the semantics
	of command-line arguments.

compiler/intermod.m:
compiler/trans_opt.m:
	Fix a bug: call prog_io__read_opt_file instead of prog_io__read_module.

doc/user_guide.texi:
	Document the above change to the semantics of command-line arguments.
	Update the "libraries" chapter to reflect our support for nested
	modules.

tests/*/*.m:
tests/*/*.exp:
	Fix a few incorrect module names in `:- module' declarations.
1998-05-29 08:57:42 +00:00
Fergus Henderson
935fbfe36e Add Mmake support for nested sub-modules.
Estimated hours taken: 6

Add Mmake support for nested sub-modules.

compiler/mercury_compile.m:
compiler/modules.m:
compiler/intermod.m:
	Pass down the source file name to various places.
	Store the source file name in the module_imports data structure.
	In various places, use this source file name instead of assuming
	that the source file name can be obtained from the module name.

compiler/modules.m:
	Change the generated .d and .dep files to use the source file names.
	Add hard-coded rules in the .d files if the source file name does not
	match the form expected by the pattern rules in scripts/Mmake.rules.
	XXX unfortunately the rules don't work right for parallel makes of
	    nested modules

scripts/Mmake.rules:
	Add a comment saying that any changes here might need to
	be duplicated in compiler/modules.m.

tests/hard_coded/Mmakefile:
tests/hard_coded/nested.m:
tests/hard_coded/nested2.m:
tests/hard_coded/nested.exp:
tests/hard_coded/nested2.exp:
	Add a couple of test cases for nested modules (XXX not enabled,
	due to the above-mentioned problem with parallel makes).

doc/reference_manual.texi:
	Update the "implementation bugs and limitations" section.

NEWS:
	Update the news about nested modules.
1998-05-27 04:00:54 +00:00
Fergus Henderson
44a5c5b2f8 Make the code a little bit more readable:
Estimated hours taken: 6

compiler/mercury_to_mercury.m:
compiler/mode_errors.m:
	Make the code a little bit more readable:
	use specific types rather than `bool' in a few places.

compiler/mercury_to_mercury.m:
	Fix bugs in the generation of interface files where it was
	outputting certain graphic tokens incorrectly.  In particular,
	it was outputting things like `module:?' without any parentheses,
	space, or quotes to separate the `:' as module qualifier from
	the symbol name.

tests/hard_coded/Mmakefile:
tests/hard_coded/quoting_bug.m:
tests/hard_coded/quoting_bug_test.m:
tests/hard_coded/quoting_bug_test.exp:
	Add some tests for the above-mentioned bug fix.

tests/term/*.trans_opt_exp:
tests/misc_tests/pretty_print_test.exp:
	Update expected output for these tests to reflect the
	above changes.
1998-05-20 13:10:50 +00:00
Zoltan Somogyi
564d358da3 Avoid about half of the slow "mmake realclean"s required by a bootcheck.
Estimated hours taken: 0.5

Avoid about half of the slow "mmake realclean"s required by a bootcheck.

tests/*/runtests:
	Concentrate all the actions performed before the test and after
	a successful tests (both of which involve an "mmake realclean")
	into two scripts, tests/{startup,shutdown}.

tests/shutdown:
	Clean up the directory, and touch the file CLEAN.

tests/startup:
	If the file CLEAN exists and is the most recent file in the directory,
	consider the directory clean to beging with. Otherwise, run mmake
	realclean.
1998-05-13 04:06:38 +00:00
Simon Taylor
be2b948764 Disable cycles.m since it triggers a bug in code generation
Estimated hours taken: 1

tests/hard_coded/Mmakefile
	Disable cycles.m since it triggers a bug in code generation
	for disjunctions when compiled in a non-GC grade with --deforestation.

tests/hard_coded/cycles2.m
	cycles.m expanded so that deforestation is not needed to produce
	the problem.
1998-05-04 05:15:50 +00:00
Zoltan Somogyi
cd31eecf88 When reporting the results, print the options that controlled
Estimated hours taken: 0.2

tests/runtests:
tests/*/runtests:
	When reporting the results, print the options that controlled
	the tests, so you don't have to search for them.

tests/*/runtests:
	Clean up the directory if the tests are successful, in order
	to reduce disk space usage.
1998-04-23 09:28:39 +00:00
Fergus Henderson
2dcd79773b Add `--gc conservative' to the GRADEFLAGS settings for
Estimated hours taken: 0.25

tests/hard_coded/Mmakefile:
	Add `--gc conservative' to the GRADEFLAGS settings for
	integer_test and rational_test, since these test cases both use
	enough memory that they require some kind of GC -- without it
	the test fails because it runs out of heap space.
1998-04-17 20:47:24 +00:00
Bert Thompson
30ef37923c Moved tests of library/{integer,rational}.m from tests/general to
Estimated hours taken: 0.1

Moved tests of library/{integer,rational}.m from tests/general to
tests/hard_coded since the library modules and their tests cannot
be compiled under NU-Prolog.

general/Mmakefile:
general/.cvsignore:
	Removed references to integer_test and rational_test.
general/integer_test.m:
general/integer_test.exp:
general/rational_test.exp:
general/rational_test.m:
	File removed.
hard_coded/Mmakefile:
hard_coded/.cvsignore:
	Added references to integer_test and rational_test.
hard_coded/integer_test.m:
hard_coded/integer_test.exp:
hard_coded/rational_test.exp:
hard_coded/rational_test.m:
	File added.
1998-04-16 12:00:32 +00:00
Fergus Henderson
f00346033a Make another small fix to mmake.in and add more empty definitions for various
Estimated hours taken: 0.5

Make another small fix to mmake.in and add more empty definitions for various
Mmake variables to avoid spurious warnings.

scripts/mmake.in:
	Add `*clean*' to the patterns for which we do not
	pass `--warn-undefined-variables'.

scripts/Mmake.rules:
	When invoking make recursively, pass $(MFLAGS) rather than
	$(MAKEOVERRIDES).  This avoids a warning, and is probably the
	right thing to do anyway (I'm not sure why I used MAKEOVERRIDES
	in the first place).

boehm_gc/Mmakefile:
tests/hard_coded/Mmakefile:
	Add empty definition for `MMAKEFLAGS'.
1998-04-02 13:23:10 +00:00
Fergus Henderson
713349d3e6 Move the rtc_bug' test case from the general'
Estimated hours taken: 0.2

tests/general/Mmakefile:
tests/general/rtc_bug.m:
tests/general/rtc_bug.exp:
tests/general/.cvsignore:
tests/hard_coded/Mmakefile:
tests/hard_coded/rtc_bug.m:
tests/hard_coded/rtc_bug.exp:
tests/hard_coded/.cvsignore:
	Move the `rtc_bug' test case from the `general'
	directory to the `hard_coded' directory, since it doesn't
	work in Prolog.
1998-04-02 13:18:47 +00:00
Fergus Henderson
1cee27b40d Ignore the executables created for some recently-added test cases.
Estimated hours taken: 0.05

tests/hard_coded/.cvsignore:
	Ignore the executables created for some recently-added test cases.
1998-04-02 11:22:56 +00:00
Fergus Henderson
0d117f424c Get type inference working for type classes.
Estimated hours taken: 2

compiler/typecheck.m:
	Get type inference working for type classes.

tests/hard_coded/typeclasses/Mmakefile:
tests/hard_coded/typeclasses/inference_test.m:
tests/hard_coded/typeclasses/inference_test.exp:
	Add a simple test case for type class inference.
1998-03-30 13:28:21 +00:00
Fergus Henderson
86d6c4398e Move the relation_test' test case from the general'
Estimated hours taken: 0.25

tests/general/Mmakefile:
tests/general/relation_test.m:
tests/general/relation_test.exp:
tests/hard_coded/Mmakefile:
tests/hard_coded/relation_test.m:
tests/hard_coded/relation_test.exp:
	Move the `relation_test' test case from the `general'
	directory to the `hard_coded' directory, since it doesn't
	work in Prolog.
1998-03-27 16:42:32 +00:00
Fergus Henderson
002ad1c8d8 Fix a bug in string__base_string_to_int:
Estimated hours taken: 1

library/string.m:
	Fix a bug in string__base_string_to_int:
	it was handling MININT incorrectly.

tests/hard_coded/Mmakefile:
tests/hard_coded/minint_bug.m:
tests/hard_coded/minint_bug.exp:
	Regression test.
1998-03-18 14:16:20 +00:00
Fergus Henderson
d7a279e3a6 Fix a syntax error in my previous change.
Estimated hours taken: 0.1

tests/hard_coded/rev_arith.m:
	Fix a syntax error in my previous change.
1998-03-12 21:29:25 +00:00
Fergus Henderson
b0f1923290 Update the expected output for this test case to
Estimated hours taken: 0.1

tests/hard_coded/no_fully_strict.exp:
	Update the expected output for this test case to
	include the "stack dump not available in this grade"
	message that error/1 prints.
1998-03-12 01:54:55 +00:00
Fergus Henderson
585fdd2f8e Fix the expected output for this test case --
Estimated hours taken: 0.25

tools/test_mercury/common_type_cast.exp:
	Fix the expected output for this test case --
	I had accidentally replaced the original expected output
	with the output for NU-Prolog.
1998-03-12 01:52:53 +00:00
Fergus Henderson
b0cc71ea85 Tell cvs to ignore the executables for the test cases
Estimated hours taken: 0.1

test/hard_coded/typeclasses/.cvsignore:
	Tell cvs to ignore the executables for the test cases
	in this directory.
1998-03-11 19:37:19 +00:00
Fergus Henderson
9308d1815a Change the `rev_arith.m' test so that it only tests
Estimated hours taken: 0.25

tests/hard_coded/Mmakefile:
tests/hard_coded/rev_arith.m:
tests/hard_coded/rev_arith.exp:
	Change the `rev_arith.m' test so that it only tests
	for the things which we actually support, and enable it.
1998-03-11 19:36:28 +00:00
Fergus Henderson
2823abbcac Move the common_type_cast' test from the general' directory
Estimated hours taken: 0.25

tests/general/Mmakefile:
tests/general/common_type_cast.m:
tests/general/common_type_cast.exp:
tests/hard_coded/Mmakefile:
tests/hard_coded/common_type_cast.m:
tests/hard_coded/common_type_cast.exp:
	Move the `common_type_cast' test from the `general' directory
	to the `hard_coded' directory.  The reason for this was that
	the output under Mercury is slightly different to the output
	under NU-Prolog (the difference being trailing zeroes on
	floating point numbers); moving the test to the `hard_coded'
	directory was the simplest way of fixing this.
1998-03-10 11:09:30 +00:00
Fergus Henderson
89e089122b Ignore some recently-added test cases.
Estimated hours taken: 0.05

tests/hard_coded/.cvsignore:
	Ignore some recently-added test cases.
1998-03-09 12:07:24 +00:00
Fergus Henderson
3c0063fac0 Add support for the use of partial module qualifiers,
Estimated hours taken: 8

Add support for the use of partial module qualifiers,
e.g. using `child:foo' to refer to `parent🧒foo'.
Previously we only allowed names to be fully-qualified
or completely unqualified.

Note that we still don't yet keep track of which modules are visible,
so this change does not properly handle the distinction between
`import_module' and `use_module' declarations for parent modules.
It basically assumes that `child:foo' is allowed iff plain `foo'
would be allowed (i.e. iff `parent:child' has been imported)
whereas it ought to be allowed iff `parent' has been imported.

compiler/modules.m:
	Add get_partial_qualifiers/2, for use by make_hlds.m
	and hlds_module.m.

compiler/make_hlds.m:
	Insert partially-qualified symbols into the cons_table.

compiler/hlds_module.m:
	Insert partially-qualified symbols into the pred_table.

compiler/module_qual.m:
	When searching the symbol tables used for types, insts, modes,
	and typeclasses, search for partially-qualified symbols.

compiler/modecheck_unify.m:
	When module-qualifying cons_ids, make sure that we fully module
	qualify them even if they're already partially qualified.

tests/hard_coded/parent.m:
tests/hard_coded/parent.child.m:
tests/hard_coded/parent.child2.m:
tests/hard_coded/parent.exp:
tests/hard_coded/parent2.m:
tests/hard_coded/parent2.child.m:
tests/hard_coded/parent2.exp:
	Uncomment the previously-failed test of using partially-qualified
	symbol names.  Add a new child module, `parent.child2', and import it
	using `use_module', so that we test `use_module' as well as
	`import_module'.  Add code to test importing of types and
	constructors.
1998-03-04 19:48:04 +00:00
Fergus Henderson
11d8161692 Add support for nested modules.
Estimated hours taken: 50

Add support for nested modules.

- module names may themselves be module-qualified
- modules may contain `:- include_module' declarations
  which name sub-modules
- a sub-module has access to all the declarations in the
  parent module (including its implementation section).

This support is not yet complete; see the BUGS and LIMITATIONS below.

LIMITATIONS
- source file names must match module names
	(just as they did previously)
- mmc doesn't allow path names on the command line any more
	(e.g. `mmc --make-int ../library/foo.m').
- import_module declarations must use the fully-qualified module name
- module qualifiers must use the fully-qualified module name
- no support for root-qualified module names
	(e.g. `:parent:child' instead of `parent:child').
- modules may not be physically nested (only logical nesting, via
  `include_module').

BUGS
- doesn't check that the parent module is imported/used before allowing
	import/use of its sub-modules.
- doesn't check that there is an include_module declaration in the
	parent for each module claiming to be a child of that parent
- privacy of private modules is not enforced

-------------------

NEWS:
	Mention that we support nested modules.

library/ops.m:
library/nc_builtin.nl:
library/sp_builtin.nl:
compiler/mercury_to_mercury.m:
	Add `include_module' as a new prefix operator.
	Change the associativity of `:' from xfy to yfx
	(since this made parsing module qualifiers slightly easier).

compiler/prog_data.m:
	Add new `include_module' declaration.
	Change the `module_name' and `module_specifier' types
	from strings to sym_names, so that module names can
	themselves be module qualified.

compiler/modules.m:
	Add predicates module_name_to_file_name/2 and
	file_name_to_module_name/2.
	Lots of changes to handle parent module dependencies,
	to create parent interface (`.int0') files, to read them in,
	to output correct dependencies information for them to the
	`.d' and `.dep' files, etc.
	Rewrite a lot of the code to improve the readability
	(add comments, use subroutines, better variable names).
	Also fix a couple of bugs:
	- generate_dependencies was using the transitive implementation
	  dependencies rather than the transitive interface dependencies
	  to compute the `.int3' dependencies when writing `.d' files
	  (this bug was introduced during crs's changes to support
	  `.trans_opt' files)
	- when creating the `.int' file, it was reading in the
	  interfaces for modules imported in the implementation section,
	  not just those in the interface section.
	  This meant that the compiler missed a lot of errors.

library/graph.m:
library/lexer.m:
library/term.m:
library/term_io.m:
library/varset.m:
compiler/*.m:
	Add `:- import_module' declarations to the interface needed
	by declarations in the interface.  (The previous version
	of the compiler did not detect these missing interface imports,
	due to the above-mentioned bug in modules.m.)

compiler/mercury_compile.m:
compiler/intermod.m:
	Change mercury_compile__maybe_grab_optfiles and
	intermod__grab_optfiles so that they grab the opt files for
	parent modules as well as the ones for imported modules.

compiler/mercury_compile.m:
	Minor changes to handle parent module dependencies.
	(Also improve the wording of the warning about trans-opt
	dependencies.)

compiler/make_hlds.m:
compiler/module_qual.m:
	Ignore `:- include_module' declarations.

compiler/module_qual.m:
	A couple of small changes to handle nested module names.

compiler/prog_out.m:
compiler/prog_util.m:
	Add new predicates string_to_sym_name/3 (prog_util.m) and
	sym_name_to_string/{2,3} (prog_out.m).

compiler/*.m:
	Replace many occurrences of `string' with `module_name'.
	Change code that prints out module names or converts
	them to strings or filenames to handle the fact that
	module names are now sym_names intead of strings.
	Also change a few places (e.g. in intermod.m, hlds_module.m)
	where the code assumed that any qualified symbol was
	fully-qualified.

compiler/prog_io.m:
compiler/prog_io_goal.m:
	Move sym_name_and_args/3, parse_qualified_term/4 and
	parse_qualified_term/5 preds from prog_io_goal.m to prog_io.m,
	since they are very similar to the parse_symbol_name/2 predicate
	already in prog_io.m.  Rewrite these predicates, both
	to improve maintainability, and to handle the newly
	allowed syntax (module-qualified module names).
	Rename parse_qualified_term/5 as `parse_implicit_qualified_term'.

compiler/prog_io.m:
	Rewrite the handling of `:- module' and `:- end_module'
	declarations, so that it can handle nested modules.
	Add code to parse `include_module' declarations.

compiler/prog_util.m:
compiler/*.m:
	Add new predicates mercury_public_builtin_module/1 and
	mercury_private_builtin_module/1 in prog_util.m.
	Change most of the hard-coded occurrences of "mercury_builtin"
	to call mercury_private_builtin_module/1 or
	mercury_public_builtin_module/1 or both.

compiler/llds_out.m:
	Add llds_out__sym_name_mangle/2, for mangling module names.

compiler/special_pred.m:
compiler/mode_util.m:
compiler/clause_to_proc.m:
compiler/prog_io_goal.m:
compiler/lambda.m:
compiler/polymorphism.m:
	Move the predicates in_mode/1, out_mode/1, and uo_mode/1
	from special_pred.m to mode_util.m, and change various
	hard-coded definitions to instead call these predicates.

compiler/polymorphism.m:
	Ensure that the type names `type_info' and `typeclass_info' are
	module-qualified in the generated code.  This avoids a problem
	where the code generated by polymorphism.m was not considered
	type-correct, due to the type `type_info' not matching
	`mercury_builtin:type_info'.

compiler/check_typeclass.m:
	Simplify the code for check_instance_pred and
	get_matching_instance_pred_ids.

compiler/mercury_compile.m:
compiler/modules.m:
	Disallow directory names in command-line arguments.

compiler/options.m:
compiler/handle_options.m:
compiler/mercury_compile.m:
compiler/modules.m:
	Add a `--make-private-interface' option.
	The private interface file `<module>.int0' contains
	all the declarations in the module; it is used for
	compiling sub-modules.

scripts/Mmake.rules:
scripts/Mmake.vars.in:
	Add support for creating `.int0' and `.date0' files
	by invoking mmc with `--make-private-interface'.

doc/user_guide.texi:
	Document `--make-private-interface' and the `.int0'
	and `.date0' file extensions.

doc/reference_manual.texi:
	Document nested modules.

util/mdemangle.c:
profiler/demangle.m:
	Demangle names with multiple module qualifiers.

tests/general/Mmakefile:
tests/general/string_format_test.m:
tests/general/string_format_test.exp:
tests/general/string__format_test.m:
tests/general/string__format_test.exp:
tests/general/.cvsignore:
	Change the `:- module string__format_test' declaration in
	`string__format_test.m' to `:- module string_format_test',
	because with the original declaration the `__' was taken
	as a module qualifier, which lead to an error message.
	Hence rename the file accordingly, to avoid the warning
	about file name not matching module name.

tests/invalid/Mmakefile:
tests/invalid/missing_interface_import.m:
tests/invalid/missing_interface_import.err_exp:
	Regression test to check that the compiler reports
	errors for missing `import_module' in the interface section.

tests/invalid/*.err_exp:
tests/warnings/unused_args_test.exp:
tests/warnings/unused_import.exp:
	Update the expected diagnostics output for the test cases to
	reflect a few minor changes to the warning messages.

tests/hard_coded/Mmakefile:
tests/hard_coded/parent.m:
tests/hard_coded/parent.child.m:
tests/hard_coded/parent.exp:
tests/hard_coded/parent2.m:
tests/hard_coded/parent2.child.m:
tests/hard_coded/parent2.exp:
	Two simple tests case for the use of nested modules with
	separate compilation.
1998-03-03 17:48:14 +00:00
Fergus Henderson
cb199ff0b8 Update the expected output for this test case to reflect
Estimated hours taken: 0.1

tests/hard_coded/remove_file.exp:
	Update the expected output for this test case to reflect
	my recent change to the error messages for io__remove_file.
1998-02-27 13:02:09 +00:00
Fergus Henderson
5f196b4f9b Fix a bug which caused the compiler to generate incorrect
Estimated hours taken: 0.75

compiler/modecheck_unify.m:
	Fix a bug which caused the compiler to generate incorrect
	code for the case where a function had the same name and arity
	as a data constructor (but a different return type),
	and the data constructor was used with an explicit module
	qualifier -- it incorrectly ignored the types and chose
	the function rather than the data constructor.

tests/hard_coded/Mmakefile:
tests/hard_coded/func_ctor_ambig.m:
tests/hard_coded/func_ctor_ambig.exp:
	Regression test.
1998-02-19 03:17:16 +00:00
Zoltan Somogyi
5e333f4424 Fix a bug that broke Tom's implementation of a random number generator at -O6.
Estimated hours taken: 3

Fix a bug that broke Tom's implementation of a random number generator at -O6.
The bug appeared only if value numbering is run for a second time after most
other low-level optimizations have been repeated several times. The problem
was that the first invocation of value numbering introduces a temp variable,
and the second one deletes the assignment to the temp variable because an
if_val with a liveness annotation comes between this assignment and the
first use of the temp variable.

compiler/livemap.m:
	When an if_val is preceded by a livevals annotation,
	do not replace the current liveness with the contents
	of the annotation. Instead, just include the contents
	of the annotation in the current set of live lvals.

tests/hard_coded/rnd.{m,exp}:
	Tom's test case.

tests/hard_coded/Mmakefile:
	Always run Tom's test case at -O6.
1998-02-18 03:24:46 +00:00
Simon Taylor
e64a52a98c Document that lambda.m no longer reorders the arguments
Estimated hours taken: 0.1

tests/hard_coded/ho_order.m
	Document that lambda.m no longer reorders the arguments
	of lambda expressions.
1998-02-12 03:47:54 +00:00
Fergus Henderson
9335ac4e70 Fix another bug in the handling of the `typeclasses'
Estimated hours taken: 0.25

tests/hard_coded/Mmakefile:
	Fix another bug in the handling of the `typeclasses'
	subdirectory: ensure that variables are quoted when
	passing them down to make subdirectories, so that it
	works for settings such as EXTRA_MCFLAGS="-O2 --opt-space"
	which contain embedded spaces.
1998-02-05 02:51:15 +00:00
Fergus Henderson
7788661dee Link the mode_choice' test with --no-strip', to
Estimated hours taken: 0.5

tests/hard_coded/Mmakefile:
	Link the `mode_choice' test with `--no-strip', to
	work around a probably bug in the Solaris linker.
1998-02-04 06:29:40 +00:00
Fergus Henderson
57797ed0eb Fix a couple of bugs introduced when dgj added a `typeclasses'
Estimated hours taken: 0.5

tests/hard_coded/Mmakefile:
	Fix a couple of bugs introduced when dgj added a `typeclasses'
	subdirectory:
	- ensure that `mmake clean' and `mmake realclean' recursively
	  clean the subdirectories
	- when recursively invoking the Mmakefiles in subdirectories,
	  make sure we pass down the values of the GRADE, EXTRA_CFLAGS
	  and EXTRA_MCFLAGS variables.
1998-02-04 04:36:57 +00:00
David Jeffery
2eebaab7f8 Re-enable the implied instance tests.
Estimated hours taken: 0.02

hard_coded/typeclasses/Mmakefile:
	Re-enable the implied instance tests.
1998-02-04 03:23:18 +00:00
David Jeffery
086176ef88 A new test case for a typeclass declaration with a func declaration
Estimated hours taken: 0.02

tests/hard_coded/test_default_func_mode.*:
	A new test case for a typeclass declaration with a func declaration
	using the default func mode.
Mmakefile:
	Enable this test.
1998-02-03 07:07:39 +00:00
Zoltan Somogyi
0ae63020c6 Disable two tests that we do not yet pass. DJ is working on them.
Estimated hours taken: 0.1

tests/hard_coded/typeclasses:
	Disable two tests that we do not yet pass. DJ is working on them.
1998-02-02 06:15:35 +00:00
David Jeffery
49defbbe6f Added tyepclass_test_6 to the list of executed test cases.
Estimated hours taken: 0.05

tests/hard_coded/typeclasses/Mmakefile:
	Added tyepclass_test_6 to the list of executed test cases.
1998-01-29 23:58:00 +00:00
David Jeffery
94f3114b40 Remove typeclass_test_* from the Mmakefile, as these tests now reside
Estimated hours taken: 0.05

tests/hard_coded/Mmakefile:
	Remove typeclass_test_* from the Mmakefile, as these tests now reside
	in the tyepclasses directory.
1998-01-29 23:54:58 +00:00
David Jeffery
e154dad80e Execute the new typeclass tests.
Estimated hours taken: 15

tests/hard_coded/typeclasses/Mmakefile:
	Execute the new typeclass tests.
tests/hard_coded/typeclasses/*.m:
	The new typeclass tests.
tests/hard_coded/typeclasses/*.exp:
	The expected results for the tyepclass tests.
1998-01-29 23:52:05 +00:00
David Jeffery
59f2b0bef9 Change the Mmakefile so that it executes the tests in the typeclasses
Estimated hours taken: 15

tests/hard_coded/Mmakefile:
	Change the Mmakefile so that it executes the tests in the typeclasses
	directory as well.
1998-01-29 23:50:26 +00:00
David Jeffery
6e9af8ea13 Deleted the .exp files as well... these tests have been moved into
Estimated hours taken: 0.01

test/hard_coded/typeclass_test*.exp:
	Deleted the .exp files as well... these tests have been moved into
	the typeclasses directory.
1998-01-29 23:48:49 +00:00
David Jeffery
f8ecccafd5 Moved into the typeclass directory.
Estimated hours taken: 0.05

tests/hard_coded/typeclass*.m:
	Moved into the typeclass directory.
1998-01-29 23:45:57 +00:00
Fergus Henderson
40dcaf4f4f For calls to class methods, if the particular class instance is
Estimated hours taken: 3 (plus 1 from dgj)

compiler/polymorphism.m:
	For calls to class methods, if the particular class instance is
	known at the call site, then specialize the code by generating
	a direct call to the method for that instance.

tests/invalid/Mmakefile:
tests/invalid/typeclass_test_{1,2,3,4}.m:
tests/invalid/typeclass_test_{1,2,3,4}.err_exp:
tests/hard_coded/Mmakefile:
tests/hard_coded/typeclass_test_{5,6}.m:
tests/hard_coded/typeclass_test_{5,6}.exp:
	Some test cases for type classes, including one for the above change.
1998-01-29 08:39:56 +00:00
Fergus Henderson
ad82d19c92 Fix a bug reported by Mark Brown that caused type_to_term
Estimated hours taken: 0.25

Fix a bug reported by Mark Brown that caused type_to_term
to fail when used for values of type `character'.

library/mercury_builtin.m:
	Fix a bug in the hand-coded base_type_info for the
	"character" type -- it had the type name as "char", not
	"character"

tests/hard_coded/Mmakefile:
tests/hard_coded/ground_dd.m:
tests/hard_coded/ground_dd.exp:
	Regression test.
1998-01-22 07:12:30 +00:00
Fergus Henderson
ced3f74b87 Fix a bug in io__remove_file_2 that was spotted by
Estimated hours taken: 0.5

library/io.m:
	Fix a bug in io__remove_file_2 that was spotted by
	Thomas By <T.By@dcs.shef.ac.uk>: a call to strcpy()
	in the pragma c_code had the wrong argument, causing
	it to do the wrong thing in the case where io__remove_file
	returned an error.

tests/hard_coded/Mmakefile:
tests/hard_coded/remove_file.m:
tests/hard_coded/remove_file.exp:
	Regression test.
1998-01-22 02:26:53 +00:00
Fergus Henderson
6db3f94609 Fix a bug that caused the compiler to report spurious unique mode
Estimated hours taken: 4

Fix a bug that caused the compiler to report spurious unique mode
errors for cases involving nested conjunctions, reordering, and
unique modes.

compiler/modes.m:
	When modechecking conjunctions, if the conjunction as a whole
	delays, make sure that we restore the original live_vars set.

compiler/mode_info.m:
	Add mode_info_get_live_vars/2 and mode_info_set_live_vars/3,
	for use by modes.m.

tests/hard_coded/Mmakefile:
tests/hard_coded/reorder_di.m:
tests/hard_coded/reorder_di.exp:
	Regression test for the above-mentioned bug.
1998-01-21 06:11:20 +00:00
Fergus Henderson
1d1a7f5ebd Fix a bug where semidet pragma c_codes didn't work in non-gc grades.
Estimated hours taken: 8

compiler/pragma_c_gen.m:
	Fix a bug where semidet pragma c_codes didn't work in non-gc grades.
	The problem was that in the following code fragment
		{ <the c code itself> }
		#ifndef CONSERVATIVE_GC
		  restore_registers();
		#endif
		if (r1) ...
	the C code would assign to SUCCESS_INDICATOR, which is #defined
	to `r1', and then the call to restore_registers() would clobber r1.

	In the process of fixing the bug, reorganize the code for
	generating ordinary (det/semi) pragma_c so that it more closely
	matches the layout of the code it generates, and add a few comments.

compiler/dupelim.m:
	Fix a bug in dupelim__build_maps: a lambda expression was using
	the same variable name (`Label') as the code outside it,
	resulting in it accidentally capturing that variable rather
	than being a fresh variable.

compiler/frameopt.m:
	Fix a bug in possible_targets/2: the possible targets for
	a `pragma_c' instruction include the label, if it has one.

compiler/opt_util.m:
	Update the comments for component_can_branch_away/2
	to reflect the fact that pragma_c_raw_code components for
	semidet pragma c_codes can branch away.  Also check for the
	special case of an empty string in pragma_c_raw_code.

tests/hard_coded/Mmakefile:
	Re-enable the `pragma_import' test which uncovered this bug.
1998-01-16 07:05:48 +00:00
Fergus Henderson
5352eeff09 Add `GRADEFLAGS-pragma_import = --gc conservative',
Estimated hours taken: 0.5

tests/hard_coded/Mmakefile:
	Add `GRADEFLAGS-pragma_import = --gc conservative',
	because the `pragma_import' test currently does not
	work in non-gc grades.
1998-01-14 02:16:28 +00:00
Fergus Henderson
00373e9337 Tell CVS to ignore the automatically generated files
Estimated hours taken: 0.05

tests/hard_coded/.cvsignore:
	Tell CVS to ignore the automatically generated files
	`pragma_import' and `pragma_import.h'.
1998-01-12 13:34:27 +00:00
Fergus Henderson
932190c0ed Ignore executables created from newly added test cases,
Estimated hours taken: 0.1

tests/hard_coded/.cvsignore:
	Ignore executables created from newly added test cases,
	namely `purity' and `eqv_type_bug'.
1998-01-10 07:09:52 +00:00
Fergus Henderson
64009ded0b Add support for `pragma import', which is a simplified form of
Estimated hours taken: 20

Add support for `pragma import', which is a simplified form of
`pragma c_code'.  With `pragma import', the user specifies only
the C function name, rather than a C code fragment, and the
Mercury compiler handles the argument-passing automatically.

TODO
- add documentation to doc/reference_manual.texi.

WISHLIST
- change `pragma import' and `pragma export'
  to take an additional parameter indicating the language
  (e.g. C, Prolog, Ada, Fortran, etc.) and/or calling
  convention

compiler/prog_data.m:
	Add `pragma import' to the parse tree data structure.

compiler/prog_io_pragma.m:
	Add code to parse `pragma import' declarations.

compiler/mercury_to_mercury.m:
	Add code to pretty-print `pragma import' declarations.

compiler/module_qual.m:
	Add code to module-qualify `pragma import' declarations.

compiler/make_hlds.m:
	Add code to process `pragma import' declarations,
	by converting them to clauses with HLDS `c_code' instructions.

compiler/export.m:
	Declare `export__exclude_argument_type' in the interface,
	for use by the code for handling `pragma import' in make_hlds.m.
	Change the documentation to say that this procedure is used for
	both exported and imported procedures.

compiler/notes/compiler_design.html:
	Document how the compiler handles `pragma import' declarations.

tests/hard_coded/Mmakefile:
tests/hard_coded/pragma_import.m:
tests/hard_coded/pragma_import.exp:
	Add some test cases for `pragma import'.
1998-01-09 11:56:29 +00:00