Commit Graph

74 Commits

Author SHA1 Message Date
Peter Wang
ac796041e5 Support :- initialise and :- finalise predicates in the Erlang backend.
Estimated hours taken: 12
Branches: main

Support :- initialise and :- finalise predicates in the Erlang backend.

compiler/compile_target_code.m:
	Refactor the code relating to running mkinit to generate .init and
	_init.c files, and compiling _init.c files.

	Generalise the code so that it can call mkinit_erl with the right
	options.

compiler/dead_proc_elim.m:
	Add initialisation and finalisation predicates to the queue at the
	start of the pass so that they won't be eliminated.  For the C
	backends we implicitly :- foreign_export init and final preds so they
	would never be eliminated, but we don't do that in the Erlang
	backend.

compiler/elds.m:
	Extend the ELDS to hold pred_proc_ids of init/final preds.

compiler/erl_code_gen.m:
compiler/mercury_compile.m:
	Conform to change in ELDS.

compiler/elds_to_erlang.m:
	Output mercury__required_init and mercury__required_final functions
	which call user initialisation and finalisation predicates, if any.

	Write out -export annotations for those functions.

	Write out REQUIRED_INIT and REQUIRED_FINAL directives for those
	functions.

compiler/hlds_module.m:
compiler/make_hlds_passes.m:
	Remember the arity of init/final preds in the HLDS, not just the
	sym_name.

	Add predicates to return the pred_proc_ids of init/final preds.

	Delete module_info_user_init_pred_c_name and
	module_info_user_final_pred_c_name as they are unused.

compiler/make.program_target.m:
	Call make_erlang_program_init_file and make_erlang_library_init_file
	when building an Erlang executable or library, respectively.

	Install a .init file when installing an Erlang library.

	Conform to changes in compile_target_code.m.

compiler/modules.m:
	In module_name_to_file_name, treat extensions specially if they end
	".erl" and ".beam", not only if they are exactly those strings.  This
	is because we may pass "_init.erl" or "_init.beam" as the extension.

compiler/options.m:
	Add an option `--mkinit-erl-command'.

util/Mmakefile:
util/.cvsignore:
util/mkinit_erl.c:
	Add `mkinit_erl' program which is a modified version of `mkinit'.

util/mkinit.c:
util/mkinit_common.c:
util/mkinit_common.h:
	Factor out code common to mkinit and mkinit_erl into mkinit_common.c
	and mkinit_common.h.

tests/hard_coded/Mmakefile:
	Fix misspellings of "MERCURY_SUPPRESS_STACK_TRACE".

tests/hard_coded/impure_init_and_final.m:
	Add Erlang foreign proc.
2007-06-08 00:47:52 +00:00
Peter Wang
35e3621c1a Add support for :- external procedures to the Erlang backend.
Estimated hours taken: 25
Branches: main

Add support for :- external procedures to the Erlang backend.

Add Erlang support to mmc --make.

compiler/elds.m:
	Extend the ELDS for definitions of external procedures.

compiler/elds_to_erlang.m:
	Move the logic for mapping a module name to a file name into
	module_name_to_file_name, as it is needed for mmc --make as well.

	Similarly move erlang_module_name to modules.m.

	Output export annotations for :- external procedures which are
	exported.

	Conform to changes in the ELDS.

compiler/erl_call_gen.m:
	Don't generate assignment statements between variables of dummy types.

compiler/erl_code_gen.m:
	Generate skeleton ELDS definitions for external procedures.

	Fix more cases where success expressions could be inserted after
	`erroneous' goals.  The Erlang compiler would complain about unbound
	variables appearing in success expressions following erroneous goals,
	because it doesn't know that the erroneous goal would throw an
	exception.

	Handle some special cases with `erroneous' and `failure' goals where we
	used to generate code that the Erlang compiler would complain about
	references to unbound variables, or variables being bound in one branch
	of a conditional statement but not another, etc.

	- handle a special case where the goal inside a commit scope has
	determinism `failure', i.e. it would never actually commit;

	- handle a special case where the condition of an if-then-else is
	`erroneous', so the Then branch can't be reached;

	- handle a special case where a disjunct has determinism `failure',
	so later disjuncts will always be evaluated.

	Generate code for promise_solutions and exist_quant scopes.

	Wrap large success expressions in closures instead of duplicating them
	into each disjunct, in the same way that we do for switches.

	Disable duplicating of small success expressions into branches of
	switches and disjunctions for now, as the implmentation is buggy.

compiler/handle_options.m:
	Remove the LLDS and MLDS options from the grade_component_table entry
	for the "erlang" grade.  They caused compute_grade to return "none" if
	only --target erlang was used (because --target erlang didn't imply the
	same set of meaningless options).

compiler/hlds_pred.m:
	Fix the implementations of `status_is_exported' and
	`status_defined_in_this_module' for external procedures.

compiler/compile_target_code.m:
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/modules.m:
	Add Erlang support to mmc --make.  It can build "libraries" (we just
	use directories called libFOO.beams containing Erlang .beam bytecode
	files), install them and executables (which are just shell scripts
	which invoke the Erlang runtime system).

	Refactor some code and fix a few assumptions in places that we were
	building for the C backends.

	Replace some calls to io.remove_file by io.remove_file_recursively as
	our Erlang "libraries" are actually directories.

	Unrelated bugfix: for mmc --make --use-grade-subdirs foo.realclean,
	remove the symlink created for foo.init in the current directory.

	Delete module_name_to_file_name_sep as it is no longer used.

compiler/options.m:
	Add options --erlang-interpreter, --erlang-object-file-extension
	adn --install-command-dir-option.

doc/user_guide.texi:
	Document --install-command-dir-option.

tests/mmc_make/Mmakefile:
	Generate TEST_FLAGS *after* start_runtests_local as
	start_runtests_local runs make realclean_local, which deletes
	TEST_FLAGS.

library/io.m:
	Add io.remove_file_recursively which can remove non-empty directories.

	Fix the fallback implmentation io.buffer_to_string which was calling a
	non-existent `from_char_list_semidet' predicate.

NEWS:
	Mention io.remove_file_recursively.
2007-05-30 05:15:08 +00:00
Julien Fischer
9958d3883c Fix some formatting.
Estimated hours taken: 0
Branches: main

Fix some formatting.

compiler/distance_granularity.m:
compiler/exception_analysis.m:
compiler/implicit_parallelism.m:
compiler/inst_graph.m:
compiler/interval.m:
compiler/layout_out.m:
compiler/lp_rational.m:
compiler/make.program_target.m:
compiler/modules.m:
compiler/prog_data.m:
compiler/purity.m:
compiler/recompilation.check.m:
compiler/term_constr_data.m:
compiler/term_util.m:
compiler/xml_documentation.m:
deep_profiler/mdprof_cgi.m:
library/pqueue.m:
profiler/output.m:
	Fix the positioning of commas.

	s/[_|_]/[_ | _]/ in a spot.
2007-05-23 10:09:24 +00:00
Julien Fischer
5c740803a5 Remove redundant uniqueness promises from the compiler.
Estimated hours taken: 0.5
Branches: main

Remove redundant uniqueness promises from the compiler.  These have
been unnecessary since the globals field in the I/O state was made
non-unique.

compiler/globals.m:
compiler/handle_options.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/source_file_map.m:
	Delete unnecessary uniqueness promises and the odd unique mode.

util/.cvsignore:
	Unrelated change: ignore pad_backslash.
2007-05-07 06:59:24 +00:00
Peter Wang
637c76926d Add some preliminary infrastructure for an HLDS->Erlang code generator.
Estimated hours take: 4
Branches: main

Add some preliminary infrastructure for an HLDS->Erlang code generator.

compiler/globals.m:
compiler/options.m:
        Recognise "erlang" as a valid compilation target.

        Add new options: `--erlang' and `--erlang-only' as synonyms
        for `--target erlang' and `--target erlang --target-code-only'.
        XXX the new options are currently undocumented.

compiler/hlds_data.m:
compiler/prog_data.m:
compiler/prog_io_pragma.m:
	Recognise "Erlang" as a valid language for foreign code.

compiler/handle_options.m:
	For erlang targets, set the gc_method to automatic and disable
	optimize_constructor_last_call.

compiler/add_pragma.m:
compiler/add_type.m:
compiler/code_gen.m:
compiler/compile_target_code.m:
compiler/export.m:
compiler/foreign.m:
compiler/granularity.m:
compiler/intermod.m:
compiler/llds_out.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile.m:
compiler/mercury_to_mercury.m:
compiler/ml_code_gen.m:
compiler/ml_optimize.m:
compiler/ml_switch_gen.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_java.m:
compiler/modules.m:
compiler/pragma_c_gen.m:
compiler/prog_foreign.m:
compiler/simplify.m:
	Conform to the above changes.
2007-05-07 05:21:36 +00:00
Simon Taylor
71254a467d When building a .clean' or .realclean' target, only report
Estimated hours taken: 0.5
Branches: main

compiler/make.util.m:
compiler/make.*.m:
        When building a `.clean' or `.realclean' target, only report
        individual files being removed when `--very-verbose' is set,
        not `--verbose-make'.

        Still report each file when cleaning up the target files after
        an interrupted build.
2007-05-02 04:45:05 +00:00
Peter Wang
d22708e657 Extend parallel mmc --make support.
Branches: main

Extend parallel mmc --make support.

