Commit Graph

5546 Commits

Author SHA1 Message Date
Zoltan Somogyi
09141817ba Fergus's recent change to the handling of some builtins broke the tracing
Estimated hours taken: 20

Fergus's recent change to the handling of some builtins broke the tracing
of those builtins. The following changes are a fix for this.

compiler/polymorphism.m:
	Export the predicate that checks whether a predicate is a builtin
	that lacks the usually necessary typeinfos.

	Comment out a misleading and in any case not very useful progress
	message.

compiler/liveness.m:
	Turn off type_info liveness for builtins without typeinfos.
	Since these builtins establish no gc points and shouldn't be
	execution traced, this is OK.

	Make type_info liveness part of live_info, since it can now be
	incorrect to look up the value of the option. (This may yield
	a speedup.)

compiler/live_vars.m:
compiler/store_alloc.m:
	Pass the pred_id to initial_liveness to liveness.m can do the test.

compiler/passes_aux.m:
	Add a new traversal type that passes along the pred_id.

compiler/mercury_compile.m:
	Turn off execution tracing for the modules builtin.m and
	private_builtin.m. The latter contains the interface predicates
	for the builtins without typeinfos. Since the interface predicates
	also lack the typeinfos, the compiler would get an internal abort
	if we left execution tracing on.

	In any case, these two modules contain stuff that users should
	consider language builtins, which means they should not be execution
	traced (they can still be stack traced in the right grade).

	Use the new traversal type for the modules that now need the pred_id.

compiler/globals.m:
	Allow the trace level to be set from outside, in this case
	mercury_compile.m.

The next batch of changes have to do with adding a stack dump command
to the debugger. Since debugging is possible even in non-debug grades,
this in turn requires allowing stack tracing to work in non-debug grades,
on programs in which only some modules are compiled with execution
(and hence stack) tracing.

compiler/llds_out.m:
compiler/mercury_compile.m:
runtime/mercury_conf_param.h:
	Llds_out used to output "#include <mercury_imp.h>" as the first
	substantive thing in the generated C file. The set of #define
	parameters in effect when mercury_imp.h is processed determines
	whether the macros that optionally register stack layouts for label
	actually do so or not. The values of these parameters are derived
	from the grade, which means that with this setup it is not possible
	for a non-debug grade program to register its stack layouts in the
	label table.

	The new version of llds_out looks up the option that says whether
	this module is compiled with execution tracing or not, and if it is,
	it generates a #define MR_STACK_TRACE_THIS_MODULE *before* the #include
	of mercury_imp.h. This causes mercury_conf_param.h, included from
	mercury_imp.h, to define the macros MR_USE_STACK_LAYOUTS and
	and MR_INSERT_LABELS, which in turn cause stack layouts for labels
	in this module to be generated and to be inserted into the label
	table, *without* changing the grade string (this last part is why
	we do not simply define MR_STACK_TRACE).

	Use the same mechanism to #include mercury_trace.h when doing
	execution tracing, since it is simpler than the mechanism we
	used to use (mercury_compile.m including the #include in a list
	of C header file fragments).

compiler/mercury_compile.m:
runtime/mercury_conf_param.h:
	Split the MR_NEED_INITIALIZATION_CODE macro into two parts.
	The first, MR_MAY_NEED_INITIALIZATION, now controls whether
	initialization code makes it into the object file of a module.
	The second, MR_NEED_INITIALIZATION_AT_START, determines whether
	the initialization code is called before main/2.

	When a module is compiled with execution tracing, the macro
	MR_INSERT_LABELS turns on MR_MAY_NEED_INITIALIZATION but not
	MR_NEED_INITIALIZATION_AT_START. The debugger will make sure
	that the initialization code has been called before it tries
	to do a stack dump (which needs the initialization code to have
	been executed, because it needs labels to have been put into the label
	table so that from a return address it can find the layout of the
	proc to which it belongs).

	Define MR_NEED_INITIALIZATION_AT_START if PROFILE_TIME is defined,
	since if PROFILE_TIME is defined mercury_wrapper.c calls init_modules.
	The fact that MR_NEED_INITIALIZATION_CODE didn't used to be defined
	when PROFILE_TIME was defined was, I believe, a bug, which was
	not detected because we do not turn on PROFILE_TIME without also
	turning on PROFILE_CALLS.

