Commit Graph

517 Commits

Author SHA1 Message Date
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
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
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
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
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
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
247b1c24b9 Fix various invasions of the user's namespace by `mercury_builtin.m',
Estimated hours taken: 6

Fix various invasions of the user's namespace by `mercury_builtin.m',
by splitting mercury_builtin.m into two modules, called builtin.m and
private_builtin.m, and ensuring that the latter is imported as if
by `:- use_module' rather than `:- import_module'.

library/builtin.m:
library/private_builtin.m:
	Split mercury_builtin.m into two modules, builtin.m,
	which contains stuff intended to be public,
	and private_builtin.m, which contains implementation
	details that are not supposed to be public.

library/mercury_builtin.m:
	Add a comment saying that this module is no longer used, and
	should eventually be removed.  I have not removed it yet, since
	that would prevent bootstrapping with the current compiler.  It
	will be removed as a seperate change later, once all the
	changes have propagated.

compiler/prog_util.m:
	Change the definition of mercury_private_builtin_module/1 and
	mercury_public_builtin_module so that instead of automatically
	importing mercury_builtin.m as if by `import_module', the
	copiler will now automatically import builtin.m as if by
	`import_module' and private_builtin.m as if by `use_module'.

compiler/polymorphism.m:
	Change a call to mercury_private_builtin_module/1 for
	unsafe_promise_unique to instead call mercury_public_builtin_module/1.

compiler/unify_proc.m:
	Avoid hard-coding "mercury_builtin" by instead
	calling one of  mercury_{private,public}_builtin_module/1.

runtime/mercury_type_info.[ch]:
library/term.m:
library/std_util.m:
compiler/code_util.m:
	Change a few hard-coded instances of "mercury_builtin"
	to "builtin" or "private_builtin" as appropriate.

