Commit Graph

4189 Commits

Author SHA1 Message Date
Zoltan Somogyi
9551640f55 Import only one compiler module per line. Sort the blocks of imports.
Estimated hours taken: 2
Branches: main

compiler/*.m:
	Import only one compiler module per line. Sort the blocks of imports.
	This makes it easier to merge in changes.

	In a couple of places, remove unnecessary imports.
2003-03-15 03:09:14 +00:00
Fergus Henderson
476e40c7f1 Change set_line_num so that if we do not have a valid context,
Estimated hours taken: 0.5
Branches: main

compiler/c_util.m:
	Change set_line_num so that if we do not have a valid context,
	it calls reset_line_num.

	Previous it would just not emit any #line directive, but that is wrong,
	because it causes the C compiler to assume that such lines come from
	the next line in the source file after wherever the previous line
	in the C file came from.  This is incorrect and can lead to confusing
	results.
2003-03-15 00:08:51 +00:00
Zoltan Somogyi
4954da84cc Reduce the dependence of the MLDS backend on the LLDS backend by moving
Estimated hours taken: 2
Branches: main

Reduce the dependence of the MLDS backend on the LLDS backend by moving
functionality dealing with proc_labels from the LLDS backend (code_util.m)
to a new module, proc_label.m, which is part of backend_libs.

compiler/code_util.m:
compiler/proc_label.m:
	Move a type and some code from code_util to the new module. Convert
	predicates to functions as relevant. (The old code was written before
	functions were available).

compiler/backend_libs.m:
	Add proc_label to the list of submodules.

compiler/rtti.m:
	Rename a function to avoid a name clash with a function in
	proc_label.m.

compiler/*.m:
	Conform to the changes above.

	Ensure that all imports of modules in the compiler directory are on
	lines of their own, to make CVS merges easier. Sort the imports.
2003-03-14 08:10:12 +00:00
David Overton
785beb075e In eliminate_constraint_by_class_rules', if type_unify_list'
Estimated hours taken: 5
Branches: main

compiler/typecheck.m:
	In `eliminate_constraint_by_class_rules', if `type_unify_list'
	fails for a subclass, remove that subclass from the list of
	constraints being examined rather than aborting.
	`type_unify_list' may fail if one of the arguments to the
	superclass constraint is not a type variable and does not unify
	with the corresponding argument of the subclass.
	In such cases, this particular superclass-subclass relationship
	is not relevant to the constraint we are trying to prove so it is safe
	to remove it.

tests/valid/Mmakefile:
tests/valid/typeclass_constraint_nonvar_bug.m:
	Test case.
2003-03-13 11:53:36 +00:00
Zoltan Somogyi
742c0a0a28 Fix a bug caused by the fake arities of the types defining typeinfos:
Estimated hours taken: 6
Branches: main

Fix a bug caused by the fake arities of the types defining typeinfos:
the debugger was trying to construct a typeinfo describing the types of
variables such as TypeInfo_for_K. The problem occured whenever the debugger
tried to do anything with such variables: either with print_optionals,
or via the node-creation function of the declarative debugger.

runtime/mercury_make_tyoe_info_body.h:
	Special case the typeinfo-like fake-arity types.

runtime/mercury_type_info.h:
	Add a flag for identifying typeinfo-like fake-arity types.

	Also add flags for identifying variable-arity type constructors
	and discriminated union type constructors. These flags cannot be
	used until the compiler part of this change has been installed.

	Make the flag field unconditionally part of type_ctor_infos,
	now that all installed compilers generate it.

	Factor out the macros for defining type_ctor_infos so that one
	definition serves both backends. This also fixes a bug: the
	MR_HIGHLEVEL_CODE version was using an obsolete version number.

	Delete some obsolete forms of these macros.

runtime/mercury_mcpp.h:
	Delete the obsolete forms of these macros from here too. They were
	never used.

runtime/mercury_builtin_types.c:
	Add the relevant flags to the definitions of the type_ctor_infos
	of builtin types.

runtime/mercury_type_info.c:
	Import a header now needed by mercury_make_type_info_body.h, which
	is #included in this file.

runtime/Mmakefile:
	Delete some redundant dependencies.

compiler/rtti.m:
	Extend the type of type_ctor_info flags to include the new flags.

compiler/type_ctor_info.m:
	Generate the new type_ctor_info flags, the ones that can be set
	in type_ctor_infos generated by the compiler.

tests/debugger/declarative/mapinit.{m,inp,exp,exp2}:
	New test case that exhibits the problem.

tests/debugger/declarative/Mmakefile:
	Turn on the test case.
2003-03-13 01:47:11 +00:00
Zoltan Somogyi
c48b2db894 Fix a bug: the absence of a space between options could cause
Estimated hours taken: 0.1
Branches: main

compiler/compile_target_code.m:
	Fix a bug: the absence of a space between options could cause
	two to run together, confusing the C compiler.
2003-03-12 08:01:46 +00:00
Peter Ross
76e06057dd Add the analysis directory to where csc searches for
Estimated hours taken: 0.1
Branches: main

compiler/Mmakefile:
	Add the analysis directory to where csc searches for
	assemblies.
2003-03-11 13:52:54 +00:00
Peter Ross
efdaf1f224 Fix a performance bug where dead_pred_elim was taking a significant
Estimated hours taken: 6
Branches: main

Fix a performance bug where dead_pred_elim was taking a significant
amount of time to delete entries from the predicate_table.  With this
change dead_pred_elim goes from 12 minutes to 55 seconds CPU time in
the IL grade when compiling accumulator.m with
--intermodule-optimization turned on.

compiler/hlds_module.m:
	Implement a new predicate, predicate_table_restrict, which
	restricts the predicate_table to include only a subset of the
	predicates.
	Rather than deleting all the non-needed entries, this
	predicate builds the predicate_table from scratch again, hence
	this predicate is only useful when the number of predicates to
	keep is significantly less than the number of predicates to
	delete.
	Change predicate_table_do_insert so that it records in the
	pred_info whether or not a predicate can only be accessed by
	its fully qualified name, this is needed so that the
	predicate_table can be rebuilt correctly.

compiler/dead_proc_elim.m:
	Use predicate_table_restrict to restrict the set of pred_ids
	in the predicate_table rather than module_info_remove_predicate
	as the amount of predicates to keep is in general
	significantly smaller than the number of predicates to keep.

compiler/hlds_pred.m:
	Add a new pred_marker which indicates whether or not a
	predicate can only be accessed by its fully qualified name.

compiler/hlds_out.m:
compiler/intermod.m:
	Handle the new pred_marker.
2003-03-10 14:10:55 +00:00
Zoltan Somogyi
9b30970d46 Report an error if the user specifies debugging in a grade that doesn't
Estimated hours taken: 0.1
Branches: main

compiler/handle_options.m:
	Report an error if the user specifies debugging in a grade that doesn't
	support debugging.
2003-03-08 05:41:30 +00:00
Peter Ross
bc18ed5c89 Get the mercury compiler working with ROTOR, the MS shared source CLI
Estimated hours taken: 4
Branches: main

Get the mercury compiler working with ROTOR, the MS shared source CLI
implementation.

compiler/mlds_to_il.m:
	ROTOR doesn't allow calli calls to be made tail calls, so
	don't make them tail calls.

compiler/options.m:
	Add the option --support-rotor-clr which avoids generating
	code which can cause problems for the ROTOR CLR.

library/array.m:
	Fix some function signatures which were incorrectly declared
	as returning int rather than MR_bool, which the MS CLR accepts
	but ROTOR doesn't.

runtime/Mmakefile:
	Add a commented out rule for compiling mercury_il.il for
	ROTOR.

runtime/mercury_il.il:
	Add a `// REMOVE FOR ROTOR comment' to all the tail. prefixes
	associatied with calli instructions.

doc/user_guide.texi:
	Document --support-rotor-clr.
2003-03-05 15:55:22 +00:00
Peter Ross
45d1f9da7e Add an informational message about dead predicate elimation
Estimated hours taken: 0.1
Branches: main

compiler/mercury_compile.m:
	Add an informational message about dead predicate elimation
	when --verbose is specified.
2003-03-05 10:50:06 +00:00
Fergus Henderson
f92a6b33e7 Delete the definition of `_fltused'. This was only there to
Estimated hours taken: 1
Branches: main

compiler/mlds_to_managed.m:
runtime/mercury_mcpp.cpp:
	Delete the definition of `_fltused'.  This was only there to
	work around a bug in a beta release of MSVC++, and it doesn't
	seem to be needed anymore (I suppose the bug must have been fixed).
	Also defining `_fltused' causes problems for running Mercury
	on Portable.NET.
2003-03-03 14:33:28 +00:00
Fergus Henderson
7ab992a85f Improve the documentation about what's missing for accurate GC.
Estimated hours taken: 1
Branches: main

compiler/ml_elim_nested.m:
compiler/ml_code_gen.m:
	Improve the documentation about what's missing for accurate GC.
2003-03-03 14:33:16 +00:00
Fergus Henderson
ef490074d7 Fix an ISO C conformance error: C global variables need to be
Estimated hours taken: 0.1
Branches: main

compiler/process_util.m:
	Fix an ISO C conformance error: C global variables need to be
	declared as `extern' in the pragma foreign_decl, to avoid
	multiple definition errors on some systems (e.g. with tcc)
	if the foreign_decls get duplicated.
2003-03-03 14:09:25 +00:00
David Overton
e1b2823b85 Some changes related to module qualification.
Estimated hours taken: 2
Branches: main

Some changes related to module qualification.

These changes fix problems for the HAL library that were introduced by
the change to not module-qualify symbols when writing out interface
files.

compiler/prog_io_util.m:
	When parsing an inst, if it has the module-qualifier `builtin'
	try to parse it as a builtin inst.

compiler/mercury_to_mercury.m:
	When writing out inst declarations, if the inst on the
	left-hand-side of the declaration could be interpreted as a
	builtin inst when unqualified, then make sure it is output
	module-qualified so that it can be read back in correctly
	without generating an "attempt to redefine builtin inst" error.

tests/hard_coded/builtin_inst_rename.m:
tests/hard_coded/builtin_inst_rename2.m:
tests/hard_coded/Mmakefile.m:
	Test case.
2003-03-03 03:25:14 +00:00
Simon Taylor
ceaa856013 Move the setting of configuration options from mmc.in to
Estimated hours taken: 20
Branches: main

Move the setting of configuration options from mmc.in to
an options file Mercury.config. This has a few advantages:
- reduces the duplication between mmc and mercury.bat
- reduces the chance of running out of environment space
  on crappy operating systems (although we probably exceed
  the command line length limits on those systems anyway).
- makes it easier to bootstrap changes which add new
  configuration options.

Always read the options files, even without `--make',
to avoid inconsistent behaviour.

scripts/Mercury.config.in:
	New file containing the configuration code from mmc.in.

configure.in:
	Create scripts/Mercury.config.

bindist/Mmakefile:
	Make sure Mercury.config.in goes in the binary distribution.

Mmakefile:
bindist/Mmakefile:
Mmake.common.in:
	Make sure we get the correct setting of INSTALL_PREFIX
	when building the binary distribution.

scripts/Mmakefile:
scripts/mercury_config.in:
bindist/bindist.Mmakefile.in:
	Install Mercury.config.

compiler/options.m:
doc/user_guide.texi:
	Add documentation for the `--config-file' option, which gives
	the name of the configuration file to read.

	Add an option `read-config-file-2003-03-01' which will be
	used in configure.in to test whether the compiler is up
	to date after the configuration code is removed from mmc.in
	(after this change is installed everywhere).

	Add `--mercury-config-dir' as an abbreviation for
	`--mercury-configuration-directory'.

Mmake.workspace:
	Use the configuration file in scripts/Mercury.config.

browser/Mmakefile:
compiler/Mmakefile:
scripts/Mmake.vars.in:
	Always pass ALL_MCFLAGS to mmc so that mmc will
	use the configuration file specified in the options.

compiler/handle_options.m:
	Handle the default value of `--config-file'.

compiler/mercury_compile.m:
	Read the configuration file.

	Always read the options files, even without `--make',
	to avoid inconsistent behaviour.

compiler/make.m:
	Pass the variable settings from the configuration file
	to make__process_args.

	The options files have already been read in mercury_compile.m,
	so don't read them again here.

compiler/make.util.m:
	Add a version of build_with_module_options which doesn't
	need a make_info, for use by mercury_compile.m.

compiler/options_file.m:
	Export a predicate to read a single options file.

	Make the predicates to read options files add to an initial
	options_variables map, rather than always creating a new one.

	Allow MERCURY_STDLIB_DIR and MERCURY_CONFIG_DIR
	to be set in the options file or environment.

scripts/mmc.in:
	Set MERCURY_STDLIB_DIR and MERCURY_CONFIG_DIR in
	mercury_compile's environment.
2003-03-01 06:35:17 +00:00
Simon Taylor
9aeb2516ec Avoid dependencies on ll_backend.code_util in *hlds.*.
Estimated hours taken: 1
Branches: main

Avoid dependencies on ll_backend.code_util in *hlds.*.

compiler/code_util.m:
compiler/hlds_pred.m:
	Move the predicates to identify builtins into hlds_pred.m.

compiler/*.m:
	Update calls and remove unnecessary imports.
2003-02-28 06:40:43 +00:00
Simon Taylor
129f605d25 Fix bugs in the handling of purity in the optimization passes
Estimated hours taken: 8
Branches: main, release

Fix bugs in the handling of purity in the optimization passes
(in particular constraint propagation), which caused purity
annotations on goals to be lost. This caused
tests/tabling/unused_args to fail on earth.

compiler/hlds_goal.m:
	Make the version of goal_info_init called from
	the optimization passes take the purity as an
	argument. Previously, callers were constructing
	a goal_info then adding the purity, which was
	error prone.

compiler/hlds_goal.m:
compiler/purity.m:
	Move the predicates to deal with purity representation
	in hlds_goal_infos into hlds_goal.m. Rationale -
	goal_info_get_determinism is not in det_analysis.m,
	goal_info_get_nonlocals is not in quantification.m, etc.
	This makes it easier to make the purity setting code
	efficient.

	Don't allocate memory in add_goal_info_purity_feature
	if the call doesn't change the purity.

compiler/*.m:
	Pass the extra argument to goal_info_init.

compiler/polymorphism.m:
	Remove a duplicate definition of
	hlds_goal__make_int_const_construction.

compiler/magic.m:
	Remove some unused code.

tests/hard_coded/purity/Mmakefile:
tests/hard_coded/purity/Mercury.options:
tests/hard_coded/purity/purity_opt.{m,exp}:
	Test case.
2003-02-28 00:21:42 +00:00
Zoltan Somogyi
34a278b75b Add a facility for recording boolean flags in the RTTI structures
Estimated hours taken: 4
Branches: main

Add a facility for recording boolean flags in the RTTI structures
of type constructors. At the moment, the only flag records whether
the type constructor has a tag value reserved for HAL variables.
The flag is not used yet.

runtime/mercury_type_info.h:
	Add the extra field if MR_TYPE_CTOR_INFO_HAS_FLAG is defined.
	(The #ifdef will be deleted once bootstrapping is complete.)

runtime/mercury_mcpp.h:
	Add the extra field, since it will be needed after bootstrapping.

compiler/llds_out.m:
compiler/mlds_to_c.m:
	Define MR_TYPE_CTOR_INFO_HAS_FLAG for bootstrapping.

compiler/rtti.m:
	Add the field to the backend-independent RTTI description of
	type_ctor_infos, together with its encoding function.

compiler/type_ctor_info.m:
	Gather the information about the flags, for use when constructing
	the RTTI structure.

compiler/rtti_out.m:
	Add the flag field to the type_ctor_info structure for the LLDS backend.

compiler/rtti_to_mlds.m:
	Add the flag field to the type_ctor_info structure for the MLDS
	backends.

compiler/mlds_to_gcc.m:
	Add the flag field to the type_ctor_info structure for the gcc backend.

library/rtti_implementation.m:
	Add the flag field to list of fields of the type_ctor_info structure.
2003-02-26 06:37:01 +00:00
Fergus Henderson
5823c8a2e3 Perform loop invariant hoisting after inlining, since inlining
Estimated hours taken: 2
Branches: main

compiler/mercury_compile.m:
compiler/notes/compiler_design.html:
	Perform loop invariant hoisting after inlining, since inlining
	can create opportunities for loop invariant hoisting.

library/string.m:
	Implement string__index in Mercury, in terms of string__length,
	string__unsafe_index, and a new procedure string__index_check,
	rather than implementing in C.  string__index_check contains
	just the index checking code from the old string__index implementation.
	Implementing string__index in Mercury like this should allow the
	Mercury compiler to do loop invariant hoisting on the calls to
	string__length.

	Declare the output argument for string__unsafe_index
	and string__index_det with mode `uo', to match string__index.
	For unsafe__index, this change was needed now that string__index is
	implemented in terms of string__unsafe_index.
2003-02-22 13:54:45 +00:00
Simon Taylor
660a24a7ad Fix a bug reported by Michael Day which caused spurious
Estimated hours taken: 8
Branches: main, release

Fix a bug reported by Michael Day which caused spurious
"predicate multiply defined" errors if there were predicates
`module1.p' and `module2.module1.p'.

compiler/hlds_module.m:
	For each of the predicate table search predicates which
	takes a module, add an extra argument which states whether
	the module name passed in is fully qualified. If it is, then
	a search for `module1.p' will not return `module2.module1.p'.
	The module name is guaranteed to be fully qualified for
	the head of predicate, clause, etc. items, and for calls
	occurring in `.opt' files.

	Add a predicate `lookup_builtin_pred_proc_id', for
	looking up the builtin predicates in the predicate table.

compiler/goal_util.m:
	Move code to look up builtin predicates into hlds_module.m.

	Set the builtin_state field of the call goal returned
	by generate_simple_call correctly.

compiler/hlds_pred.m:
	Add a function `calls_are_fully_qualified' which takes
	an import_status, and returns whether calls from goals
	with that status are always fully qualified, which is
	true iff the call is in a `.opt' file.

compiler/prog_io.m:
	Module qualify the sym_names in `:- external' items.

compiler/*.m:
	Fill in the extra argument of predicate table searches.

	Use `lookup_builtin_pred_proc_id' rather than
	`predicate_table_search_*'.

compiler/prog_util.m:
	Add function versions of mercury_*_builtin_module.

compiler/polymorphism.m:
compiler/simplify.m:
compiler/unify_proc.m:
	Use goal_util__generate_simple_call to call builtins,
	rather than duplicating the code.

tests/valid/Mmakefile:
tests/valid/nested_module_bug.m:
tests/valid/intermod_bug_nested.m:
	Test cases.
2003-02-22 13:18:34 +00:00
Fergus Henderson
4ac56ddf67 Fix a bug where the stub code generated with `--allow-stubs'
Estimated hours taken: 0.5
Branches: main

Fix a bug where the stub code generated with `--allow-stubs'
was violating an invariant that polymorphism pass was relying on.

compiler/polymorphism.m:
	Allow unifications whose kind (construction, deconstruction,
	simple_test, etc.) has already been determined.
2003-02-22 08:15:55 +00:00
Simon Taylor
f2b8ce92b4 Fix a bug which caused an abort on unifications of the form
Estimated hours taken: 1
Branches: main, release

compiler/typecheck.m:
	Fix a bug which caused an abort on unifications of the form
	`X = X', where `X' hadn't been seen before in the goal.

tests/valid/Mmakefile:
tests/valid/id_type_bug.m:
	Test case.
2003-02-22 01:06:10 +00:00
Fergus Henderson
206299172a Fix a bug that broke building with --use-subdirs.
Estimated hours taken: 0.25
Branches: main

Fix a bug that broke building with --use-subdirs.

compiler/Mmakefile:
	Add -I$(ANALYSIS_DIR)/$(mihs_subdir), as well as -I$(ANALYSIS_DIR),
	to CFLAGS.  Previously it was only adding -I$(ANALYSIS_DIR).
2003-02-21 21:11:57 +00:00
Fergus Henderson
562dbe059a Fix a bug that broke tests/hard_coded/ho_soln (amongst others)
Estimated hours taken: 2
Branches: main

Fix a bug that broke tests/hard_coded/ho_soln (amongst others)
in grade hlc.agc.

compiler/handle_options.m:
	If accurate GC is enabled, disable heap reclamation on failure.
	This is needed because accurate GC currently doesn't support
	heap reclamation on failure.
2003-02-21 05:13:25 +00:00
Fergus Henderson
f6d1e29598 Add support for two new compiler options,
Estimated hours taken: 4
Branches: main

Add support for two new compiler options,
`--allow-stubs' and `--no-warn-stubs',
to allow execution of programs which are incomplete.

`--allow-stubs' delays the reporting of errors for procedures with no
clauses until run-time, instead issuing only a warning at compile time.
`--no-warn-stubs' allows even that warning to be supressed.

library/private_builtin.m:
	Add a new procedure no_clauses/1, for reporting the
	run-time error.

compiler/options.m:
	Add and document the new options.

compiler/typecheck.m:
	Implement the new options.  For procedures with no
	clauses, if `--allow-stubs' is enabled, generate a
	stub body which just calls no_clauses/1 or sorry/1.

compiler/hlds_pred.m:
	Add a new marker `stub', for procedures whose body is an
	automatically-generated stub.

compiler/purity.m:
compiler/det_report.m:
compiler/unused_args.m:
	Don't issue warnings for `stub' procedures.

NEWS:
doc/user_guide.texi:
	Document the new options.

doc/reference_manual.texi:
	Document that there must be at least one clause for each
	declared predicate or function, since as far as I can tell
	this was until now not explicitly stated in the reference
	manual.  Also document that implementations are permitted
	to provide a method of processing Mercury programs for
	which this error is not reported until runtime.

tests/warnings/Mmakefile:
tests/warnings/Mercury.options:
tests/warnings/warn_stubs.m:
tests/warnings/warn_stubs.exp:
tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
tests/hard_coded/allow_stubs.m:
tests/hard_coded/allow_stubs.exp:
	Test the new features.
2003-02-21 05:11:59 +00:00
Fergus Henderson
e850179f90 Add support for two new compiler options,
Estimated hours taken: 4
Branches: main

Add support for two new compiler options,
`--allow-stubs' and `--no-warn-stubs',
to allow execution of programs which are incomplete.

`--allow-stubs' delays the reporting of errors for procedures with no
clauses until run-time, instead issuing only a warning at compile time.
`--no-warn-stubs' allows even that warning to be supressed.

compiler/hlds_out.m:
compiler/intermod.m:
	One-line additions to handle the new `stub' marker.
	(I forgot to include these when I committed the
	other files in this change.)

library/private_builtin.m:
	Add a new procedure no_clauses/1, for reporting the
	run-time error.

compiler/options.m:
	Add and document the new options.

compiler/typecheck.m:
	Implement the new options.  For procedures with no
	clauses, if `--allow-stubs' is enabled, generate a
	stub body which just calls no_clauses/1 or sorry/1.

compiler/hlds_pred.m:
	Add a new marker `stub', for procedures whose body is an
	automatically-generated stub.

compiler/purity.m:
compiler/det_analysis.m:
compiler/unused_args.m:
	Don't issue warnings for `stub' procedures.

NEWS:
doc/user_guide.texi:
	Document the new options.

doc/reference_manual.texi:
	Document that there must be at least one clause for each
	declared predicate or function, since as far as I can tell
	this was until now not explicitly stated in the reference
	manual.  Also document that implementations are permitted
	to provide a method of processing Mercury programs for
	which this error is not reported until runtime.

tests/warnings/Mmakefile:
tests/warnings/Mercury.options:
tests/warnings/warn_stubs.m:
tests/warnings/warn_stubs.exp:
tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
tests/hard_coded/allow_stubs.m:
tests/hard_coded/allow_stubs.exp:
	Test the new features.
2003-02-21 04:23:13 +00:00
Fergus Henderson
f2dcf99fed Add support for two new compiler options,
Estimated hours taken: 9
Branches: main

Add support for two new compiler options,
`--allow-stubs' and `--no-warn-stubs',
to allow execution of programs which are incomplete.

`--allow-stubs' delays the reporting of errors for procedures with no
clauses until run-time, instead issuing only a warning at compile time.
`--no-warn-stubs' allows even that warning to be supressed.

library/private_builtin.m:
	Add a new procedure no_clauses/1, for reporting the
	run-time error.

compiler/options.m:
	Add and document the new options.

compiler/typecheck.m:
	Implement the new options.  For procedures with no
	clauses, if `--allow-stubs' is enabled, generate a
	stub body which just calls no_clauses/1 or sorry/1.

compiler/hlds_pred.m:
	Add a new marker `stub', for procedures whose body is an
	automatically-generated stub.

compiler/purity.m:
compiler/det_analysis.m:
compiler/unused_args.m:
	Don't issue warnings for `stub' procedures.

NEWS:
doc/user_guide.texi:
	Document the new options.

doc/reference_manual.texi:
	Document that there must be at least one clause for each
	declared predicate or function, since as far as I can tell
	this was until now not explicitly stated in the reference
	manual.  Also document that implementations are permitted
	to provide a method of processing Mercury programs for
	which this error is not reported until runtime.

tests/warnings/Mmakefile:
tests/warnings/Mercury.options:
tests/warnings/warn_stubs.m:
tests/warnings/warn_stubs.exp:
tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
tests/hard_coded/allow_stubs.m:
tests/hard_coded/allow_stubs.exp:
	Test the new features.
2003-02-21 01:57:38 +00:00
Fergus Henderson
13151d9a6d Add a work-around for a bug where it was passing Unix-style file
Estimated hours taken: 1
Branches: main

compiler/passes_aux.m:
	Add a work-around for a bug where it was passing Unix-style file
	redirection ("... > file 2>&1") to io__call_system_return_signal,
	which doesn't work with the .NET back-end.
2003-02-19 07:42:42 +00:00
Fergus Henderson
e132bebac7 Add `ils' target, for use by tools/bootcheck.
Estimated hours taken: 1
Branches: main

analysis/Mmakefile:
compiler/Mmakefile:
browser/Mmakefile:
profiler/Mmakefile:
	Add `ils' target, for use by tools/bootcheck.

library/Mmakefile:
	Add a missing dependency to ensure that we build all of the
	`.int*' files for the `il' grade (it was forgetting to build
	`library.int3').
	Also, add a target to build the library as an executable,
	so that you can run PEverify on it (PEverify doesn't
	work properly on multi-file assemblies unless they
	are executables).
2003-02-19 06:31:22 +00:00
Mark Brown
740eec02fe Add the new 'cord' module to the standard library.
Estimated hours taken: 0.1
Branches: main

compiler/modules.m:
library/library.m:
	Add the new 'cord' module to the standard library.
2003-02-19 05:54:40 +00:00
Ralph Becket
87b2e741f4 Fixed a bug in the state variables transformation whereby
Estimated hours taken: 4
Branches: main

compiler/make_hlds.m:
	Fixed a bug in the state variables transformation whereby
	if-then-else expressions were not being handled properly and
	causing information about state variables to be lost.
2003-02-19 05:15:48 +00:00
Simon Taylor
cead9469ee Fix a bug which caused `--rebuild' to be disabled.
Estimated hours taken: 0.25
Branches: main

compiler/handle_options.m:
	Fix a bug which caused `--rebuild' to be disabled.

tests/mmc_make/Mmakefile:
tests/mmc_make/rebuild.m:
	Test case.
2003-02-19 03:15:34 +00:00
Simon Taylor
964985f01c Don't write the .d' file when making the .opt' file.
Estimated hours taken: 0.25
Branches: main, release

compiler/mercury_compile.m:
	Don't write the `.d' file when making the `.opt' file.
	When building the `.opt' file we don't have enough
	information to work out the transitive implementation
	dependencies.
2003-02-18 15:11:21 +00:00
Fergus Henderson
bb32f25fe6 Use -I<directory>' rather than -I <directory>' in CFLAGS,
Estimated hours taken: 0.5
Branches: main

compiler/Mmakefile:
	Use `-I<directory>' rather than `-I <directory>' in CFLAGS,
	because lcc doesn't allow a space after the `-I'.
2003-02-17 15:27:19 +00:00
Simon Taylor
fd29bedc88 Fix a bug reported by Zoltan which caused warning/optimization
Estimated hours taken: 0.5
Branches: main

compiler/common.m:
	Fix a bug reported by Zoltan which caused warning/optimization
	of duplicate calls to fail if the arguments of the calls were
	duplicated constants.

tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/duplicate_const.{m,exp}:
	Test case.
2003-02-17 06:20:06 +00:00
Simon Taylor
6f3d876533 Fix a bug in inter-mdule optimization reported by Michael Day.
Estimated hours taken: 2
Branches: main, release

Fix a bug in inter-mdule optimization reported by Michael Day.

compiler/intermod.m:
	Write declarations for `exported_to_submodules' predicates
	and functions to the `.opt' file.

tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/intermod_nested{,2}.m:
	Test case.
2003-02-17 06:07:15 +00:00
Simon Taylor
d501593521 Return the correct exit status if errors are reported
Estimated hours taken: 0.25
Branches: main, release

compiler/mercury_compile.m:
	Return the correct exit status if errors are reported
	when building the `.opt' file.

tests/hard_coded/foreign_type.m:
	Fix a compilation error which did not cause a failure
	before this change.

tests/invalid/Mmakefile:
tests/invalid/make_opt_error.{m,err_exp}:
 	Test case.
2003-02-17 06:02:23 +00:00
Simon Taylor
0763baf360 Disable `--optimize-duplicate-calls'.
Estimated hours taken: 0.25
Branches: main, release

compiler/options.m:
	Disable `--optimize-duplicate-calls'.
	While inst `array' is defined as `ground', we
	optimizing duplicate calls might combine
	calls to `array.init'.

tests/hard_coded/Mmakefile:
tests/hard_coded/uniq_duplicate_call.{m,exp}:
 	Test case.
2003-02-17 03:36:45 +00:00
Simon Taylor
8fa09a6d61 My change to make --mercury-linkage shared' imply --pic-reg'
Estimated hours taken: 0.25
Branches: main

compiler/handle_options.m:
	My change to make `--mercury-linkage shared' imply `--pic-reg'
	was incorrect because `mmc --make --mercury-linkage shared libfoo.a'
	would use `--pic-reg' when creating the object files in libfoo.a.
2003-02-16 13:04:36 +00:00
Fergus Henderson
bbb0bc267c Fix a bug in my previous change, which stopped it compiling in
Estimated hours taken: 0.25
Branches: main

compiler/stack_layout.m:
	Fix a bug in my previous change, which stopped it compiling in
	non-IL grades.
2003-02-16 04:57:32 +00:00
Fergus Henderson
1c21289010 Various fixes for the .NET back-end.
Estimated hours taken: 4
Branches: main

Various fixes for the .NET back-end.

compiler/passes_aux.m:
	Provide Mercury clauses as alternatives to C foreign_proc code
	for `use_win32'.

compiler/top_level.m:
compiler/mercury_compile.m:
	Work-around a bug with the Mercury compiler's .NET back-end:
	Define `main' in toplevel.m, rather than in `mercury_compile.m',
	because the .NET back-end assumes that `main' will be defined in
	the top-level module.
	XXX This is not the right fix, because it makes `main' and `io.*'
	visible in all the child modules of `toplevel.m', which is not
	desirable.

compiler/mercury_compile.m:
	Add Mercury clauses for gc_init.

compiler/modules.m:
	Don't warn about the fact that io__file_modification_time not
	being implemented causes problems for smart recompilation,
	unless we're actually compiling with smart recompilation enabled.
2003-02-16 02:16:36 +00:00
Fergus Henderson
90d353d06c Implement concat_strings in Mercury.
Estimated hours taken: 2
Branches: main

compiler/stack_layout.m:
	Implement concat_strings in Mercury.

compiler/layout.m:
compiler/layout_out.m:
compiler/stack_layout.m:
	Use a separate type `string_with_0s' rather than `string'
	for strings which may contain null characters.
2003-02-16 02:14:16 +00:00
Fergus Henderson
a18332a294 Various fixes for the .NET back-end.
Estimated hours taken: 3
Branches: main

Various fixes for the .NET back-end.

compiler/Mmakefile:
	For IL grades, use editbin to set the stack size to 100M,
	since the default (1M) is too small.
	Also, don't try to build mlds_to_gcc in IL grades -- gcc.m won't
	compile, because the IL grades don't support the C interface.

library/Mmakefile:
	Add some missing dependencies.

profiler/Mmakefile:
deep_profiler/Mmakefile:
	Conditionalize some dependencies that were bogus for IL grades.

library/.cvsignore:
compiler/.cvsignore:
profiler/.cvsignore:
deep_profiler/.cvsignore:
analysis/.cvsignore:
browser/.cvsignore:
samples/.cvsignore:
	Various minor updates to ignore files produced when building in
	IL grades.
2003-02-15 23:59:41 +00:00
Fergus Henderson
bd47ce1998 Fix yet another place where the MLDS back-end was generating
Estimated hours taken: 0.5
Branches: main

compiler/ml_unify_gen.m:
	Fix yet another place where the MLDS back-end was generating
	references to `dummy_var', for construction unifications containing
	arguments with dummy types such as `io__state'.
2003-02-14 13:34:48 +00:00
Fergus Henderson
a53ed3fa5b Fix a bug where the MLDS back-end was generating references
Estimated hours taken: 0.75
Branches: main

compiler/ml_unify_gen.m:
	Fix a bug where the MLDS back-end was generating references
	to `dummy_var', for deconstruction unifications containing
	arguments with dummy types such as `io__state'.  Referencing a
	dummy variable is OK for `--low-level-data', but it doesn't work
	with `--high-level-data' (e.g. for the .NET back-end), because
	we'd need different dummy variables for each different type.
	It's better to avoid generating such assignments in the first
	place.
2003-02-14 12:48:55 +00:00
Fergus Henderson
158f557c9e Fix a bug where the MLDS back-end was generating references to `dummy_var',
Estimated hours taken: 1
Branches: main

Fix a bug where the MLDS back-end was generating references to `dummy_var',
for calls to builtins such as unsafe_promise_unique and unsafe_type_cast
with dummy types such as `io__state'.  Referencing a dummy variable is OK for
`--low-level-data', but it doesn't work with `--high-level-data' (e.g. for
the .NET back-end), because we'd need different dummy variables for each
different type.  It's better to avoid generating such assignments in the
first place.

compiler/ml_code_gen.m:
	Avoiding generating references to dummy_var for calls to
	unsafe_type_cast.

compiler/ml_call_gen.m:
	Avoiding generating references to dummy_var for calls to other
	builtins, such as unsafe_promise_unique.
2003-02-14 09:59:21 +00:00
Fergus Henderson
ddb677279c Ensure that in MLDS grades, arguments with arg_mode `top_unused' do not
Estimated hours taken: 2
Branches: main

Ensure that in MLDS grades, arguments with arg_mode `top_unused' do not
get passed.

Previously, different parts of the compiler had different and inconsistent
ideas about if/how they should get passed, which caused problems,
including an internal error for tests/hard_coded/foreign_type2.m in grade
`java'.  The comments in mlds.m said they should not get passed, the
code in ml_call_gen.m passed them as if they were output arguments, and
the code in ml_code_util declared them as if they were input arguments.

compiler/hlds_pred.m:
	Add some detailed comments about the meaning of the `arg_mode' type.

compiler/ml_call_gen.m:
compiler/ml_code_util.m:
compiler/ml_code_gen.m:
	Ensure that arguments with arg_mode `unused' do not get passed,
	declared, or converted (respectively).

runtime/mercury_grade.h:
	Bump the binary compatibility version number for MLDS grades.
	This is needed because the calling convention for procedures
	with `unused' mode arguments has changed.
2003-02-14 09:58:41 +00:00
Fergus Henderson
c330b2c7f2 Various bug fixes for the `il' grade.
Estimated hours taken: 20
Branches: main

Various bug fixes for the `il' grade.
These get us closer to bootstrapping on .NET.

Mmake.workspace:
	Set MERC_C_INCL_DIR and MERC_DLL_DIR, since these are needed
	when building in grade `il'.

library/Mmakefile:
	Fix the dependencies for `mercury.dll' to avoid relinking it
	every time `mmake' gets invoked.

library/io.m:
	- Implement io__rename_file in C#.
	- Change io__file_modification_time so that on .NET it returns
	  an error rather than throwing an exception.
	- Fix some bugs in the MC++ code for mercury_getchar():
	  - add a missing "break" statement
	  - update the line count correctly when reading a character
	    after it has been put back by io__putback_char.
	  - compute line numbers correctly even for text files formatted
	    differently than the environment expects, e.g. those that use
	    Unix-style bare LF rather than Windows-style CR-LF.

trace/Mmakefile:
	Ensure that in `il' grade we don't build anything in this directory.

compiler/Mmakefile:
	Conditionalize some dependencies that were bogus for the `il' grade.
	Add a work-around for the lack of Mmake support for
	`--transitive-intermodule-optimization'.

compiler/bytecode_data.m:
	Provide Mercury clauses (that just call sorry/1) as an alternative
	to C foreign_proc code for `float_to_float64_bytes'.

compiler/process_util.m:
	Fix a mode error and a missing import that only showed up in `il'
	grade, since they occured in Mercury clauses which are only used
	on back-ends which don't support the C interface.
2003-02-13 08:28:43 +00:00
Fergus Henderson
6f76881b7d Add "private_builtin.ref/1" to the list of built-in types
Estimated hours taken: 1.5
Branches: main

compiler/mlds_to_il.m:
	Add "private_builtin.ref/1" to the list of built-in types
	whose type_ctor_infos are defined in MC++ code.
2003-02-13 06:03:10 +00:00