runtime/mercury_stack_trace.[ch]:
	Change the way stack dumps are done, to make it possible to
	print stack dumps from the debugger and to use trivial run-length
	encoding on the output (so that 100 consecutive calls to p
	yield the line "p * 100", rather than 100 lines of "p").

	The stack routine now returns an indication of whether the stack dump
	was fully successful, and if not, a description of the reason why not.
	This requires knowing when we have found the end of the stack dump,
	so we provide a global variable, MR_stack_trace_bottom, which
	mercury_wrapper.c will set to global_success, the address main/2
	goes to on success.

	s/multidet/multi/

runtime/mercury_wrapper.c:
	Set MR_stack_trace_bottom to the address of globals_success.
	Use MR_NEED_INITIALIZATION_AT_START to decide whether to call
	do_init_modules.

runtime/mercury_stacks.h:
	Provide variants of detstackvar(n) and framevar(n) that look up sp and
	curfr in an array of saved regs, for use by the debugger.

runtime/mercury_trace_util.c:
	Use the new variants of detstackvar(n) and framevar(n). This fixes
	an old bug on SPARCs.

runtime/mercury_trace_internal.c:
	Completely reorganize the way debugger commands are handled.
	Centralize reading in command lines, and the breaking up of command
	lines into words. The command names are the same as they were,
	but command syntax is now much easier to change.

	Add a new command "d" to dump as much of the stack as the available
	information will allow.

runtime/mercury_goto.h:
	Cosmetic changes to avoid the use of two different conditional
	compilation layout styles.

util/mkinit.c:
	Since we cannot know when we generate the _init.c file whether any
	modules will be compiled with execution tracing and will thus need
	stack tracing, we must now include in the generated _init.c file the
	code to call the initialization functions in all the modules, even if
	MR_NEED_INITIALIZATION_AT_START is not set, since init_modules
	can be called later, from the debugger. (We should be able to
	use the same approach with the accurate collector.)
1998-06-08 08:29:17 +00:00
Zoltan Somogyi
af6f18ab3f Fergus's recent change to the handling of some builtins broke the tracing
Estimated hours taken: 20

Fergus's recent change to the handling of some builtins broke the tracing
of those builtins. The following changes are a fix for this.

compiler/polymorphism.m:
	Export the predicate that checks whether a predicate is a builtin
	that lacks the usually necessary typeinfos.

	Comment out a misleading and in any case not very useful progress
	message.

compiler/liveness.m:
	Turn off type_info liveness for builtins without typeinfos.
	Since these builtins establish no gc points and shouldn't be
	execution traced, this is OK.

	Make type_info liveness part of live_info, since it can now be
	incorrect to look up the value of the option. (This may yield
	a speedup.)

compiler/live_vars.m:
compiler/store_alloc.m:
	Pass the pred_id to initial_liveness to liveness.m can do the test.

compiler/passes_aux.m:
	Add a new traversal type that passes along the pred_id.

compiler/mercury_compile.m:
	Turn off execution tracing for the modules builtin.m and
	private_builtin.m. The latter contains the interface predicates
	for the builtins without typeinfos. Since the interface predicates
	also lack the typeinfos, the compiler would get an internal abort
	if we left execution tracing on.

	In any case, these two modules contain stuff that users should
	consider language builtins, which means they should not be execution
	traced (they can still be stack traced in the right grade).

	Use the new traversal type for the modules that now need the pred_id.

compiler/globals.m:
	Allow the trace level to be set from outside, in this case
	mercury_compile.m.

The next batch of changes have to do with adding a stack dump command
to the debugger. Since debugging is possible even in non-debug grades,
this in turn requires allowing stack tracing to work in non-debug grades,
on programs in which only some modules are compiled with execution
(and hence stack) tracing.