runtime/mercury_trace_util.c:
runtime/mercury_trace_internal.c:
library/prolog.m:
compiler/*.m:
	Update comments that refer to "mercury_builtin" to instead
	refer to either "builtin" or "private_builtin".

doc/Mmakefile:
	Don't include the interface to private_builtin.m in the
	library reference manual.

tools/bootcheck:
	Add `-p'/`--copy-profiler' option.  This is needed to get
	the above changes to bootstrap.

tools/test_mercury:
	Pass `-p' to tools/bootcheck.

tests/term/*.trans_opt_exp:
	s/mercury_builtin/builtin/g
1998-05-25 21:55:28 +00:00
Fergus Henderson
ef70f68916 Change the existing test case for memory profiling so that it
Estimated hours taken: 0.25

tools/test_mercury:
tests/benchmark/poly.mprof-exp:
	Change the existing test case for memory profiling so that it
	actually checks the profile output, rather than just testing
	that the profile can be created.
1998-05-25 07:50:52 +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
Fergus Henderson
469fddf17c Use more newlines in the test case source so that the test
Estimated hours taken: 0.1

tests/invalid/typeclass_test_2.m:
tests/invalid/typeclass_test_2.err_exp:
	Use more newlines in the test case source so that the test
	that the error message is on the correct line number is more
	stringent.
1998-05-18 08:54:49 +00:00
Fergus Henderson
ced8c9b3ff Update the error message about invalid `--trace' arguments
Estimated hours taken: 0.25

compiler/handle_options.m:
	Update the error message about invalid `--trace' arguments
	to reflect the new names.

tests/debugger/Mmakefile:
	Change `--trace full' to `--trace all'
	to reflect the new names for `--trace' arguments.
1998-05-18 02:05:11 +00:00
Fergus Henderson
0470b29931 Disable the dnf' test case, since it uses tabling (pragma memo')
Estimated hours taken: 0.1

tests/general/Mmakefile:
	Disable the `dnf' test case, since it uses tabling (`pragma memo')
	which isn't implemented in non-gc grades yet.
1998-05-16 15:53:04 +00:00
Zoltan Somogyi
d10af74168 This change introduces interface tracing, and makes it possible to successfully
Estimated hours taken: 50

This change introduces interface tracing, and makes it possible to successfully
bootstrap the compiler with tracing (either interface or full).

compiler/options.m:
	Change the bool options --generate-trace into a string option --trace
	with three valid values: minimal, interface and full. The last two mean
	what they say; the intention is that eventually minimal will mean
	no tracing in non-tracing grades and interface tracing in tracing
	grades.

compiler/globals.m:
	Add a new global for the trace level.

compiler/handle_options.m:
	Convert the argument of --trace to a trace level.

	Use only consistent 4-space indentation in the deeply nested
	if-then-else.

compiler/trace.m:
	Implement interface tracing.

	Rename trace__generate_depth_reset_code as trace__prepare_for_call,
	since it does more than reset the depth if this module is compiled
	with interface tracing.

	Do not check whether tracing is enabled before calling MR_trace;
	let MR_trace make the check. This trades increased non-tracing
	execution time for a substantial code size reduction (which may
	in turn benefit execution time).

compiler/call_gen.m:
	Call trace__generate_depth_reset_code by its new name.

compiler/code_info.m:
	Fix a bug in the handling of non/semi commits. When entering a commit,
	we used to push a clone of whatever the top failure continuation was.
	However, the resume setup for this continuation could have started
	with a label that assumed that the resume vars were in their original
	locations (which are often registers), whereas the method of
	backtracking to that point only guarantees the survival of stack slots,
	not registers.

	(This bug caused two lines of incorrect code to be generated among
	the approx 30 million lines of code in the stage 2 compiler when
	compiled with tracing.)

	Fix another bug (previously untriggered as far as I know) in the
	handling of multi/det commits. This one was breaking the invariant
	that the resume vars set of each entry on the failure continuation
	stack included the resume vars set of every other entry below it,
	which meant that the values of these resume vars were not guaranteed
	to be preserved.

compiler/stack_layout.m:
	Make layout structures local to their module. They are not (yet)
	referred to by name from other modules, and by declaring them
	to be global we caused their names to be included even in stripped
	executables, adding several megabytes to the size of the binary.
	(The names are not stripped because a dynamically linked library
	may want to refer to them.)

	Change the mercury_data__stack_layout__ prefix on the names of
	generated globals vars to just mercury_data__layout__. It is now
	merely too long instead of far too long.

	Include the label number in the label layout structure and the number
	of typeinfo variables in a var_info structure only with native gc.
	Their only use is in debugging native gc.

	Fix some documentation rot.

compiler/llds.m:
	Add a new field to the pragma_c instruction that says whether the
	compiler-generated C code fragments access any stack variables.

compiler/frameopt.m:
	Use the new field in pragma_c's to avoid a bug. Because frameopt was
	assuming that the pragma_c instruction that filled in the stack slots
	containing the call sequence number and depth did not access the stack,
	it moved the pragma_c before the incr_sp that allocates the frame
	(it was trying to get it out of the loop).

compiler/*.m:
	Minor changes to set or ignore the extra field in pragma_c, to refer
	to layout structures via the new prefix, or to handle the --trace
	option.

doc/user_guide.texi:
	Update the documentation for --trace.

runtime/mercury_types.h:
	Add the type Unsigned.

runtime/mercury_goto.h:
	Use the shorter layout prefix.

runtime/mercury_stack_layout.h:
	Use the shorter layout prefix, and include the label number only with
	native gc.

runtime/mercury_trace.[ch]:
runtime/mercury_trace_internal.[ch]:
runtime/mercury_trace_external.[ch]:
runtime/mercury_trace_util.[ch]:
	Divide the old mercury_trace.[ch] into several components, with one
	module for the internal debugger, one for the interface to the
	external debugger, one for utilities needed by both. Mercury_trace.c
	now has only the top-level stuff that steers between the two
	debuggers.

runtime/mercury_trace.[ch]:
	Add the new global variable MR_trace_from_full. Before each call,
	the calling procedure assigns TRUE to this variable if the caller
	is fully traced, and FALSE otherwise. Interface traced procedures
	generate trace events only if this variable is TRUE when they are
	called (fully traced callee procedures ignore the initial value of
	the variable).

	Make MR_trace return immediately without doing anything unless
	tracing is enabled and a new extra argument to MR_trace is TRUE.
	This extra argument is always TRUE for trace events in fully traced
	procedures, while for trace events from interface traced procedures,
	its value is set from the value of MR_trace_from_full at the time
	that the procedure was called (i.e. the event is ignored unless the
	interface traced procedure was called from a fully traced procedure).

runtime/mercury_trace.[ch]:
runtime/mercury_trace_internal.[ch]:
	For global variables that are stored in stack slots, make their type
	Word rather than int.

	Use a new function MR_trace_event_report instead of calling
	MR_trace_event with a NULL command structure pointer to indicate
	that the event is to be reported but there is to be no user
	interaction.

	Use %ld formats in printfs and casts to long for better portability.

runtime/mercury_trace_internal.c:
	Save trace-related globals across calls to Mercury library code
	in the debugger, since otherwise any trace events in this code
	could screw up e.g. the event number or the call number sequence.

	Create separate functions for printing port names and determinisms.

runtime/mercury_wrapper.h:
	Disable the tracing of the initialization and finalization code
	written in Mercury.

runtime/Mmakefile:
	Update for the new source and header files.

tests/debugger/{debugger_regs,interpreter,queens}_lib.{m,inp,exp}:
	One new copy of each existing test case. These ones are intended
	to be used when the stage 2 library is compiled with tracing, which
	affects the tests by adding events for the library procedures called
	from the test programs.

	The .m files are the same as before; one of the .inp files is a bit
	different; the .exp files reflect the correct output when the library
	is compiled with full tracing.

tests/debugger/Mmakefile:
	Provide separate targets for the new set of test cases.

	Use --trace full instead of --generate-trace.

tests/debugger/runtests:
	Try both the new set of test cases if the old set fails, and report
	failure only if both sets fail. This is simpler than trying to figure
	out which set should be really tested, and the probability of a false
	positive is negligible.
1998-05-16 07:31:33 +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
Fergus Henderson
f3b7548ac4 Fix a problem reported by Baudouin Le Charlier <ble@info.fundp.ac.be>
where switch detection was getting confused by explicit existential
quantifications.

compiler/switch_detection.m:
	When detecting switches, traverse through some/2 goals.
	Also simplify the code a bit.

tests/valid/Mmakefile:
tests/valid/some_switch.m:
	Regression test for the above change.
1998-05-12 17:05:06 +00:00
Fergus Henderson
49c25842cf Fix a problem reported by Baudouin Le Charlier <ble@info.fundp.ac.be>
where switch detection was getting confused by explicit existential
quantifications.

compiler/switch_detection.m:
	When detecting switches, traverse through some/2 goals.
	Also simplify the code a bit.

tests/valid/Mmakefile:
tests/valid/some_switch.m:
	Regression test for the above change.
1998-05-12 17:05:04 +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
Fergus Henderson
91386b16f1 Update the expected output for the pretty_print_test
Estimated hours taken: 0.5

tests/misc_tests/Mmakefile:
tests/misc_tests/pretty_print_test.exp:
	Update the expected output for the pretty_print_test
	test case to reflect the actual output, and re-enable
	that test case.  Arguably the extra parentheses in
	the output are undesirable, but they're needed to
	protect against the parser getting confused by
	the relative precedence of `:' and `/' for
	module-qualified symbols (e.g. in `.int' files).
	Also arguably the precedence of `:' is wrong,
	but it's probably not worth fixing this now since
	we plan to replace `:' with `.'.

	Also change the rule for `clean_ugly' to avoid hard-coding
	the path name `/bin/rm' and to instead use just `rm'.
	In some environments (e.g. Windows with gnu-win32),
	`rm' might not be in `/bin'.
1998-04-27 11:07:54 +00:00
Zoltan Somogyi
33a8e6e05a Remove .ugly files as part of the clean rule.
Estimated hours taken: 2

Mmakefile:
	Remove .ugly files as part of the clean rule. Without this,
	the .ugly file does not get remade, and the test is useless
	(it does not invoke the compiler at all).

	Temporarily disable the test (pretty_print_test) that uses a
	.ugly file, since it does not work.
1998-04-27 08:49:46 +00:00
Simon Taylor
75354e38bb Deforestation.
Estimated hours taken: 400

Deforestation.

This increases the code size of the compiler by ~80k when compiling
with --intermodule-optimization --deforestation.

The improvement from deforestation is not measurable for mmc -C make_hlds.m.
Compile time for make_hlds.m increased from 50.7 seconds to 52.2 seconds
when running deforestation.

compiler/simplify.m
compiler/common.m
	Provide a nicer interface for simplifying a goal,
	not an entire procedure.
	Rework the interface to avoid manipulating lots of booleans.
	Return an estimate of the improvement in cost from simplification.
	Remove failing cases and disjuncts.
	Add an option to optimize common structures even across calls.
	Remove code to merge branched goals, since that is now
	done by deforestation.

	Fix a bug: the code to collect instmap_deltas for cases was not
	including the switched-on variable in the instmap_delta,
	which caused an abort in merge_instmap_delta if the switched
	on variable was further instantiated in the switch.
	This came up while compiling the compiler with --deforestation.

compiler/det_report.
	Output duplicate call warnings even if --warn-simple-code is not set.
	XXX fix the same problem with `:- pragma obsolete'.

compiler/code_aux.m
	Update code_aux__cannot_loop to use termination information.

compiler/hlds_pred.m
compiler/dnf.m
	Pass the type_info_varmap and typeclass_info_varmap
	into hlds_pred__define_new_pred.
	Restrict the variables of the new procedure onto the variables
	of the goal.
	Make sure all relevant type_infos are passed into the new
	procedure if --typeinfo-liveness is set.

compiler/modes.m
compiler/unique_modes.m
compiler/mode_info.m
compiler/modecheck_unify.m
	Put `how_to_check_goal' into the mode_info, rather
	than passing it around.
	Add a field to the `check_unique_modes' case which
	controls whether unique modes is allowed to choose
	a different procedure. For deforestation, this is
	not allowed, since it could result in choosing a less
	efficient procedure after generalisation.

compiler/options.m
	New options:
	--deforestation
	--deforestation-depth-limit
		Safety net for termination of the algorithm.
	--deforestation-cost-factor
		Fudge factor for working out whether deforestation
		was worthwhile.
	--deforestation-vars-threshold
		Like --inline-vars-threshold.
	Enable deforestation at -O3.

	Removed an unnecessary mode for option_defaults_2, since it
	resulted in a warning about disjuncts which cannot succeed.

compiler/handle_options.m
	--no-reorder-conj implies --no-deforestation.

compiler/inlining.m
	Separate code to rename goals into inlining__do_inline_call.

compiler/hlds_goal.m
	Added predicates goal_list_nonlocals, goal_list_instmap_delta
	and goal_list_determinism to approximate information about
	conjunctions.

compiler/hlds_module.m
	Added module_info_set_pred_proc_info to put an updated
	pred_info and proc_info back into the module_info.

compiler/hlds_out.m
	Exported hlds_out__write_instmap for debugging of deforestation.
	Bracket module names on constructors where necessary.

compiler/mercury_compile.m
	Call deforestation.
	Use the new interface to simplify.m.

compiler/intermod.m
	Put recursive predicates with a top-level branched goal
	into `.opt' files.

goal_util.m
	Added goal_calls_pred_id to work out if a predicate is
	recursive before mode analysis.
	Export goal_util__goals_goal_vars for use by deforestation.
	Give a better message for a missing variable in a substitution.

compiler/instmap.m
	Give a better message for inst_merge failing.

compiler/notes/compiler_design.m
	Document the new modules.

library/varset.m
	Add varset__select to project a varset's names and values
	onto a set of variables.

doc/user_guide.texi
	Document deforestation.
	Remove a reference to a non-existent option, --no-specialize.

util/mdemangle.c
profiler/demangle.m
tests/misc_tests/mdemangle_test.{exp,inp}
	Handle the `DeforestationIn__' predicate names introduced by
	deforestation, similar to the `IntroducedFrom__' for lambda goals.

New files:

deforest.m	Deforestation.
pd_cost.m	Cost estimation.
pd_debug.m	Debugging output.
pd_info.m	State type and version control.
pd_term.m	Termination checking.
pd_util.m	Utility predicates
1998-04-27 04:05:12 +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
Zoltan Somogyi
5cdc719376 Include EXTRA_MCFLAGS in MCFLAGS, instead of just overriding
Estimated hours taken: 0.1

tests/debugger/Mmakefile:
	Include EXTRA_MCFLAGS in MCFLAGS, instead of just overriding
	MCFLAGS totally.
1998-04-23 09:22:03 +00:00
Zoltan Somogyi
61aa3c96e9 Update the expected output of the usage message after Fergus's
Estimated hours taken: 0.5

tests/debugger/interpreter.exp:
	Update the expected output of the usage message after Fergus's
	changes last week.
1998-04-23 09:21:03 +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
Bert Thompson
c52faca450 Added tests for library/rational.m
Estimated hours taken: 1

Added tests for library/rational.m


general/rational_test.m:
	Test module for library/rational.m.
general/rational_test.exp:
	Expected output of test.
general/Mmakefile:
	Added rational_test.
general/.cvsignore:
	Added rational_test.
1998-04-16 07:20:18 +00:00
Bert Thompson
8109f07cb3 Added simple tests for library/integer.m.
Estimated hours taken: 0.5

Added simple tests for library/integer.m.


general/integer_test.m:
	Added tests for library/integer.m, the big integer module.
general/integer_test.exp:
	Expected output.
general/Mmakefile:
	Added integer_test.
general/.cvsignore:
	Added integer_test.
1998-04-15 08:14:05 +00:00
Fergus Henderson
7f261f912b A few more improvements to type class checking.
Estimated hours taken: 4

A few more improvements to type class checking.

compiler/typecheck.m:
	Ensure that we run a final pass of context reduction at the
	end of typechecking each predicate (or function).

	Change the way perform_context_reduction recovers after errors
	to avoid reporting the same error more than once
	(e.g. for tests/invalid/typeclass_test_2.m).

	Simplify the code to check for and report unsatisfied
	type class constraints.

	Change write_type_assign so that it prints out the
	type class constraints as well as the variable types.

tests/invalid/typeclass_test_*.err_exp:
	Add a full stop that was missing at the end of
	the "unsatisfied typeclass constraint" error message.
1998-04-09 18:33:13 +00:00
Fergus Henderson
40f7fad627 Fix some code rot in the rules for `make clean';
Estimated hours taken: 0.5

Makefile:
tests/valid/Mmakefile:
tests/invalid/Mmakefile:
	Fix some code rot in the rules for `make clean';
	amoung other things, change them so that they
	handle `--use-subdirs' correctly.
1998-04-09 03:59:12 +00:00
Zoltan Somogyi
67d8308260 Same as previous message. 1998-04-08 11:36:13 +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
345a9e7946 Ignore executables created for recently added test cases.
Estimated hours taken: 0.05

tests/general/.cvsignore:
	Ignore executables created for recently added test cases.
1998-04-02 11:24:11 +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
5653ad9190 Change a hard-coded test for `$file.o' so that it will
Estimated hours taken: 0.25

tests/valid/runtests:
tests/valid/Mmakefile:
	Change a hard-coded test for `$file.o' so that it will
	work with --use-subdirs.
1998-03-30 13:25:05 +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
Andrew Bromage
9d58fa5725 relation__rtc was just plain broken. Rather than try to fix an
Estimated hours taken: 3

relation__rtc was just plain broken.  Rather than try to fix an
algorithm which I pulled out of an obscure paper some years ago, it's
now replaced with a slightly less efficient algorithm which is much
easier to understand.

library/relation.m:
	Changes detailed above.

tests/Makefile:
tests/rtc_bug.m:
tests/rtc_bug.exp:
	Test case for the above change.

tests/relation_test.m:
tests/relation_test.exp:
	Change in output format to make debugging easier.
1998-03-26 00:43:41 +00:00
Fergus Henderson
570b4baa76 Invoke `mmake depend'.
Estimated hours taken: 0.25

tests/invalid/runtests:
	Invoke `mmake depend'.

tests/term/runtests:
	Delete the `set -x', which was just there for debugging,
	since it just makes the output harder to read.
1998-03-20 04:25:15 +00:00
Fergus Henderson
7ebc79e927 Fix some problems with the `--use-subdirs' option.
Estimated hours taken: 6

Fix some problems with the `--use-subdirs' option.
The compiler itself now compiles and bootstraps fine with --use-subdirs.

compiler/modules.m:
	Put `.h' files in the source directory, rather than
	in the `Mercury/hs' subdirectory.

compiler/mercury_compile.m:
scripts/Mmake.rules:
	If `--use-subdirs' is enabled, pass `-I.' to the C compiler,
	so that #include statements work relative to the source directory
	rather than relative to the `Mercury/cs' subdirectory.

scripts/Mmake.vars.in:
	Define $(cs_subdir), $(os_subdir) etc. variables;
	these are set to the directory to use for .c, .o, etc. files,
	(including the trailing `/'), or to the empty string,
	if --use-subdirs is not set.

scripts/Mmake.rules:
	Use $(cs_subdir), $(os_subdir) etc. to avoid the code
	duplication created by my previous change to handle
	--use-subdirs.
	Also add lots of comments, and reorder the code
	in a more logical order.

Mmakefile:
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
tests/term/Mmakefile:
tests/valid/Mmakefile:
	Use $(cs_subdir), $(os_subdir) etc. to fix a few hard-coded
	file-names (e.g. *.dep, *_init.[co], tree234.o) that were
	used in some of the rules.

library/Mmakefile:
	Add `rm -f tags' to the rule for `mmake realclean'.

tools/bootcheck:
	Add `--use-subdirs' option (defaults to setting of the
	MMAKE_USE_SUBDIRS environment variable).
	Change the code which compares the stage2 & stage3 C files
	to use the appropriate location for them based on the
	setting of this option.
1998-03-20 02:58:33 +00:00
Fergus Henderson
f4caf49a15 Fix a limitation of the current nested module support:
Estimated hours taken: 4

Fix a limitation of the current nested module support:
ensure that we check for attempts to import inaccessible modules.

compiler/modules.m:
	Check for attempts to import inaccessible modules
	(modules whose parent has not been imported,
	or for which there is no `include_module'
	declaration in the parent's interface).

compiler/intermod.m:
	Modify the way we import `.opt' files.  The previous method
	temporarily set the items field of the module_imports
	structure to [], but check_module_accessibility relies
	on the assumption that the items field contains the
	items for all modules previously read in.

tests/invalid/Mmakefile:
tests/invalid/test_nested.m:
tests/invalid/test_nested.err_exp:
tests/invalid/parent.m:
tests/invalid/parent.private_child.m:
tests/invalid/parent.public_child.m:
tests/invalid/parent.undeclared_child.m:
tests/invalid/parent.undeclared_child.err_exp:
tests/invalid/parent2.m:
tests/invalid/parent2.child.m:
	Add some tests for the above change.

doc/reference_manual.texi:
	Update the "bugs and limitations" sub-section of the modules
	chapter to reflect the new status quo.
1998-03-18 17:31:08 +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
f3aa40d62c Add a test case for an old bug: the case where
Estimated hours taken: 0.25

tests/invalid/Mmakefile:
tests/invalid/type_inf_loop.m:
tests/invalid/type_inf_loop.err_exp:
	Add a test case for an old bug: the case where
	type inference leads to an infinite loop.
1998-03-18 10:22:14 +00:00
Fergus Henderson
7445bf79ca Update the expected debugger output to reflect my recent change
Estimated hours taken: 0.1

tests/misc_tests/debugger_test.exp:
	Update the expected debugger output to reflect my recent change
	to library/io.m which changed the way io__write prints out values
	of type `c_pointer'.
1998-03-12 21:33:01 +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
39472195ec Add new predicate relation__add_values.
Estimated hours taken: 2

library/relation.m:
	Add new predicate relation__add_values.
	Implement the previously commented-out predicates
	relation__from_assoc_list and relation__compose.
	Change relation__to_assoc_list so that it returns
	an assoc list of values rather than an assoc list
	of relation_keys.

NEWS:
	Document the above changes.

tests/general/Mmakefile:
tests/general/relation_test.m:
tests/general/relation_test.exp:
	Add a few tests of the relation module.
1998-03-12 21:11:30 +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