compiler/make.program_target.m:
	Allow the target code and object code steps to be done in parallel.
	Force all interface files to be made before the Mercury -> target code
	step.  This prevents a problem when two parallel branches try to
	generate the same missing interface file later.

	Allow intermodule analysis to proceed in parallel, i.e. building
	`.analysis' files.  Ensure that all interface files are made before the
	analysis step also.
2007-04-18 06:27:58 +00:00
Peter Wang
f5c1523c76 When using mmc --make --use-grade-subdirs, don't make a symlink or copy of
Branches: main

When using mmc --make --use-grade-subdirs, don't make a symlink or copy of
the target file to the user directory if the file in the user directory is
already up to date.  This avoids bumping the timestamp unnecessarily.

compiler/compile_target_code.m:
	Make post_link_make_symlink_or_copy check the timestamp of the file
	in the user directory and do nothing if it is the same as the
	timestamp of the file to be linked/copied.

	Add an output argument to post_link_make_symlink_or_copy to indicate
	if the symlink/copy was made.

compiler/make.program_target.m:
	Make build_linked_target_2 only write a "Made symlink/copy of ..."
	message if the symlink/copy is actually made by
	post_link_make_symlink_or_copy.

	Also make it warn in the case that there is nothing for mmc --make to
	do.  This was previously the case only for --no-use-grade-subdirs.

compiler/make.util.m:
	Change maybe_symlink_or_copy_linked_target_message to write "Made
	symlink/copy ..." rather than "Making symlink/copy ..." as the
	message is now written after the fact.
2007-04-11 04:21:59 +00:00
Peter Wang
20bca5c8e5 Add initial support for parallel make functionality in `mmc --make', using
Branches: main

Add initial support for parallel make functionality in `mmc --make', using
Mercury threads (not processes).  Currently this is limited to running the
"compile target code to object code" step in parallel.

configure.in:
	Require that the bootstrap compiler support the `thread_local'
	attribute on mutables.

compiler/globals.m:
	Use a thread-local mutable to hold the compiler's globals instead of
	the globals facility in the io module.

	Make the `extra_error_info' mutable thread-local.

compiler/options.m:
doc/user_guide.texi:
	Add a `--jobs <n>' option, with shorthand '-j <n>'.

compiler/make.util.m:
	Add a `foldl2_maybe_stop_at_error_maybe_parallel' predicate which is
	like `foldl2_maybe_stop_at_error' but capable of running tasks in
	parallel depending on the `--jobs' option.

compiler/make.program_target.m:
	Use `foldl2_maybe_stop_at_error_maybe_parallel' for the "target code to
	object code" step.

library/io.m:
	Make the current input/output streams thread-local in C grades.  This
	uses the same underlying mechanisms as thread-local mutables.  Direct
	references to the current stream variables are replaced by calls to
	functions which work with the thread-local current streams instead.

	Add a mutex and locking predicates to protect the stream_db structure.
	Mark `get_stream_db' and `set_stream_db' as thread-safe and protect
	calls to those predicates with the locking predicates.

	Rename the impure version of `get_stream_db' to
	`get_stream_db_with_locking' and make it acquire and release the
	stream_db mutex.

	Add a mutex to protect the `ML_next_stream_id' counter.

	Add a note about a thread-safety problem in `io.get_system_error'.

	Mark `io.call_system_code' as `thread_safe'.

library/list.m:
	Add the predicate `list.split_upto', which is to `list.split_list' as
	`list.take_upto' is to `list.take'.

library/stream.string_writer.m:
	Conform to the renaming of the impure `io.get_stream_db'.

library/thread.m:
	Add a predicate `can_spawn', which succeeds if `spawn' is supported in
	the current grade.

NEWS:
	Announce parallel make support.

	Announce `list.split_upto' and 'thread.can_spawn'.
2007-02-13 00:16:57 +00:00
Julien Fischer
74b6457c51 Add some preliminary infrastructure for the LLDS->x86_64 assembler
Estimated hours taken: 2
Branches: main

Add some preliminary infrastructure for the LLDS->x86_64 assembler
code generator that Fransiska is working on.

compiler/globals.m:
compiler/options.m:
compiler/handle_options.m:
compiler/mercury_compile.m:
	Recognise "x86_64" as a valid compilation target.

	Add new options: `--x86_64' and `--x86_64-only' as synonyms
	for `--target x86_64' and `--target x86_64 --target-code-only'.

	In the backend passes for the lowlevel backend branch
	appropriately depending on whether we are generating C or
	x86_64 assembler.

compiler/foreign.m:
compiler/prog_foreign.m:
	When compiling to x86_64 assembler use C as the preferred foreign
	language.

compiler/mlds.m:
compiler/ml_code_gen.m:
compiler/ml_optimize.m:
compiler/ml_switch_gen.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds_to_c.m:
	Handle "x86_64" as a target in the MLDS backend.  This does
	(and should) cause a compiler abort since "x86_64" is intended
	to be an MLDS target language.

compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/modules.m:
	Add placeholders for --target x86_64 in the build systems.

compiler/make_hlds_passes.m.
	We don't currently support mutables with --target x86_64.

compiler/simplify.m:
	We don't currently support runtime conditions on trace goals
	with --target x86_64.

compiler/add_type.m:
compiler/compile_target_code.m:
compiler/granularity.m:
compiler/intermod.m:
	Conform to the above changes.
2007-01-08 03:03:15 +00:00
Peter Wang
952c089277 Fix behaviour when a library grade installation is interrupted.
Estimated hours taken: 1
Branches: main

compiler/make.program_target.m:
	Fix behaviour when a library grade installation is interrupted.
	It used to clean the default grade instead of the grade that was
	interrupted.
2006-12-05 02:51:21 +00:00
Julien Fischer
26de67a4c4 Remove support for non-grade specific .init files.
Estimated hours taken: 0.5
Branches: main

Remove support for non-grade specific .init files.

browser/Mmakefile:
runtime/Mmakefile:
scripts/Mmake.rules:
compiler/make.program_target.m:
	Don't install the .init files in the non-grade specific location.
2006-12-04 01:33:29 +00:00
Peter Wang
33661e34f9 Don't remove grade-dependent files after installing a library with
Estimated hours taken: 0.5
Branches: main

compiler/make.program_target.m:
	Don't remove grade-dependent files after installing a library with
	`mmc --make' if `--use-grade-subdirs' is used.
2006-12-04 01:09:53 +00:00
Julien Fischer
b4c3bb1387 Clean up in unused module imports in the Mercury system detected
Estimated hours taken: 3
Branches: main

Clean up in unused module imports in the Mercury system detected
by --warn-unused-imports.