compiler/llds_out.m:
compiler/mercury_compile.m:
runtime/mercury_conf_param.h:
	Llds_out used to output "#include <mercury_imp.h>" as the first
	substantive thing in the generated C file. The set of #define
	parameters in effect when mercury_imp.h is processed determines
	whether the macros that optionally register stack layouts for label
	actually do so or not. The values of these parameters are derived
	from the grade, which means that with this setup it is not possible
	for a non-debug grade program to register its stack layouts in the
	label table.

	The new version of llds_out looks up the option that says whether
	this module is compiled with execution tracing or not, and if it is,
	it generates a #define MR_STACK_TRACE_THIS_MODULE *before* the #include
	of mercury_imp.h. This causes mercury_conf_param.h, included from
	mercury_imp.h, to define the macros MR_USE_STACK_LAYOUTS and
	and MR_INSERT_LABELS, which in turn cause stack layouts for labels
	in this module to be generated and to be inserted into the label
	table, *without* changing the grade string (this last part is why
	we do not simply define MR_STACK_TRACE).

	Use the same mechanism to #include mercury_trace.h when doing
	execution tracing, since it is simpler than the mechanism we
	used to use (mercury_compile.m including the #include in a list
	of C header file fragments).

compiler/mercury_compile.m:
runtime/mercury_conf_param.h:
	Split the MR_NEED_INITIALIZATION_CODE macro into two parts.
	The first, MR_MAY_NEED_INITIALIZATION, now controls whether
	initialization code makes it into the object file of a module.
	The second, MR_NEED_INITIALIZATION_AT_START, determines whether
	the initialization code is called before main/2.

	When a module is compiled with execution tracing, the macro
	MR_INSERT_LABELS turns on MR_MAY_NEED_INITIALIZATION but not
	MR_NEED_INITIALIZATION_AT_START. The debugger will make sure
	that the initialization code has been called before it tries
	to do a stack dump (which needs the initialization code to have
	been executed, because it needs labels to have been put into the label
	table so that from a return address it can find the layout of the
	proc to which it belongs).

	Define MR_NEED_INITIALIZATION_AT_START if PROFILE_TIME is defined,
	since if PROFILE_TIME is defined mercury_wrapper.c calls init_modules.
	The fact that MR_NEED_INITIALIZATION_CODE didn't used to be defined
	when PROFILE_TIME was defined was, I believe, a bug, which was
	not detected because we do not turn on PROFILE_TIME without also
	turning on PROFILE_CALLS.

runtime/mercury_stack_trace.[ch]:
	Change the way stack dumps are done, to make it possible to
	print stack dumps from the debugger and to use trivial run-length
	encoding on the output (so that 100 consecutive calls to p
	yield the line "p * 100", rather than 100 lines of "p").

	The stack routine now returns an indication of whether the stack dump
	was fully successful, and if not, a description of the reason why not.
	This requires knowing when we have found the end of the stack dump,
	so we provide a global variable, MR_stack_trace_bottom, which
	mercury_wrapper.c will set to global_success, the address main/2
	goes to on success.

	s/multidet/multi/

runtime/mercury_wrapper.c:
	Set MR_stack_trace_bottom to the address of globals_success.
	Use MR_NEED_INITIALIZATION_AT_START to decide whether to call
	do_init_modules.

runtime/mercury_stacks.h:
	Provide variants of detstackvar(n) and framevar(n) that look up sp and
	curfr in an array of saved regs, for use by the debugger.

runtime/mercury_trace_util.c:
	Use the new variants of detstackvar(n) and framevar(n). This fixes
	an old bug on SPARCs.

runtime/mercury_trace_internal.c:
	Completely reorganize the way debugger commands are handled.
	Centralize reading in command lines, and the breaking up of command
	lines into words. The command names are the same as they were,
	but command syntax is now much easier to change.

	Add a new command "d" to dump as much of the stack as the available
	information will allow.

runtime/mercury_goto.h:
	Cosmetic changes to avoid the use of two different conditional
	compilation layout styles.

util/mkinit.c:
	Since we cannot know when we generate the _init.c file whether any
	modules will be compiled with execution tracing and will thus need
	stack tracing, we must now include in the generated _init.c file the
	code to call the initialization functions in all the modules, even if
	MR_NEED_INITIALIZATION_AT_START is not set, since init_modules
	can be called later, from the debugger. (We should be able to
	use the same approach with the accurate collector.)
1998-06-08 08:27:15 +00:00
David Jeffery
1b0472461c Disable the often erroneous "optimisation" in check_typeclass.m whereby we
Estimated hours taken: 3