analysis/*.m:
browser/*.m:
deep_profiler/*.m:
compiler/*.m:
library/*.m:
mdbcomp/*.m:
profiler/*.m:
slice/*.m:
	Remove unused module imports.

	Fix some minor departures from our coding standards.

analysis/Mercury.options:
browser/Mercury.options:
deep_profiler/Mercury.options:
compiler/Mercury.options:
library/Mercury.options:
mdbcomp/Mercury.options:
profiler/Mercury.options:
slice/Mercury.options:
	Set --no-warn-unused-imports for those modules that are used as
	packages or otherwise break --warn-unused-imports, e.g. because they
	contain predicates with both foreign and Mercury clauses and some of
	the imports only depend on the latter.
2006-12-01 15:04:40 +00:00
Julien Fischer
92683e18c8 Being integrating the recently add `--make-xml-doc' functionality into
Estimated hours taken: 1.5
Branches: main

Being integrating the recently add `--make-xml-doc' functionality into
mmc --make.  This will remain undocumented until the documentation system
has been developed further.

compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
	Add support for a .doc target that builds files containg the XML
	representation of the local modules reachable from a specified
	target, e.g.  `mmc --make mer_std.doc' could be used to generate
	XML files for the standard library modules.

compiler/modules.m:
	Delete some leftover Aditi stuff.

	Remove residual support for generating .h files (instead of .mh
	or .mih files).

	Fix the formatting of some comments.

compiler/xml_documentation.m:
	Put the .xml files in Mercury/xmls if we are compiling if
	--use-subdirs is enabled.
2006-11-23 06:10:50 +00:00
Julien Fischer
3ace02fd26 A side effect of the introduction of trace goals is that .init files are
Estimated hours taken: 10
Branches: main

A side effect of the introduction of trace goals is that .init files are
now grade dependent.  Consider a module that contains the following
trace goal:

	trace [ compile_time(grade(debug)),
		run_time(env("FOO"))
	] (
		...
	),

In a debug grade the .init file for a library containing that module will
include the following directive:

	ENVVAR FOO

In a non-debug grade it won't.  At the moment which version of the .init
file is actually installed depends upon which grade was the first to
be built.  This can result in linker errors if the wrong grade is used
with the wrong .init file.

There are two possible fixes.  (1) always output ENVVAR directives
regardless of whether the compile time conditions of the trace goals to
which they are attached are true or not.  (2) build grade specific .init
files and install them in grade specific locations.

The following diff implements the first stage of (2).  For each grade in
which a library is to be installed we create a grade specific .init file
and then install it in a grade specific location, e.g.
`$(INSTALL_PREFIX)/lib/mercury/modules/<grade>'.  (For bootstrapping
purposes .init files are currently still installed in the old location
as well.)

After this change has been installed on our machines I will add the
second part of this change which modifies the compiler to look for the
.init files in the new grade specific locations.  The final part of the
change will then remove support for installing .init files in the old
location.)

scripts/Mmake.vars.in:
	Add a variable that holds the name of a grade specific directory
	in which to install .init files.

scripts/Mmake.rules:
	Add a rule to install the .init files in a grade specific location.

browser/Mmakefile:
mdbcomp/Mmakefile:
runtime/Mmakefile:
	Change the dependencies on the library installation targets so
	that installing a library causes the .init files to be built and
	installed.
	(Currently this dependency is on the install target, which means
	that the install_init rule is only invoked once, rather than
	every time a grade is built.)

	Install the .init files for these libraries in grade specific
	locations.  (For bootstrapping purposes they are currently also
	installed in the old location.)

runtime/Mmakefile:
	Remove the code that deletes runtime.init if it exists.
	(Anyone who has a Mercury installation old enough for this to
	be a problem is going to encounter more serious problems than
	the runtime being initialized twice.)

	Unrelated change: remove some duplicate entries from the list
	of header files.

compiler/make.program_target.m:
	Have mmc --make install the .init files in a grade specific location.
	(They are also still installed in the old location.)

NOTE: the `XXX trace goal fix.' comments are placeholders for
things that need to be changed during the latter stages of this change.
2006-11-23 04:08:55 +00:00
Julien Fischer
4630fb9de7 Change the representation of some types used by mmc --make.
Estimated hours taken: 1
Branches: main

Change the representation of some types used by mmc --make.
Minor formatting and style cleanups for mmc --make.  There are no changes
to any algorithms.

compiler/make.m:
	Delete the compilation_task type; it is unused.

	Convert the target_file and linked_target_file types into
	du's with named fields.  This is nicer in mdb then pairs.

compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/options_file.m:
	Conform to the above changes.

	Make a bunch of minor formatting and style changes.

compiler/make.util.m:
	Add a predicate make_target_file_list required by the above.

compiler/inst_graph.m:
	Replace DCGs with state variables.

compiler/common.m:
	Fix some typos.
2006-11-23 04:03:43 +00:00
Julien Fischer
63d219d82d Fix a bug in mmc --make's handling of ranlib.
Estimated hours taken: 1.5
Branches: main, release

Fix a bug in mmc --make's handling of ranlib.

configure.in:
 	Set the value of RANLIBFLAGS.
 	On most systems it will be empty; on Mac OS X it needs to be set
 	to "-c".

 	Check that the installed compiler supports the `--ranlib-flags'
 	option.

compiler/make.program_target.m:
 	Fix the problem with the quoting in the command line used to
 	invoke ranlib on Mac OS X by using the recently introduced
 	`--ranlib-flags' option.

 	Remove the workaround for this bug.

scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
 	Set the default value of the `--ranlib-flags' option.

scripts/Mmake.vars.in:
scripts/Mmake.rules:
 	Have mmake conform to the new way of handling flags for
 	ranlib.
2006-11-15 08:12:56 +00:00
Julien Fischer
dc2a284ae8 Workaround a bug with mmc --make that shows up on Mac OS X.
Estimated hours taken: 1.5
Branches: main, release

Workaround a bug with mmc --make that shows up on Mac OS X.
Implement the first stage of a proper fix for this bug.

compiler/make.program_target.m:
 	Workaround a bug with the quoting of the command used to invoke
 	ranlib.

compiler/options.m:
 	Add a flag that for use as part of a proper fix for this
 	problem.  This will need to bootstrap before the rest of the
 	fix, changing the configuration files to use the flag, can be
 	added.
2006-11-01 05:49:59 +00:00
Julien Fischer
51f4f280fc Minor cleanups to some compiler modules.
Estimated hours taken: 0.2
Branches: main

Minor cleanups to some compiler modules.
There are no changes to any algorithms.

compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/mercury_compile.m:
	Convert some if-then-elses into switches.

	Don't ingore the error value returne by I/O operations
	in some places.

	Fix some comments.

	Other minor formatting changes.
2006-10-25 03:39:04 +00:00
Julien Fischer
6f841df921 Fix a bug with mmc --make and static libraries.
Estimated hours taken: 1
Branches: main, release

Fix a bug with mmc --make and static libraries.  We need to update the
archive index after copying the library to the installation directory.
The linker on Mac OS X complains if we don't do this.  This is also the
behaviour of mmake anyway, so mmc --make should do the same.

compiler/make.program_target.m:
	Rebuild the archive index after installing a static library.
2006-10-24 08:21:06 +00:00
Zoltan Somogyi
e21193c283 Rename a bunch of predicates and function symbols to eliminate
Estimated hours taken: 6
Branches: main

browser/*.m:
compiler/*.m:
	Rename a bunch of predicates and function symbols to eliminate
	ambiguities.

	The only real change is factoring out some common code in the mlds
	and llds code generators, replacing them with single definitions
	in switch_util.m.
2006-10-15 23:26:56 +00:00
Zoltan Somogyi
00741b0162 This diff contains no algorithmic changes.
Estimated hours taken: 6
Branches: main

This diff contains no algorithmic changes. It merely renames apart a bunch more
function symbols to reduce ambiguity.

After this diff, the summary line from the mdb command "ambiguity -f" is

	Total: 351 names used 975 times, maximum 31, average: 2.78

browser/*.m:
compiler/*.m:
	Rename function symbols to eliminate ambiguities.

tests/debugger/declarative/dependency.exp:
tests/debugger/declarative/dependency2.exp:
	Update the expected out where some internal function symbol names
	appear in the output of the debugger. (This output is meant for
	implementors only.)
2006-08-22 05:04:29 +00:00
Zoltan Somogyi
2b2f3d3cbe This diff contains no algorithmic changes.
Estimated hours taken: 8
Branches: main

This diff contains no algorithmic changes. It merely renames apart a bunch of
function symbols to reduce ambiguity. Basically I went through prog_data.m,
prog_item.m, hlds_data.m, hlds_goal.m and hlds_pred.m looking for type
definitions containing function symbol names that were either language
"keywords" (e.g. "terminates", which is an annotation on foreign_procs),
used with slightly different meanings in several types (e.g. "sym"),
or both (e.g. "call"). When I found such type definitions, I changed the
names of the function symbols, usually by adding a prefix or suffix
indicating the type to all function symbols of the type. For example,
the old function symbol "foreign_proc" in type "pragma_type" is now named
"pragma_foreign_proc", and the names of all other function symbols in that
type also start with "pragma_".

All of this should yield simpler compiler error messages when we make mistakes,
and will make it more likely that looking up a function symbol using a tags
file will take you to the actual definition of the relevant instance of that
function symbol. However, the most important benefit is the increase in
the readability of unfamiliar code; the reader won't have to emulate the
compiler's type ambiguity resolution algorithm (which in many cases used to
require distinguishing between f/14 and f/15 by counting the arguments,
e.g. for "pred_or_func").

compiler/prog_data.m:
compiler/prog_item.m:
compiler/hlds_data.m:
compiler/hlds_goal.m:
compiler/hlds_pred.m:
	Rename function symbols as explained above.

compiler/*.m:
	Conform to the function symbol renames.

	In some cases, rename other function symbols as well.

	Minor style fixes, e.g. replace if-then-elses with switches,
	or simple det predicates with functions.
2006-08-20 08:21:36 +00:00
Julien Fischer
aeeedd2c13 Standardize formatting of comments at the beginning of modules.
compiler/*.m:
	Standardize formatting of comments at the beginning of modules.
2006-07-31 08:32:11 +00:00
Zoltan Somogyi
74ce85d476 Provide a mechanism for collecting statistics about tabling operations,
Estimated hours taken: 60
Branches: main

Provide a mechanism for collecting statistics about tabling operations,
and provide a much more convenient mechanism for resetting tables.

Since it would too complex to do this while preserving the capability
of setting --tabling-via-extra-args to no, eliminate that capability
and the option. That option was useful only for measurements of the
performance boost from setting --tabling-via-extra-args to yes in any case,
so users lose no functionality.

Previously, the only way to debug the low level details of the tabling
mechanism was to build a runtime with a specific C macro (MR_TABLE_DEBUG)
and link with that runtime; this was cumbersome. Change that so that
every one of the debuggable tabling macros has a bool argument that says
whether debugging is enabled or not. The compiler can then set this to
MR_TRUE if the new option --table-debug is given, and to MR_FALSE otherwise.
If set to MR_FALSE, the C compiler should optimize away the debug code,
with zero impact on program size or speed.

Since these changes to macros require nontrivial bootstrapping, which we don't
want to do unnecessarily, modify the interface of the tabling macros as
required to support size limits on tables. This diff also implements the
parsing of size limit specifications on tables, but does not implement them
yet; that is for a future change.

To make the syntax simpler, this diff deletes the free-standing fast_loose_memo
pragma. The same functionality is now available with a fast_loose annotation
on an ordinary memo pragma.

Make a bunch of changes to improve readability and maintainability
in the process. These mostly take the form of renaming ambiguous and/or
not sufficiently expressive function symbols.

runtime/mercury_stack_layout.h:
runtime/mercury_tabling.h:
	Move the description of structure of tables from mercury_stack_layout.h
	to mercury_tabling.h, since we now need it for statistics even if
	execution tracing is not enabled.

	Modify those data structures to have room for the statistics.

	Don't distinguish "strict", "fast_loose" and "specified" memoing
	as separate eval methods; treat them as just different kinds
	of the same eval method: "memo".

	Remove underscores from the names of some types that the style guide
	says shouldn't be there.

runtime/mercury_tabling_preds.h:
runtime/mercury_tabling_macros.h:
	Modify the approach we use for macros that implement the predicates
	of library/table_builtin.m. Instead of selecting between debug and
	nondebug based on whether MR_TABLE_DEBUG is defined or not, add
	an explicit argument controlling this to each debuggable macro.
	The advantage of the new arrangement is that it scales. Another
	argument controls whether we are computing statistics (and if yes,
	where do we put it), and a third argument controls whether we maintain
	back links in the tries and hash tables (this last argument is present
	but is ignored for now).

	Since the values of the arguments will be known when the .c files
	containing calls to these macros are compiled, we pay the space and
	time cost of debugging, statistics gathering and the maintenance of
	back links if and only we need the revelant functionality.

	Provide macros for limited backward compatibility with the old set
	of macros; these allow workspaces created by old compilers to work
	with the new macros in the runtime. The old macros followed the
	naming scheme MR_table_*, the new ones are named MR_tbl_*.

runtime/mercury_table_int_fix_index_body.h:
runtime/mercury_table_int_start_index_body.h:
runtime/mercury_table_type_body.h:
	New files containing parts of the old mercury_tabling.c. Each of these
	files contains the body of the functions that used to be in
	mercury_tabling.c. The new mercury_tabling.c #includes each of these
	files more than once, to provide more than one variant of the old
	function. These variants differ in aspects such as whether debugging
	is enabled or statistics is being collected. Each variant therefore
	incurs only the time costs it needs to. (We pay the space cost of
	having all these variants all the time of course, but this cost
	is negligible.)

runtime/mercury_tabling_stats_defs.h:
runtime/mercury_tabling_stats_nodefs.h:
runtime/mercury_tabling_stats_undefs.h:
	New files that serve as wrappers around the newly #included files,
	controlling how they handle statistics.

runtime/mercury_tabling.c:
	Delete functions now in the new files, and #include them instead.
	Delete the data structures that used to contain summary statistics;
	the new approach keeps statistics in compiler-generated,
	procedure-specific data structures.

runtime/mercury_trace_base.c:
	Use the new versions of the tabling macros to access the I/O table.

runtime/mercury_type_info.h:
	Update some documentation for the movement of code out of
	mercury_tabling.c.

runtime/mercury_types.h:
	Provide forward declarations of the identifiers denoting the new types
	in mercury_tabling.h.

runtime/mercury_grade.h:
	Increment the exec trace version number, since we have changed
	a part of the exec trace structure.

runtime/mercury_bootstrap.h:
	Fix some temporary issues that arise from some renames above.

runtime/mercury_hash_lookup_or_add_body.h:
	Fix comment.

runtime/Mmakefile:
	Mention the new files and the dependencies that involve them.

library/table_builtin.m:
	Provide a type for representing statistics and a predicate for
	printing statistics.

	Use the updated versions of the macros in
	runtime/mercury_tabling_preds.h.

compiler/prog_item.m:
	Change representation of tabling pragmas to allow room for the new
	attributes.

	Allow an item to be marked as being generated by the compiler
	as a result of a pragma memo attribute. We use this for the reset
	and statistics predicates.

compiler/mercury_to_mercury.m:
	Write out the new attributes of the tabling pragma.

compiler/prog_data.m:
compiler/hlds_data.m:
	Change the cons_id that used to refer to a procedure's call table root
	to refer to the entirety of the new data structure now containing it.
	The compiler now needs a way to refer to the other components of this
	new data structure, since it contains the statistics.

	As in the runtime, don't distinguish "strict", "fast_loose" and
	"specified" memoing as separate eval methods; treat them as just
	different kinds of the same eval method: "memo".

	Rename some of the uses of the function symbols "c", "java", "il".

compiler/hlds_pred.m:
	Add an extra field in proc_infos for storing any tabling attributes.

	Change the existing proc_info field that records information about
	the kinds of arguments of tabled procedures to record the information
	needed by the debugger too. This was needed to allow us to shift all
	the RTTI for procedure-specific tables (as opposed to the RTTI for
	the global I/O table) from mercury_stack_layout.h to mercury_tabling.h
	without duplicating the data (which would be a maintenance problem).

	Reformat some comments to make them easier to read.

compiler/layout.m:
compiler/layout_out.m:
	Delete the part of the exec trace information that used to record
	RTTI for tables, since this information is not generated only as
	part of the debugger data structures anymore.

compiler/prog_io_pragma.m:
	Recognize the updated syntax for tabling pragmas.

compiler/add_pragma.m:
	When processing tabling pragmas for inclusion in the HLDS, create
	any reset and statistics predicates they ask for.

compiler/make_hlds_passes.m:
	Export a predicate now needed by add_pragma.m.

	Handle the new attributes on tabling pragmas

compiler/globals.m:
	Change the function symbols of the types describing backends and
	foreign languages to say what they are. Previously, both types (as well
	as several others) included the function symbol "c"; now, they are
	target_c and lang_c respectively.

compiler/table_gen.m:
	Implement the changes described at the top.

	When passing around varsets and vartypes, pass the arguments in the
	standard order.

compiler/goal_util.m:
compiler/hlds_goal.m:
	When passing around varsets and vartypes, pass the arguments in the
	standard order.

compiler/rtti.m:
	Provide types for representing the runtime's data structures for
	tabling (which are now significantly more complex than a single word)
	and predicates for manipulating them, for use by both the ml and ll
	backends.

compiler/llds.m:
	Replace the comp_gen_c_var type with the tabling_info_struct type,
	which contains the information needed to create the per-procedure
	tabling data structures.

	Replace references to call tables with references to the various
	components of the new tabling data structures.

compiler/llds_out.m:
	Add code to write out tabling_info_structs.

	Delete the code required for the old, hacky way of resetting tables.

	Reorder some code more logically.

compiler/proc_gen.m:
	Generate tabling_info_structs.

compiler/stack_layout.m:
	Don't generate the information now generated in proc_gen.m.

compiler/mlds.m:
	Give mlds_proc_labels their own function symbols, instead of using
	a pair. Rename some other function symbols to avoid ambiguity and add
	expressiveness.

	Provide for the representation of references to the various components
	of the new tabling data structures, and for the representation of their
	types.

compiler/ml_code_gen.m:
	When generating code for a tabled procedure, generate also the data
	structures required for its table.

compiler/rtti_to_mlds.m:
compiler/ml_util.m:
	Move some predicates from rtti_to_mlds.m to ml_util.m, since we
	now also want to call them from ml_code_gen.m.

compiler/name_mangle.m:
	Add some utility predicates.

compiler/options.m:
	Delete the old --allow-table-reset option.

	Add the new --table-debug option.

	Comment out an implementor-only option.

compiler/add_pred.m:
compiler/add_solver.m:
compiler/add_trail_ops.m:
compiler/add_type.m:
compiler/bytecode_gen.m:
compiler/code_gen.m:
compiler/compile_target_code.m:
compiler/complexity.m:
compiler/dependency_graph.m:
compiler/det_report.m:
compiler/export.m:
compiler/fact_table.m:
compiler/foreign.m:
compiler/global_data.m:
compiler/globals.m:
compiler/handle_options.m:
compiler/higher_order.m:
compiler/hlds_code_util.m:
compiler/hlds_data.m:
compiler/hlds_goal.m:
compiler/hlds_out.m:
compiler/inlining.m:
compiler/intermod.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/make_hlds_passes.m:
compiler/mercury_compile.m:
compiler/ml_call_gen.m:
compiler/ml_closure_gen.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_elim_nested.m:
compiler/ml_optimize.m:
compiler/ml_switch_gen.m:
compiler/ml_tailcall.m:
compiler/ml_type_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_ilasm.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
compiler/modes.m:
compiler/module_qual.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/polymorphism.m:
compiler/pragma_c_gen.m:
compiler/proc_label.m:
compiler/prog_data.m:
compiler/prog_foreign.m:
compiler/prog_item.m:
compiler/prog_mutable.m:
compiler/prog_out.m:
compiler/prog_rep.m:
compiler/prog_util.m:
compiler/recompilation.version.m:
compiler/size_prof.m:
compiler/special_pred.m:
compiler/switch_util.m:
compiler/transform_llds.m:
compiler/tupling.m:
compiler/type_ctor_info.m:
compiler/unify_gen.m:
	Conform to the changes above, and/or improve some comments.

mdbcomp/prim_data.m:
	Make the names of the function symbols of the proc_label type more
	expressive and less ambiguous.

mdbcomp/prim_data.m:
mdbcomp/mdbcomp.m:
mdbcomp/program_representation.m:
mdbcomp/rtti_access.m:
mdbcomp/slice_and_dice.m:
mdbcomp/trace_counts.m:
	Use . instead of __ as module qualifier.

	Conform to the change to prim_data.m.

browser/declarative_execution.m:
browser/declarative_oracle.m:
browser/declarative_tree.m:
	Conform the change to mdbcomp/prim_data.m.

tests/debugger/Mercury.options:
	Don't specify --allow-table-reset for fib.m, since that option
	doesn't exist anymore.

tests/debugger/fib.m:
	Use the new mechanism for resetting the table.

tests/debugger/print_table.m:
	Use the new syntax for pragma memo attributes.

tests/invalid/specified.{m,err_exp}:
	Use to the new syntax and reset method for pragma memo attributes.
	Test the handling of errors in the new attribute syntax.

tests/tabling/Mercury.options:
	Don't specify --allow-table-reset for specified.m, since that option
	doesn't exist anymore.

tests/tabling/specified.m:
	Use the new syntax for pragma memo attributes, and use the new
	mechanism for resetting tables. We could also use this test case
	for testing the printing of statistics, but the format of that
	output is still not final.

tests/tabling/fast_loose.m:
	Use the new syntax for pragma memo attributes, and use the new
	mechanism for resetting tables.

trace/mercury_trace.c:
trace/mercury_trace_cmd_developer.c:
	Conform to the changes in the RTTI data structures regarding tabling.

	Remove underscores from the names of some types that the style guide
	says shouldn't be there.

library/robdd.m:
	Comment out the tabling pragma until this change is bootstrapped.
	Without this, the conflict between the old calls to macros generated
	by the existing compiler and the new definition of those macros
	in the runtime would cause errors from the C compiler.
2006-06-08 08:20:17 +00:00
Julien Fischer
faa18a15bd Fix the bug with initialisers/finalisers in libraries not being called ( and
Estimated hours taken: 7
Branches: main, release

Fix the bug with initialisers/finalisers in libraries not being called ( and
as consequence also fixes the bug with mutables not being given their correct
initial value).  The problem was that the directives necessary to call them
were not being included in the libraries' .init file.

The fix is to add a new mode of operation to mkinit that given a list of
.c files that make up some Mercury library, constructs the .init file for
that library.  In particular, it now constructs the .init file so that
it contains any REQUIRED_{INIT,FINAL} directives needed by the library.
The new mode of operation is invoked when mkinit is given the `-k' option.

Modify the build systems (i.e. mmake and mmc --make) to conform to the
above change.

compiler/modules.m:
	Change the rule mmake uses to build .init files so that it calls
	mkinit -k on all the .c files generated for the library.

scripts/Mmake.vars.in:
	Add a new mmake variable MKLIBINIT.  This is the program used to
	create .init files.  (It will nearly always be mkinit.)

compiler/compile_target_code.m:
	Change how .init files are built.  We now have to call mkinit -k to
	scan all of the .c files to write out the correct set of INIT,
	REQUIRED_INIT and REQUIRED_FINAL directives.  The code here is
	that used by mmc --make for creating the .init files.

compiler/make.program_target.m:
	Build the .init file after building the .c files, since building
	it before will no longer work.
2006-05-21 06:22:59 +00:00
Zoltan Somogyi
be5b71861b Convert almost all the compiler modules to use . instead of __ as
Estimated hours taken: 6
Branches: main

compiler/*.m:
	Convert almost all the compiler modules to use . instead of __ as
	the module qualifier.

	In some cases, change the names of predicates and types to make them
	meaningful without the module qualifier. In particular, most of the
	types that used to be referred to with an "mlds__" prefix have been
	changed to have a "mlds_" prefix instead of changing the prefix to
	"mlds.".

	There are no algorithmic changes.
2006-03-17 01:40:46 +00:00
Julien Fischer
9d8ca0ad37 Remove residual parts of the Aditi backend that weren't deleted the other day.
Estimated hours taken: 1.5
Branches: main

Remove residual parts of the Aditi backend that weren't deleted the other day.

configure.in:
Mmake.common.in:
	Remove support for enabling the Aditi backend.

runtime/mercury_aditi.h:
	Remove this file.

runtime/Mmakefile:
runtime/mercury.h:
runtime/mercury_imp.h:
runtime/mercury_ho_call.[ch]:
runtime/mercury_wrapper.[ch]:
	Delete support for Aditi in the runtime.

scripts/Mmake.rules:
scripts/Mmake.vars.in:
scripts/c2init.in:
scripts/parse_ml_options.sh-subr.in:
	Remove mmake support for building .rlo files, etc.

util/mkinit.c:
	Remove Aditi specific code.

compiler/bytecode_data.m:
compiler/closure_analysis.m:
compiler/code_model.m:
compiler/compile_target_code.m:
compiler/det_analysis.m:
compiler/handle_options.m:
compiler/hlds_goal.m:
compiler/hlds_module.m:
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/make_hlds_error.m:
compiler/make_hlds_passes.m:
compiler/mercury_to_mercury.m:
compiler/mlds_to_gcc.m:
compiler/modecheck_call.m:
compiler/modules.m:
compiler/opt_debug.m:
compiler/options.m:
compiler/prog_data.m:
compiler/prog_foreign.m:
compiler/prog_mode.m:
compiler/prog_type.m:
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/term_errors.m:
compiler/unify_proc.m:
mdbcomp/prim_data.m:
	Remove residual support for Aditi.

library/ops.m:
	Remove the 'aditi_bottom_up' and 'aditi_top_down' operators from the
	ops table.

doc/reference_manual.texi:
doc/user_guide.texi:
	Delete the sections on the Aditi interface.

extras/aditi/*:
	Delete this.
2006-02-24 07:11:21 +00:00
Peter Wang
613ab045cd Don't try to reanalyse suboptimal, non-local modules when using
Estimated hours taken: 10
Branches: main

compiler/make.program_target.m:
	Don't try to reanalyse suboptimal, non-local modules when using
	`--intermodule-analysis'.

compiler/exception_analysis.m:
compiler/trailing_analysis.m:
compiler/unused_args.m:
	When looking up an analysis result, if the result is from a non-local
	module and is `suboptimal', just assume it is `optimal' since we can't
	make requests to or reanalyse the non-local module anyway.  On the
	other hand, if we look up a result from a local module which doesn't
	yet exist, record the default (suboptimal) result that we are using
	into the module's analysis registry, so that when the module is
	reanalysed, if the answer pattern changes we will know that it changed
	and the modules which made use of the default result can be marked.
2006-02-22 00:32:14 +00:00
Julien Fischer
b4ecae2f71 Emit an error message if --intermod-opt' and --intermodule-analysis' are
Estimated hours taken: 0.5
Branches: main

Emit an error message if `--intermod-opt' and `--intermodule-analysis' are
both enabled since they are not compatible with each other.

Emit an error message with `--make' and `--trans-intermod-opt' are enabled
together.  We don't support transitive-intermodule optimization with `mmc
--make' but enabling both options together causes problems for termination
analysis (it expects that at least one more recompile is going to be performed
but it never is).

compiler/handle_options.m:
	Emit an error message if `--intermod-opt' and `--intermodule-analysis'
	are both specified.

	Emit an error message if `--make' and `--trans-intermod-opt' are both
	specified.

compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/options.m
	Remove some preliminary support for transitive-intermodule
	optimization.  We aren't going to implement it for mmc --make.

	Update the TODO list.

	Fix some formatting.
2006-02-13 07:57:22 +00:00
Peter Wang
755cf5aa15 This patch improves the handling of libraries with the intermodule
Estimated hours taken: 25
Branches: main

This patch improves the handling of libraries with the intermodule
analysis framework.  `.analysis' files can now be installed into library
directories and used when analysing local modules.

analysis/analysis.m:
analysis/analysis.file.m:
compiler/mmc_analysis.m:
	Separate the `module_id_to_file_name' method of the `compiler'
	typeclass into `module_id_to_read_file_name' and
	`module_id_to_write_file_name'.  Add `module_is_local' method.

	Change the calls to `module_id_to_file_name' appropriately for the
	context.  This allows us to find the `.analysis' files of library
	modules.

	Only write results, IMDG and request files for local modules.

	Force `.analysis' files of the currently-analysed module to be written
	out, even if it would be empty.  This avoids us trying to reanalyse the
	module later.

compiler/options.m:
	Add internal compiler option `--local-module-id'.

compiler/make.dependencies.m:
	Add `make_local_module_id_options' to build a list of
	`--local-module-id' options.

compiler/make.module_target.m:
	Add predicate `make_module_target_extra_options' so we can pass the
	`--local-module-id' options.

compiler/make.program_target.m:
	Analyse modules in bottom up order, according to the module dependency
	graph.  The current analyses don't support non-default call patterns,
	so this should reduce the number of analysis passes to get (close to)
	to a fixpoint.

	Pass `--local-module-id' options when building analysis files, so the
	analysis framework knows which modules are local.

	Install `.analysis' files when installing libraries.

compiler/modules.m:
	Make `.analysis', `.analysis_date', `.imdg' and `.request' files
	architecture- or grade-specified so they go into grade directories
	when `--use-grade-subdirs' is used.

	Search for `.analysis' files in the same directories as `.opt' and
	`.trans_opt' files.

	Export predicate `add_module_relations' to help build module dependency
	graphs.

compiler/mercury_compile.m:
	Fix a bug where the unused argument optimisation pass was always being
	run if `--intermodule-analysis' was enabled.
2006-02-13 03:47:44 +00:00
Peter Wang
cdcdf90ac8 `mmc --make --use-grade-subdirs <linked-target>' makes symlinks/copies of the
Estimated hours taken: 2
Branches: main

`mmc --make --use-grade-subdirs <linked-target>' makes symlinks/copies of the
linked target into the current directory, but doesn't do so if the linked
target is already up to date.  This patch makes it always make the
symlink/copy, so that it is easy to switch between two or more grades even if
no source files were modified.

compiler/compile_target_code.m:
	Separate out the code to make symlinks/copies of linked targets from
	the `link' predicate into a predicate `post_link_make_symlink_or_copy'.

	Move `shared_libraries_supported' from make.program_target.m into
	compile_target_code.m.

compiler/make.program_target.m:
	Call `post_link_make_symlink_or_copy' if `--use-grade-subdirs' is
	enabled, and the linked target is otherwise up-to-date.
	Write out a message in `--verbose-make' mode.

	Conform to the move of `shared_libraries_supported'.

compiler/make.util.m:
	Add a predicate `maybe_symlink_or_copy_linked_target_message'.
2006-02-13 03:04:36 +00:00
Julien Fischer
6099dbb2d5 Fix a bug with mmc --make and shared libraries on Darwin.
Estimated hours taken: 4
Branches: main

Fix a bug with mmc --make and shared libraries on Darwin.  The problem was
that the install_name for the library was being incorrectly set.

compiler/modules.m:
	Set the value of the install-name path correctly.  If the user doesn't
	specify a value then generate one based on the current value of
	INSTALL_PREFIX.

compiler/options.m:
	Delete the bogus default value for the shlib-linker-install-name-path
	option.

compiler/compile_target_code.m:
	When linking a shared library on Darwin set the install-name path
	correctly, in particular we need to set it to the directory we
	are going to install the library in, *not* where the library is
	being built.

compiler/make.program_target.m:
	Mention that any changes to modules.get_install_name_option need to
	be reflected here.
2006-02-08 04:51:05 +00:00
Peter Wang
ad917cd909 Fix some problems with `mmc --make' on Windows (or possibly any platform
Estimated hours taken: 3
Branches: main

Fix some problems with `mmc --make' on Windows (or possibly any platform
without symbolic links).

compiler/make.program_target.m:
	Don't try to install `.mh' files into `inc/Mercury/mhs' as this is
	(seems) unnecessary.

	Make the symlinks or directories `ints/mhs' and `ints/mihs' when
	installing libraries.

	Correct a typo which created the directories
	`lib/<grade>/inc/Mercury/mih' instead of
	`lib/<grade>/inc/Mercury/mihs'.

compiler/modules.m:
	Make `copy_file' first attempt to use the `--install-command' command,
	in order to preserve more information about the file.  In particular,
	with `--use-grade-subdirs' we want executables copied from the grade
	subdirectories to keep the executable bit.
2006-02-07 00:06:20 +00:00
Peter Wang
d202be54a0 This patch mainly adds the ability to perform intermodule analysis of modules
Estimated hours taken: 20
Branches: main

This patch mainly adds the ability to perform intermodule analysis of modules
as a separate step from code generation.  It makes a start on automatic
reanalysis of modules if their .analysis files become invalid or suboptimal.

analysis/analysis.file.m:
analysis/analysis.m:
	Add a predicate `read_module_overall_status' to read just the overall
	status of an analysis file.

	Fix a bug where analysis results were being discarded (upon reading) if
	the module's overall status was `invalid'.  We can't do that as then we
	wouldn't know which results changed after reanalysis.

	Touch a `FOO.analysis_date' file after module `FOO' is analysed.
	This is needed to indicate the time at which `FOO' was last analysed,
	as `FOO.analysis' can be modified at other times.

	Add a mutable boolean variable `debug_analysis' that can be set
	to enable debugging messages for the analysis framework.

compiler/handle_options.m:
compiler/options.m:
	Add new compiler options `--make-analysis-registry',
	`--debug-intermodule-analysis' and `--analysis-repeat'.

compiler/make.dependencies.m:
	Add `.analysis' files as dependencies of compiled code files if
	`--intermodule-analysis' is used.

compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
	Add a `FOO.analyse' pseudo-target to `mmc --make'.  This produces all
	the `.analysis' files needed to compile the top-level module `FOO',
	reanalysing modules until none of the `.analysis' files are invalid.
	The `--analysis-repeat' option can also be used to force
	`suboptimal' modules to be reanalysed a number of times.

	Perform an analysis pass when building executables or libraries to make
	sure that compilation does not proceed with invalid analysis files.

	Treat `.analysis' files specially when checking whether they are out of
	date.  Analysis files require looking at their contents to determine
	whether they are invalid (in which case they are out of date), or valid
	(in which case we look at the timestamp of the corresponding
	`.analysis_date' file).

compiler/mercury_compile.m:
	Make `.analysis' be written out only when `--make-analysis-registry'
	is used, like `--make-transitive-optimization-interface'.
	`mmc --make' runs the compiler the `--make-analysis-registry'
	option as appropriate.

compiler/exception_analysis.m:
compiler/trailing_analysis.m:
compiler/unused_args.m:
	Only record intermodule dependencies and analysis results when
	`--make-analysis-registry' is enabled, not when
	`--intermodule-analysis' is enabled.

doc/user_guide.texi:
	Document `--debug-intermodule-analysis' and `--analysis-repeat'.
2006-02-06 05:39:45 +00:00
Peter Wang
f2d121b6e1 This is a follow up to a previous patch designed to solve a
Estimated hours taken: 2
Branches: main

This is a follow up to a previous patch designed to solve a
problem where "mmc --make libfoo.install --libgrade <bar>" would
install into a grade subdirectory named <bar> in non-canonical form.
The previous patch was completely broken for "hlc" grades (at least).

compiler/handle_options.m:
	Revert r1.252 as it did not properly canonicalise grade strings.

compiler/make.program_target.m:
	Use `grade_directory_component' to find out which directory a grade's
	files should be installed into instead of assuming the verbatim grade
	string passed in with `--libgrade'.
2006-02-03 05:46:21 +00:00
Peter Wang
af878d04f9 Some work on the intermodule analysis framework.
Estimated hours taken: 45
Branches: main

Some work on the intermodule analysis framework.  The main changes are that
modules and analysis results have statuses associated with them, which are
saved in the `.analysis' files, and there is now code to handle intermodule
dependency graphs (that record which modules are dependent on a particular
analysis result).

Automatic recompilation of modules that use out of date or invalid analysis
results from other modules is not handled yet.

analysis/README:
analysis/analysis.m:
analysis/analysis.file.m:
	Remove the `FuncInfo' type variable everywhere.  This was originally
	designed to be used by analyses to store "extra" information that
	would be passed from an analysis implementation through the analysis
	framework, back to methods defined by the analysis implementation
	itself.

	The main problem was that `FuncInfo' made `Call' or `Answer' values
	hard to compare, as a `FuncInfo' value always had to be present for a
	comparison to be made (because the methods in the partial_order
	typeclass required FuncInfos).  One example of when this is hard to
	satisfy is when we are ready to write everything out to disk at the
	end of all analyses.  At this step there is much comparing of Call
	and Answer values, but this step is not invoked by any particular
	analysis pass.  To compare values we would need to get the FuncInfos
	from somewhere, which means we would have to store FuncInfos in the
	analysis_info maps as well.  And any time you have two FuncInfos, you
	need to choose one of the FuncInfos arbitrarily.

	Since FuncInfos would have to be read/written with every Call and
	Answer value, including IMDGs, I have changed it so that that any
	information which might be be stored in a `FuncInfo' should be stored
	in the corresponding `Call' value itself.

	Change the format of analysis result files to include an overall
	status for the module and a status for each analysis result.  The
	statuses record whether the module or analysis result could be
	improved by further compilation, or if the module or analysis result
	is no longer valid.

	Add code to read and write intermodule dependency graphs (IMDGs).  The
	IMDG file for module M records all the modules which depend on an
	analysis result for a procedure defined in M.

	Bump analysis file format version numbers as they are incompatible
	with earlier versions.

compiler/mercury_compile.m:
	Make `mercury_compile_after_front_end' use state variables for
	copies of the HLDS and update it to match changes in the intermodule
	analysis framework.

compiler/mmc_analysis.m:
	Add the trail usage analysis to the list of analyses to be used with
	the intermodule analysis framework.

	Update the entry for unused argument elimination.

	Add predicate `module_id_func_id'.

compiler/add_pragma.m:
compiler/hlds_module.m:
compiler/trailing_analysis.m:
	Make the trail usage analysis pass able to make use of the intermodule
	analysis framework.

	Associate each `trailing_status' in the `trailing_info' map with an
	`analysis_status', i.e. whether it is optimal or not.

compiler/unused_args.m:
	Update to match the removal of `FuncInfo' arguments and the
	addition of analysis statuses.

	Record the unused argument analysis result for a procedure even if
	all of the procedures arguments are used, so that callers of the
	procedure will know not to request more precise answers.

	Record the dependence of the current module on analysis results from
	other modules.

compiler/goal_util.m:
	Add predicate `pred_proc_ids_from_goal/2'.

compiler/make.m:
compiler/make.dependencies.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/modules.m:
scripts/Mmake.vars.in:
	Make `mmc --make' and `mmake' realclean `.analysis', `.imdg' and
	`.request' files of non-library modules.  Files for imported library
	modules won't be deleted, but they probably shouldn't be generated in
	the first place.

NEWS:
library/list.m:
	Add a `list.map2_foldl2' predicate.

compiler/Mmakefile:
	Add the `analysis' directory to the list of directories to be
	processed by mtags.
2006-01-25 03:27:38 +00:00
Peter Wang
881b2d8594 Add a --lib-linkage' accumulating option for mmc --make'.
Estimated hours taken: 3
Branches: main

Add a `--lib-linkage' accumulating option for `mmc --make'.  This option
allows you to specify whether libraries should be installed for shared
linking (`shared') or static linking (`static').  The option corresponds
to an options file or environment variable called `LIB_LINKAGES'.

compiler/options.m:
compiler/options_file.m:
doc/user_guide.texi:
	Add and document `--lib-linkage' option and `LIB_LINKAGES'
	variable.

	Unrelated change: document `--no-libgrade' option.

compiler/handle_options.m:
	If no --lib-linkage option has been specified, default to the
	set of all possible linkages.

compiler/make.program_target.m:
	Skip building/installing static or shared libraries according to
	the `--lib-linkage' options.
2006-01-06 04:06:55 +00:00
Peter Wang
6c14c1cbbe Fix some problems with `mmc --make'.
Estimated hours taken: 8
Branches: main

Fix some problems with `mmc --make'.

compiler/compile_target_code.m:
	In `link' predicate, after the file has been created in a grade
	subdirectory it would try to symlink or copy the file into the user
	directory.  This would fail if a file of the same name already existed
	there, so remove it before attempting the symlink/copy.

compiler/make.program_target.m:
	Prevent `mmc --make libFOO' from trying to produce a shared library
	if they are unsupported on the current architecture.

	Disable the logic to conditionally generate `.mh' files so as to avoid
	trouble with Mmake, which expects them to always exist.

	Fix a typo that tried to install `.mih' files into `int' directories
	instead of `ints'.

compiler/modules.m:
	Make `make_symlink_or_copy_file' write a newline after errors.
2005-12-05 02:17:21 +00:00
Julien Fischer
45fdb6c451 Use expect/3 in place of require/2 throughout most of the
Estimated hours taken: 4
Branches: main

compiler/*.m:
	Use expect/3 in place of require/2 throughout most of the
	compiler.

	Use unexpected/2 (or sorry/2) in place of error/1 in more
	places.

	Fix more dodgy assertion error messages.

	s/map(prog_var, mer_type)/vartypes/ where the latter is meant.
2005-11-28 04:11:59 +00:00
Zoltan Somogyi
f9fe8dcf61 Improve the error messages generated for determinism errors involving committed
Estimated hours taken: 8
Branches: main

Improve the error messages generated for determinism errors involving committed
choice contexts. Previously, we printed a message to the effect that e.g.
a cc pred is called in context that requires all solutions, but we didn't say
*why* the context requires all solutions. We now keep track of all the goals
to the right that could fail, since it is these goals that may reject the first
solution of a committed choice goal.

The motivation for this diff was the fact that I found that locating the
failing goal can be very difficult if the conjunction to the right is
a couple of hundred lines long. This would have been a nontrivial problem,
since (a) unifications involving values of user-defined types are committed
choice goals, and (b) we can expect uses of user-defined types to increase.

compiler/det_analysis.m:
	Keep track of goals to the right of the current goal that could fail,
	and include them in the error representation if required.

compiler/det_report.m:
	Include the list of failing goals to the right in the representations
	of determinism errors involving committed committed choice goals.

	Convert the last part of this module that wasn't using error_util
	to use error_util. Make most parts of this module just construct
	error message specifications; print those specifications (using
	error_util) in only a few places.

compiler/hlds_out.m:
	Add a function for use by the new code in det_report.m.

compiler/error_util.m:
	Add a function for use by the new code in det_report.m.

compiler/error_util.m:
compiler/compiler_util.m:
	Error_util is still changing reasonably often, and yet it is
	included in lots of modules, most of which need only a few simple
	non-parse-tree-related predicates from it (e.g. unexpected).
	Move those predicates to a new module, compiler_util.m. This also
	eliminates some undesirable dependencies from libs to parse_tree.

compiler/libs.m:
	Include compiler_util.m.

compiler/notes/compiler_design.html:
	Document compiler_util.m, and fix the documentation of some other
	modules.

compiler/*.m:
	Import compiler_util instead of or in addition to error_util.
	To make this easier, consistently use . instead of __ for module
	qualifying module names.

tests/invalid/det_errors_cc.{m,err_exp}:
	Add this new test case to test the error messages for cc contexts.

tests/invalid/det_errors_deet.{m,err_exp}:
	Add this new test case to test the error messages for unifications
	inside function symbols.

tests/invalid/Mmakefile:
	Add the new test cases.

tests/invalid/det_errors.err_exp:
tests/invalid/magicbox.err_exp:
	Change the expected output to conform to the change in det_report.m,
	which is now more consistent.
2005-10-28 02:11:03 +00:00
Ian MacLarty
2e04ddc748 Remove the architecture string from the installed directory structure
Estimated hours taken: 1
Branches: main and 0.12

Remove the architecture string from the installed directory structure
and put the executables in $PREFIX/bin, instead of
$PREFIX/lib/mercury/bin/$FULLARCH.

The reason for this change is to reduce the need for unix shell scripts in
the top-level bin directory that call the actual programs in the
lib/mercury/bin/FULLARCH directory.  The unix scripts can't be run on Windows
without a unix emulation environment like Cygwin.

Because the executables are now in the top-level bin directory, we cannot
install multiple architectures under the same directory structure.  However
this is not a real loss, since the binaries for different architectures can
just be installed to different locations, as we currently do anyway on
mundula.cs.mu.oz.au.

The plan is to rename mercury_compile to mmc and do away with the mmc unix
script.  This will allow mmc to be run on Windows without Cygwin or MSYS.
This proposal replaces a previous proposal to implement a C version of the
mmc script.  That solution turned out to be quite complicated and
unreliable.

This diff will also mean mdice, mslice and mtc_union will be in the same
directory as mmc, so will be in the PATH as long as mmc is in the PATH.

configure.in:
bindist/Mmakefile:
bindist/bindist.Makefile.in:
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/make.program_target.m:
debian/rules:
library/Mmakefile:
scripts/Mmake.vars.in:
scripts/mdprof.in:
scripts/mercury.bat.in:
scripts/mgnuc.in:
scripts/ml.in:
scripts/mmc.in:
scripts/mprof.in:
tools/run_all_tests_from_cron:
tools/test_mercury:
	Remove FULLARCH from the installed directory structure.
	Install executables to the top-level bin directory.
2005-10-25 10:17:29 +00:00
Zoltan Somogyi
905e4a114f Convert a bunch of modules to four-space indentation.
Estimated hours taken: 4
Branches: main

compiler/*.m:
	Convert a bunch of modules to four-space indentation.
	In the process, fix departures from our coding standards.

	In some cases, do minor other cleanups such as changing argument orders
	to be friendly to state variables.

	There are no algorithmic changes.
2005-10-12 23:51:38 +00:00
Julien Fischer
87fb88961c Minor cleanups for mmc --make. There are no algorithmic
Estimated hours taken: 0.5
Branches: main

Minor cleanups for mmc --make.  There are no algorithmic
changes.

compiler/make.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/process_util.m:
	Bring these modules into line with our current coding
	standard.
2005-04-26 04:32:49 +00:00
Zoltan Somogyi
34d5181f3a Bring these modules up to date with our current style guidelines.
Estimated hours taken: 4
Branches: main

compiler/mercury_to_mercury.m:
compiler/make.dependencies.m:
compiler/make.module_target.m:
compiler/make.module_dep_file.m:
compiler/make.util.m:
compiler/make.m:
	Bring these modules up to date with our current style guidelines.
	Use predmode declarations where appropriate. Use state variable syntax
	where appropriate. Switch to four-space indentation where this reduces
	the number of places with excessive indentation. Use explicit
	predicates instead of lambda expressions where appropriate.

compiler/*.m:
	Minor style fixes.
2005-03-30 00:50:21 +00:00
Zoltan Somogyi
e854a5f9d9 Major improvements to tabling, of two types.
Estimated hours taken: 32
Branches: main

Major improvements to tabling, of two types. The first is the implementation
of the loopcheck and memo forms of tabling for model_non procedures, and the
second is a start on the implementation of a new method of implementing
minimal model tabling, one that has the potential for a proper fix of the
problem that we currently merely detect with the pneg stack (the detection
is followed by a runtime abort). Since this new method relies on giving each
own generator its own stack, the grade component denoting it is "mmos"
(minimal model own stack). The true name of the existing method is changed
from "mm" to "mmsc" (minimal model stack copy). The grade component "mm"
is now a shorthand for "mmsc"; when the new method works, "mm" will be changed
to be a shorthand for "mmos".

configure.in:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/final_grade_options.sh-subr:
compiler/options.m:
	Handle the new way of handling minimal model grades.

scripts/mgnuc.in:
compiler/compile_target_code.m:
	Conform to the changes in minimal model grade options.

compiler/table_gen.m:
	Implement the transformations required by the loopcheck and memo
	tabling of model_non procedures, and the minimal model own stack
	transformation.

	The new implementation transformations use foreign_procs with extra
	args, since there is no point in implementing them both that way and
	with separate calls to library predicates. This required making the
	choice of which method to use at the top level of each transformation.

	Fix an oversight that hasn't caused problems yet but may in the future:
	mark goals wrapping the original goals as not impure for determinism
	computations.

compiler/handle_options.m:
	Handle the new arrangement of the options for minimal model tabling.
	Detect simultaneous calls for both forms of minimal model tabling,
	and generate an error message. Allow for more than one error message
	generated at once; report them all once rather than separately.

compiler/globals.m:
	Add a mechanism to allow a fix a problem detected by the changes
	to handle_options: the fact that we currently may generate a usage
	message more than once for invocations with more than one error.

compiler/mercury_compile.m:
compiler/make.program_target.m:
compiler/make.util.m:
	Use the new mechanism in handle_options to avoid generating duplicate
	usage messages.

compiler/error_util.m:
	Add a utility predicate for use by handle_options.

compiler/hlds_pred.m:
	Allow memo tabling for model_non predicates, and handle own stack
	tabling.

compiler/hlds_out.m:
	Print information about the modes of the arguments of foreign_procs,
	since this is useful in debugging transformations such as tabling
	that generate them.

compiler/prog_data.m:
compiler/layout_out.m:
compiler/prog_out.m:
runtime/mercury_stack_layout.h:
	Mention the new evaluation method.

compiler/goal_util.m:
	Change the predicates for creating calls and foreign_procs to allow
	more than one goal feature to be attached to the new goal. table_gen.m
	now uses this capability.

compiler/add_heap_ops.m:
compiler/add_trail_ops.m:
compiler/polymorphism.m:
compiler/simplify.m:
compiler/size_prof.m:
compiler/typecheck.m:
compiler/unify_proc.m:
	Conform to the changes in goal_util.

compiler/code_info.m:
compiler/make_hlds.m:
compiler/modules.m:
compiler/prog_io_pragma.m:
	Conform to the new the options controlling minimal model
	tabling.

compiler/prog_util.m:
	Add a utility predicate for use by table_gen.m.

library/std_util.m:
	Conform to the changes in the macros for minimal model tabling grades.

library/table_builtin.m:
	Add the types and predicates required by the new transformations.

	Delete an obsolete comment.

runtime/mercury_grade.h:
	Handle the new minimal model grade component.

runtime/mercury_conf_param.h:
	List macros controlling minimal model grades.

runtime/mercury_tabling.[ch]:
	Define the types needed by the new transformations,

	Implement the performance-critical predicates that need to be
	hand-written for memo tabling of model_non predicates.

	Add utility predicates for debugging.

runtime/mercury_tabling_preds.h:
	Add the implementations of the predicates required by the new
	transformations.

runtime/mercury_mm_own_stacks.[ch]:
	This new module contains the first draft of the implementation
	of the own stack implementation of minimal model tabling.

runtime/mercury_imp.h:
	Include the new file if the grade needs it.

runtime/Mmakefile:
	Mention the new files, and sort the lists of filenames.

runtime/mercury_tabling_macros.h:
	Add a macro for allocating answer blocks without requiring them to be
	pointed to directly by trie nodes.

runtime/mercury_minimal_model.[ch]:
	The structure type holding answer lists is now in mercury_tabling.h,
	since it is now also needed by memo tabling of model_non predicates.
	It no longer has a field for an answer num, because while it is ok
	to require a separate grade for debugging minimal model tabling,
	it is not ok to require a separate grade for debugging memo tabling
	of model_non predicates. Instead of printing the answer numbers,
	print the answers themselves when we need to identify solutions
	for debugging.

	Change function names, macro names, error messages etc where this is
	useful to distinguish the two kinds of minimal model tabling.

	Fix some oversights wrt transient registers.

runtime/mercury_context.[ch]:
runtime/mercury_engine.[ch]:
runtime/mercury_memory.[ch]:
runtime/mercury_wrapper.[ch]:
	With own stack tabling, each subgoal has its own context, so record
	the identity of the subgoal owning a context in the context itself.
	The main computation's context is the exception: it has no owner.

	Record not just the main context, but also the contexts of subgoals
	in the engine.

	Add variables for holding the sizes of the det and nondet stacks
	of the contexts of subgoals (which should in general be smaller
	than the sizes of the corresponding stacks of the main context),
	and initialize them as needed.

	Initialize the variables holding the sizes of the gen, cut and pneg
	stacks, even in grades where the stacks are not used, for safety.

	Fix some out-of-date documentation, and conform to our coding
	guidelines.

runtime/mercury_memory_zones.[ch]:
	Add a function to test whether a pointer is in a zone, to help
	debugging.

runtime/mercury_debug.[ch]:
	Add some functions to help debugging in the presence of multiple
	contexts, and factor out some common code to help with this.

	Delete the obsolete, unused function MR_printdetslot_as_label.

runtime/mercury_context.h:
runtime/mercury_bootstrap.h:
	Move a bootstrapping #define from mercury_context.h to
	mercury_bootstrap.h.

runtime/mercury_context.h:
runtime/mercury_bootstrap.h:
	Move a bootstrapping #define from mercury_context.h to
	mercury_bootstrap.h.

runtime/mercury_types.h:
	Add some more forward declarations of type names.

runtime/mercury_dlist.[ch]:
	Rename a field to avoid assignments that dereference NULL.

runtime/mercury_debug.c:
runtime/mercury_memory.c:
runtime/mercury_ml_expand_body.h:
runtime/mercury_stack_trace.c:
runtime/mercury_stacks.[ch]:
trace/mercury_trace_util.c
	Update uses of the macros that control minimal model tabling.

runtime/mercury_stack_trace.c:
	Provide a mechanism to allow stack traces to be suppressed entirely.
	The intention is that by using this mechanism, by the testing system
	won't have to provide separate .exp files for hlc grades, nondebug
	LLDS grades and debug LLDS grades, as we do currently. The mechanism
	is the environment variable MERCURY_SUPPRESS_STACK_TRACE.

tools/bootcheck:
tools/test_mercury:
	Specify MERCURY_SUPPRESS_STACK_TRACE.

trace/mercury_trace.c:
	When performing retries across tabled calls, handle memo tabled
	model_non predicates, for which the call table tip variable holds
	a record with a back pointer to a trie node, instead of the trie node
	itself.

trace/mercury_trace_internal.c:
	When printing tables, handle memo tabled model_non predicates. Delete
	the code now moved to runtime/mercury_tabling.c.

	Add functions for printing the data structures for own stack minimal
	model tabling.

tests/debugger/print_table.{m,inp,exp}:
	Update this test case to also test the printing of tables for
	memo tabled model_non predicates.

tests/debugger/retry.{m,inp,exp}:
	Update this test case to also test retries across memo tabled
	model_non predicates.

tests/tabling/loopcheck_nondet.{m,exp}:
tests/tabling/loopcheck_nondet_non_loop.{m,exp}:
	New test cases to test loopcheck tabled model_non predicates.
	One test case has a loop to detect, one doesn't.

tests/tabling/memo_non.{m,exp}:
tests/tabling/tc_memo.{m,exp}:
tests/tabling/tc_memo2.{m,exp}:
	New test cases to test memo tabled model_non predicates.
	One test case has a loop to detect, one has a need for minimal model
	tabling to detect, and the third doesn't have either.

tests/tabling/Mmakefile:
	Add the new test cases, and reenable the existing tc_loop test case.

	Rename some make variables and targets to make them better reflect
	their meaning.

tests/tabling/test_mercury:
	Conform to the change in the name of the make target.
2004-07-20 04:41:55 +00:00
Zoltan Somogyi
d332038ee1 Bring these modules up to date with our coding guidelines.
Estimated hours taken: 16
Branches: main

compiler/aditi_builtin_ops.m:
compiler/bytecode.m:
compiler/bytecode_backend.m:
compiler/bytecode_gen.m:
compiler/c_util.m:
compiler/code_gen.m:
compiler/deep_profiling.m:
compiler/deforest.m:
compiler/dependency_graph.m:
compiler/fact_table.m:
compiler/follow_code.m:
compiler/handle_options.m:
compiler/hlds_out.m:
compiler/il_peephole.m:
compiler/ilasm.m:
compiler/java_util.m:
compiler/liveness.m:
compiler/magic.m:
compiler/magic_util.m:
compiler/make.dependencies.m:
compiler/make.m:
compiler/make.module_dep_file.m:
compiler/make.program_target.m:
compiler/make.util.m:
compiler/matching.m:
compiler/name_mangle.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/options.m:
compiler/options_file.m:
compiler/prog_io.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/saved_vars.m:
compiler/source_file_map.m:
compiler/stack_alloc.m:
compiler/stack_layout.m:
compiler/stratify.m:
compiler/switch_detection.m:
compiler/term_errors.m:
compiler/type_ctor_info.m:
compiler/unify_proc.m:
compiler/unique_modes.m:
	Bring these modules up to date with our coding guidelines. Use predmode
	syntax for declarations. Use state variable syntax where appropriate,
	and reorder arguments where this is needed for the use of state
	variable syntax. Remove module qualification from the names of defined
	predicates when the module qualification was used inconsistently
	(causing problems for the use of tags) or was causing problems with
	indentation.

	There are no changes in algorithms.
2004-06-30 02:48:20 +00:00
Zoltan Somogyi
885fd4a387 Remove almost all dependencies by the modules of parse_tree.m on the modules
Estimated hours taken: 12
Branches: main

Remove almost all dependencies by the modules of parse_tree.m on the modules
of hlds.m. The only such dependencies remaining now are on type_util.m.

compiler/hlds_data.m:
compiler/prog_data.m:
	Move the cons_id type from hlds_data to prog_data, since several parts
	of the parse tree data structure depend on it (particularly insts).
	Remove the need to import HLDS modules in prog_data.m by making the
	cons_ids that refer to procedure ids refer to them via a new type
	that contains shrouded pred_ids and proc_ids. Since pred_ids and
	proc_ids are abstract types in hlds_data, add predicates to hlds_data
	to shroud and unshroud them.

	Also move some other types, e.g. mode_id and class_id, from hlds_data
	to prog_data.

compiler/hlds_data.m:
compiler/prog_util.m:
	Move predicates for manipulating cons_ids from hlds_data to prog_util.

compiler/inst.m:
compiler/prog_data.m:
	Move the contents of inst.m to prog_data.m, since that is where it
	belongs, and since doing so eliminates a circular dependency.
	The separation doesn't serve any purpose any more, since we don't
	need to import hlds_data.m anymore to get access to the cons_id type.

compiler/mode_util.m:
compiler/prog_mode.m:
compiler/parse_tree.m:
	Move the predicates in mode_util that don't depend on the HLDS to a new
	module prog_mode, which is part of parse_tree.m.

compiler/notes/compiler_design.m:
	Mention prog_mode.m, and delete the mention of inst.m.

compiler/mercury_to_mercury.m:
compiler/hlds_out.m:
	Move the predicates that depend on HLDS out of mercury_to_mercury.m
	to hlds_out.m. Export from mercury_to_mercury.m the predicates needed
	by the moved predicates.

compiler/hlds_out.m:
compiler/prog_out.m:
	Move predicates for printing parts of the parse tree out of hlds_out.m
	to prog_out.m, since mercury_to_mercury.m needs to use them.

compiler/purity.m:
compiler/prog_out.m:
	Move predicates for printing purities from purity.m, which is part
	of check_hlds.m, to prog_out.m, since mercury_to_mercury.m needs to use
	them.

compiler/passes_aux.m:
compiler/prog_out.m:
	Move some utility predicates (e.g. for printing progress messages) from
	passes_aux.m to prog_out.m, since some predicates in submodules of
	parse_tree.m need to use them.

compiler/foreign.m:
compiler/prog_data.m:
	Move some types from foreign.m to prog_data.m to allow the elimination
	of some dependencies on foreign.m from submodules of parse_tree.m.

compiler/*.m:
	Conform to the changes above, mostly by updating lists of imported
	modules and module qualifications. In some cases, also do some local
	cleanups such as converting predicate declarations to predmode syntax
	and fixing white space.
2004-06-14 04:17:03 +00:00
James Goddard
9c55bbe0ab Implement mmake library installation for the Java grade.
Estimated hours taken: 10
Branches: main

Implement mmake library installation for the Java grade.

modules.m:
	Move code for extracting .class file lists into a form suited for jar
	out into a separate predicate list_class_files_for_jar/5.

compile_target_code.m:
	Added symbol `java_archive' as a `linked_target_type' type.
	Added java_archive case for every switch on linked_target_type.
	Added create_java_archive/7 which performs a similar function to
	create_archive/6 but for Java.

make.util.m:
        linked_target_file_name/5 implemented for `java_archive'

make.program_target.m:
	Implemented lib<module>.install target for the Java grade.
	Added .jar file to realclean list.
2004-02-19 00:58:28 +00:00