Disable the often erroneous "optimisation" in check_typeclass.m whereby we
skipped the level of indirection for instance methods if there was an exact
match for the types, modes and determinisms of the instance method.
Consequently rip out lots of useless stuff from check_typeclass.m.

Also, for methods which are functions, introduce unifications for the body
rather than calls.

Also improve a couple of error messages slightly.

compiler/check_typeclass.m:
        Disable the "optimisation".
1998-06-08 07:46:59 +00:00
Fergus Henderson
aeb0f440b1 Add rules for mmake clean' and mmake realclean'
Estimated hours taken: 0.25

extras/trailed_update/Mmakefile:
	Add rules for `mmake clean' and `mmake realclean'
	which invoke the respective targets in the subdirectories.
	This should hopefully avoid some failures in the
	trailed_update/tests subdirectory caught by the nightly test
	script that were due to trying to rebuild in a different grade
	without having done `mmake clean' in that subdirectory.
1998-06-06 11:18:24 +00:00
Fergus Henderson
861e1caf91 Allow tests to pass if the output matches either the .err_exp
Estimated hours taken: 0.25

tests/invalid/Mmakefile:
	Allow tests to pass if the output matches either the .err_exp
	file or the .err_exp2 file (if any).

tests/invalid/missing_interface_import.err_exp2:
	Add an alternative expected output for this test case,
	since the output is different depending on whether
	or not it gets compiled with --use-subdirs.
1998-06-06 11:09:58 +00:00
Fergus Henderson
151b4e9176 Fix an error in my previous change that I accidentally
Estimated hours taken: 0.5

compiler/mercury_compile.m:
	Fix an error in my previous change that I accidentally
	introduced while merging in stayl's changes.
1998-06-05 09:12:07 +00:00
Tyson Dowd
6aae47194a Remove temporary files after running tests.
Estimated hours taken: 0.5

Remove temporary files after running tests.

tools/run_all_tests_from_cron:
	Remove /tmp/test_mercury$$ after testing is finished.
1998-06-05 04:01:02 +00:00
Fergus Henderson
fdc28ddd56 Improve the modularity of the code in purity.m by splitting it into two
Estimated hours taken: 2

Improve the modularity of the code in purity.m by splitting it into two
modules and fix a purity-related bug by moving some code from typecheck.m
into the new module.

compiler/post_typecheck.m:
	New module.  Handles the typechecking stuff that happens
	after typecheck.m.

compiler/purity.m:
	Move the typechecking related code in purity.m into post_typecheck.m.

compiler/typecheck.m:
	Move the code for copying clauses to the proc_infos, etc. into
	new predicates in post_typecheck.m.  This code is now called
	from purity.m rather than from typecheck.m.
	(I think the fact that it was being done in typecheck.m was a
	bug -- it meant that the goal_info flags computed by purity.m
	were not being copied across to the proc_infos.)

compiler/mercury_compile.m:
compiler/typecheck.m:
	Don't pass the ModeError parameter down to typecheck_pred,
	since with the above change it isn't needed anymore.

compiler/mercury_compile.m:
	Run purity checking before writing the `.opt' files.
	This is necessary because writing out the `.opt' files
	requires that code in post_typecheck__finish_pred
	(formerly in typecheck.m) has been run.

compiler/notes/compiler_design.html:
	Document these changes.
1998-06-04 17:26:23 +00:00
Fergus Henderson
40cb95e75a Fix a small mistake in my previous change which resulted in some
Estimated hours taken: 0.1

util/mkinit.c:
	Fix a small mistake in my previous change which resulted in some
	compiler warnings.
1998-06-04 11:50:11 +00:00
Simon Taylor
99ae820a1d Document that -I options may need to be added to MGNUCFLAGS if
Estimated hours taken: 0.25

doc/user/guide.texi
	Document that -I options may need to be added to MGNUCFLAGS if
	inter-module optimization is being used on a library which
	uses the C interface.
1998-06-04 01:03:12 +00:00
Simon Taylor
11f13832cb Back out the addition of --intermod-unused-args to the
Estimated hours taken: 0.1

tools/test_mercury
	Back out the addition of --intermod-unused-args to the
	optimization flags on murlibobo until the installed compiler
	contains the bug fixes I committed yesterday.
1998-06-03 22:57:33 +00:00
Peter Ross
fc1ce8cf47 Another --use-subdirs bug fix when using sicstus.
Estimated hours taken: 3

Another --use-subdirs bug fix when using sicstus.

scripts/msl.in:
    Detect the special case file 'sp_lib.ql' even when the file name has
    leading directory info.

    Also update the copyright notice.
1998-06-03 01:32:25 +00:00
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
Tyson Dowd
3046c9a627 Cleanup deep copy.
Estimated hours taken: 4

Cleanup deep copy.

runtime/mercury_deep_copy.c:
	Use MR_categorize_data, and switch on the result.

	This makes the control flow much simpler -- each case only needs
	to worry about copying the data.
	We can also use fallthru to exploit duplicated code.

	Remove get_base_type_layout_entry, it isn't very useful.

runtime/mercury_type_info.c:
runtime/mercury_type_info.h:
	Define MR_categorize_data and the enum MR_DataRepresentation.

	MR_categorize_data can be used by any function that needs to
	manipulate data.
1998-06-02 05:34:46 +00:00
Tyson Dowd
ff5ff5869c Cleanup deep copy.
Estimated hours taken: 4

Cleanup deep copy.

runtime/mercury_deep_copy.c:
	Use MR_categorize_data, and switch on the result.

	This makes the control flow much simpler -- each case only needs
	to worry about copying the data.
	We can also use fallthru to exploit duplicated code.

	Remove get_base_type_layout_entry, it isn't very useful.

runtime/mercury_type_info.c:
runtime/mercury_type_info.h:
	Define MR_categorize_data and the enum MR_DataRepresentation.

	MR_categorize_data can be used by any function that needs to
	manipulate data.
1998-06-02 05:34:42 +00:00
Fergus Henderson
7370e9117d Fix some bugs in code generation for nondet disjunctions and
Estimated hours taken: 4.5

Fix some bugs in code generation for nondet disjunctions and
if-then-elses.  The compiler was incorrectly releasing the temp stack
slots used to save the heap pointer and trail pointer at the start
of the else or the last clauses, thus allowing them to be reused not
only in the else case or the last clause, but also by goals following the
disjunction or if-then-else, even though the values in these slots might
be needed again on backtracking into the condition or the earlier
disjunctions.

Thanks to Warwick Harvey for reporting this bug.

compiler/code_info.m:
	Add new predicate `code_info__maybe_reset_and_pop_ticket',
	which is like `code_info__maybe_reset_and_discard_ticket',
	except that it does not release the temp stack slot.

compiler/disj_gen.m:
compiler/ite_gen.m:
	When generating code for nondet goals that save
	and restore the hp and trail, if the saved
	values might be needed again on backtracking
	into the current goal from one that follows
	(i.e. in nondet disjunctions and in if-then-elses
	with nondet conditions), make sure we use
	`code_info__maybe_reset_and_pop_ticket' and
	`code_info__reset_hp' instead of
	`code_info__maybe_reset_and_discard_ticket' and
	`code_info__reset_and_discard_hp'.

compiler/code_info.m:
	Include the temp_avail_slots in the set of things
	that slap_code_info does not update.  Temp slots
	that were acquired (and not released) in one branch
	of a branched goal need to be still reserved at the
	end of the branched goal.

extras/trailed_update/Mmakefile:
extras/trailed_update/samples/Mmakefile:
extras/trailed_update/samples/tests.m:
extras/trailed_update/samples/tests.exp:
extras/trailed_update/tests/Mmakefile:
extras/trailed_update/tests/var_test.m:
extras/trailed_update/tests/var_test.exp:
	Add a new subdirectory `tests' in extras/trailed_update,
	and move the test case `tests.{m,exp}' from the samples
	subdirectory into the tests subdirectory, at the same
	time renaming it as `var_test.{m,exp}'.

extras/trailed_update/tests/Mmakefile:
extras/trailed_update/tests/func_trail_test.m:
extras/trailed_update/tests/func_trail_test.exp:
extras/trailed_update/tests/func_trail_test_2.m:
extras/trailed_update/tests/func_trail_test_2.exp:
	Add a couple of regression tests for the bug mentioned above.
	These tests need to go here rather than somewhere in the
	main `tests' directory (e.g. `tests/hard_coded'), because
	they only work in trailing grades, and the normal tests are
	compiled in lots of grades, many of which don't have
	corresponding trailing grades installed.
	(I suppose we could put them in the main `tests' directory,
	and only enable them for trailing grades, but it just seemed
	easier to put them here.)
1998-06-02 05:32:26 +00:00
Peter Ross
051f701baa Allow prolog version of the compiler to be built.
Estimated hours taken: 0.1

Allow prolog version of the compiler to be built.

library/string.nu.nl:
    Add missing definition of string__from_rev_char_list
1998-06-01 23:54:44 +00:00
Peter Ross
fefb6e1202 Find the sp_builtin.ql file.
Estimated hours taken: 0.01


library/Mmakefile:
    Find the sp_builtin.ql file.
1998-06-01 06:55:13 +00:00
Zoltan Somogyi
5ba5148f17 Test for the presence of a builtin.o file instead of mercury_builtin.o.
Estimated hours taken: 0.1

tools/binary:
	Test for the presence of a builtin.o file instead of mercury_builtin.o.

	Clarify the documentation a bit.
1998-06-01 06:14:58 +00:00
Fergus Henderson
111ba0a31e Add a missing $(deps_subdir) before a reference to library.dep,
Estimated hours taken: 0.1

Mmakefile:
	Add a missing $(deps_subdir) before a reference to library.dep,
	so that it works with --use-subdirs.
	It already had the $(dep_subdir) in front of all the
	references to compiler.dep and profiler.dep, I had just
	accidentally missed on occurrence for library.dep.
1998-06-01 01:28:14 +00:00
Fergus Henderson
f20cd077ad Update some obsolete documentation.
Estimated hours taken: 0.1

compiler/unique_modes.m:
	Update some obsolete documentation.
1998-06-01 00:22:25 +00:00
Fergus Henderson
d3c21c0d6a Pass the value of the --use-subdirs option down to
Estimated hours taken: 0.25

tools/bootcheck:
	Pass the value of the --use-subdirs option down to
	subprocesses via the MMAKE_USE_SUBDIRS environment variable.
	This ensures that `tools/bootcheck --use-subdirs' actually
	uses `--use-subdirs' when building the stage2 and stage3
	compilers and when running the test suite.
1998-06-01 00:20:08 +00:00
Fergus Henderson
2f13721c61 A minor correction to my previous change.
Estimated hours taken: 0.1

doc/user_guide.texi.texi:
	A minor correction to my previous change.
1998-06-01 00:12:03 +00:00
Fergus Henderson
9e86dc7c2e Delete a stray tab that caused problems with older versions
Estimated hours taken: 0.1

library/Mmakefile:
        Delete a stray tab that caused problems with older versions
	of GNU Make.  (Thanks to Warwick Harvey for reporting this bug.)
1998-06-01 00:08:15 +00:00
Fergus Henderson
971e6c348d Fix a cut-and-paste bug reported by Dan Hazel
Estimated hours taken: 0.1

library/math.m:
	Fix a cut-and-paste bug reported by Dan Hazel
	<d.hazel@mailbox.uq.edu.au>: Mercury's acos/1 was
	calling C's asin() instead of acos().
1998-05-31 22:19:09 +00:00
Tyson Dowd
b80d41c0c2 Remove the libc6 detection routines. It appears the new upstream version
Estimated hours taken: 1

Remove the libc6 detection routines.  It appears the new upstream version
of Boehm GC handles this correctly now.

README.Linux:
	Remove mention of the problem - it shouldn't happen anymore.

configure.in:
	Remove the old mercury_boehm_gc

boehm_gc/os_dep.c:
	Use the upstream method for checking for libc version using
	__GLIBC__.

boehm_gc/mercury_boehm_gc_conf.h.in:
	Remove this file, it is no longer necessary.
1998-05-31 03:59:09 +00:00
Tyson Dowd
1089333882 Remove the libc6 detection routines. It appears the new upstream version
Estimated hours taken: 1

Remove the libc6 detection routines.  It appears the new upstream version
of Boehm GC handles this correctly now.

README.Linux:
	Remove mention of the problem - it shouldn't happen anymore.

configure.in:
	Remove the old mercury_boehm_gc

boehm_gc/os_dep.c:
	Use the upstream method for checking for libc version using
	__GLIBC__.

boehm_gc/mercury_boehm_gc_conf.h.in:
	Remove this file, it is no longer necessary.
1998-05-31 03:59:07 +00:00
Fergus Henderson
03d0b154bd Fix typo in previous change (missing "@samp").
Estimated hours taken: 0.1

doc/reference_manual.texi:
	Fix typo in previous change (missing "@samp").
1998-05-30 19:32:08 +00:00
Fergus Henderson
f326c7bb46 Update the expected profile output to reflect the split of
Estimated hours taken: 0.25

tests/benchmarks/poly.mprof-exp:
	Update the expected profile output to reflect the split of
	mercury_builtin.m into builtin.m and private_builtin.m.
1998-05-30 15:29:27 +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
38ae5fe0c5 Fix a bug which caused link errors in some grades for some test cases
Estimated hours taken: 1

Fix a bug which caused link errors in some grades for some test cases
where the module name wasn't the same as the file name, and which
probably would have caused runtime errors in some grades for test
cases using nested modules.

compiler/modules.m:
	Call $(C2INIT) with $(foo.cs) instead of $(foo.ms).
	This is necessary now that a single .m file can get compiled
	to multiple .c files, if it contains nested modules,
	or to a .c file whose name reflects the module name rather
	than the source file name.

util/mkinit.c:
scripts/c2init.in:
	For efficiency, change c2init and mkinit so that when c2init's
	arguments are `.c' files, it computes the init function based
	on the filename (like it used to do with `.m' files), rather
	than by reading the file contents and searching for "** INIT"
	comments.  Add a new option `-x' (`--extra-inits') which keeps
	the old behaviour.

compiler/modules.m:
scripts/Mmake.rules:
	Instead of deleting the `_init.c' file every time we recreate
	the `.dep' file, just tell make that the `_init.c' file depends on
	the `.dep' file, so that make will remake it if the `.dep' file
	changes.  (I don't know why I didn't do it that way in the
	first place.)
1998-05-30 13:34:17 +00:00
Fergus Henderson
19ed0e5a32 Avoid spurious warning messages about source file
Estimated hours taken: 0.1

compiler/prog_io.m:
	Avoid spurious warning messages about source file
	`bar.m' containing module `foo:bar' -- this case
	is supported, and should not trigger a warning.
1998-05-30 12:25:45 +00:00
Fergus Henderson
ae9150f1a1 Use sub-modules to package up the modules in extras/complex_numbers
Estimated hours taken: 0.25

Use sub-modules to package up the modules in extras/complex_numbers
into a single module.

extras/complex_numbers/complex_numbers.m:
	I forgot to `cvs add' this file before committing my last change.

extras/complex_numbers/samples/fft.m:
	I forgot to change the `import_module' declaration here
	to import `complex_numbers:complex' instead of `complex'.
1998-05-30 12:10:19 +00:00
Fergus Henderson
7ccca98b18 Put library files and `.init' files in the current directory,
Estimated hours taken: 1

compiler/modules.m:
	Put library files and `.init' files in the current directory,
	rather than in Mercury/libs and Mercury/inits subdirectories,
	even if `--use-subdirs' is enabled.
	Without this change, the instructions on "Using libraries"
	in the Mercury user's guide did not work in conjunction with
	`--use-subdirs', and they, as well as a lot of Mmakefiles that
	were defined based on them, would need to be changed.
1998-05-30 07:38:12 +00:00
Fergus Henderson
a40f49ce99 Delete some stuff accidentally duplicated in my previous change.
Estimated hours taken: 0.1

NEWS:
	Delete some stuff accidentally duplicated in my previous change.
	Add some documentation for `--use-subdirs'.
1998-05-29 21:41:55 +00:00
Fergus Henderson
306ed77dd5 Fix a typo.
Estimated hours taken: 0.1

scripts/mmake.in:
	Fix a typo.
1998-05-29 21:30:20 +00:00
Fergus Henderson
7e450a4a81 Add URL for Kostis's thesis.
Estimated hours taken: 0.25

doc/reference_manual.texi:
	Add URL for Kostis's thesis.
1998-05-29 19:29:09 +00:00
Fergus Henderson
d23f11ac33 Use sub-modules to package up the modules in extras/complex_numbers
Estimated hours taken: 0.75

Use sub-modules to package up the modules in extras/complex_numbers
into a single module.

extras/complex_numbers/complex_lib.m:
extras/complex_numbers/complex_numbers.m:
	Rename complex_lib.m as complex_numbers.m,
	and modify it to use sub-modules.

extras/complex_numbers/*.m:
extras/complex_numbers/tests/complex_test.m:
extras/complex_numbers/samples/fft.m:
	Add `complex_numbers:' to all of the `:- module'
	and `:- import_module' declarations.

extras/complex_numbers/Mmakefile:
extras/complex_numbers/tests/Mmakefile:
extras/complex_numbers/samples/Mmakefile:
	Modify to reflect the renaming from `complex_lib' to
	`complex_numbers'.
1998-05-29 09:08:43 +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
e880e3ac59 Allow modules to be put in source files whose names do not directly match
Estimated hours taken: 12

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:50:57 +00:00
Fergus Henderson
c578810748 Improve the efficiency of code added in my previous change,
Estimated hours taken: 0.25

scripts/mmake.in:
	Improve the efficiency of code added in my previous change,
	as suggested by zs: avoid using `...`.
1998-05-29 07:53:37 +00:00
Fergus Henderson
587f0a3233 If the current directory contains a `Mercury' subdirectory,
Estimated hours taken: 0.5

scripts/mmake.in:
	If the current directory contains a `Mercury' subdirectory,
	then enable `--use-subdirs' by default.
1998-05-29 04:27:18 +00:00
Fergus Henderson
ea5d21a93a Update the GNU make bug work-around so that it creates the `date3s'
Estimated hours taken: 0.25

scripts/Mmake.rules:
	Update the GNU make bug work-around so that it creates the `date3s'
	directory as well as the other `*date*' directories when doing
	`mmake depend'.  Previously, the *.int3 files never depended on
	anything else (they were always the first thing created), so this
	wasn't necessary.  However, with nested modules, the `.int3'
	files for sub-modules depends on the `.int3' file for the parent
	module, so we now need to create the `date3s' directory too.
1998-05-29 04:20:32 +00:00
Fergus Henderson
c153253129 Fix a bug in my previous change: s/$NF/NF/ in awk script.
Estimated hours taken: 0.25

tools/test_mercury:
	Fix a bug in my previous change: s/$NF/NF/ in awk script.
1998-05-29 01:10:40 +00:00
Fergus Henderson
b372b47380 s/mercury_builtin/builtin/
Estimated hours taken: 0.25

tests/general/parse_list.m:
tests/general/semidet_map.m:
	s/mercury_builtin/builtin/
1998-05-28 14:29:46 +00:00
Fergus Henderson
6f3f7b0575 Add missing `#include' of "mercury_trace.h", needed
Estimated hours taken: 0.1

library/require.m:
	Add missing `#include' of "mercury_trace.h", needed
	for MR_trace_report().
1998-05-28 11:13:59 +00:00
Fergus Henderson
e6a7d952f6 Use MMAKEFLAGS=-jN' instead of -jN' when doing a make
Estimated hours taken: 0.1

tools/bootcheck:
	Use `MMAKEFLAGS=-jN' instead of `-jN' when doing a make
	at the top level of the stage2 directory.
1998-05-28 10:08:08 +00:00
Fergus Henderson
20b22d468f Fix typo: s/main/mail/
Estimated hours taken: 0.01

tools/run_all_test_from_cron:
	Fix typo: s/main/mail/
1998-05-27 23:33:46 +00:00
Fergus Henderson
c7800c6e15 Some minor changes to get things to work on hydra.cs.mu.oz.au.
Estimated hours taken: 0.25

tools/test_mercury:
tools/run_all_test_from_cron:
	Some minor changes to get things to work on hydra.cs.mu.oz.au.
1998-05-27 21:49:18 +00:00
Fergus Henderson
a4393bb6ab Some minor changes to get things to work on hydra.cs.mu.oz.au.
Estimated hours taken: 0.25

tools/test_mercury:
tools/run_all_test_from_cron:
	Some minor changes to get things to work on hydra.cs.mu.oz.au.
1998-05-27 21:49:16 +00:00