Commit Graph

541 Commits

Author SHA1 Message Date
Tyson Dowd
e9d95ada12 Change calls to mercury::runtime::convert to System::Covert.
Estimated hours taken: 2
Branches: main

library/builtin.m:
library/private_builtin.m:
library/sparse_bitset.m:
library/string.m:
	Change calls to mercury::runtime::convert to System::Covert.
	Use __box instead of mercury::runtime::Convert::ToObject

runtime/Mmakefile:
	Add a rule to remove the DOTNET_DLLS for clean_local.

runtime/mercury_il.il:
	Remove ConvertImpl class, use unbox and ldobj instead of ToInt32.

runtime/mercury_mcpp.cpp:
	Remove Convert class.

runtime/mercury_mcpp.h:
	Use __box instead of mercury::runtime::Convert::ToObject

scripts/Mmake.rules:
	Put the local include directory before the installed one when
	compiling with MC++.
	Also fix the rule for .cpp.dll to be the same as the subdir
	rule.
2001-07-31 10:08:03 +00:00
Simon Taylor
8ba417ad67 Fix a bug in my change to add timestamps for `.c' files
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.rules:
	Fix a bug in my change to add timestamps for `.c' files
	which broke `--use-subdirs'.
2001-07-28 06:55:17 +00:00
Fergus Henderson
0b107322f4 Fix a typo: missing line continuation in error message.
Estimated hours taken: 0.1
Branches: main

scripts/mmake.in:
	Fix a typo: missing line continuation in error message.
2001-07-27 17:06:17 +00:00
Fergus Henderson
8b45bd6016 Fix a bug which occurred when combining --target asm with --use-subdirs.
Branches: main, release
Estimated hours taken: 1

Fix a bug which occurred when combining --target asm with --use-subdirs.

scripts/Mmake.rules:
compiler/modules.m:
	The .pic_s files go in the `pic_ss' subdirectory,
	not in the `ss' subdirectory.

scripts/Mmake.vars.in:
	Add `pic_ss_subdir' variable.
2001-07-27 16:06:29 +00:00
Fergus Henderson
080a9de8e1 Fix a typo in the definition of ss_subdir.
Estimated hours taken: 0.1
Branches: main, release

scripts/Mmake.vars.in:
	Fix a typo in the definition of ss_subdir.
	This broke things if you tried to use --target asm with --use-subdirs.
2001-07-27 15:40:26 +00:00
mercury
76b287a421 Fix a bug with the GCC back-end Mmake support that seems to have been
Branches: main
Estimated hours taken: 2

Fix a bug with the GCC back-end Mmake support that seems to have been
triggered somehow by stayl's .c_date changes.

scripts/Mmake.rules:
	For the *__c_code.{o,pic_o} targets, depend on the .s/.pic_s
	file rather than the .c file, since the .c file is generated
	as a side effect of generating the .s/.pic_s file.
2001-07-27 06:12:31 +00:00
Tyson Dowd
66bbcfc26d Merge the changes to support csharp building into the main branch
Estimated hours taken: 4
Branches: main

Merge the changes to support csharp building into the main branch
of the compiler.

compiler/modules.m:
	Write the CSHARP_ASSEMBLY_REFS-modulename for each C# foreign
	module.

scripts/Mmake.rules:
	Add rules to build C# DLLs.
2001-07-24 14:19:23 +00:00
Peter Ross
2c5af924c0 Remove the .foreign_os target.
Estimated hours taken: 0.25
Branches: main

Remove the .foreign_os target.

compiler/modules.m:
    Don't generate any references to .foreign_os.

scripts/Mmake.rules:
    Remove the .obj file which is created as a side effect by MSVC.
2001-07-18 09:37:34 +00:00
Peter Ross
7fe31d3493 Fix mmake rules to install the ilc grade.
Estimated hours taken: 2.5
Branches: main

Fix mmake rules to install the ilc grade.

library/Mmakefile:
    No longer build mercury_all.dll, instead just use the individual
    library dlls directly as the fixed limit in gacutil has been
    removed.
    Install mercury.dll in the gac.

scripts/Mmake.vars.in:
    Set the location of the mercury library DLLs correctly.

runtime/Mmakefile:
    For the IL backend make install_headers depend on install_lib so
    that the headers get installed during the grade install process.
2001-07-18 08:13:46 +00:00
Peter Ross
9e20b981ea Add mmake support for building modules which contain foreign code on the
Estimated hours taken: 5
Branches: main

Add mmake support for building modules which contain foreign code on the
IL backend.
Note that currently we don't install mercury_il.dll and mercury_mcpp.dll
somewhere where the C compiler can find them, so this change doesn't
work out of the box.

compiler/mlds_to_ilasm.m:
    Change the output file name for cpp files to <modulename>__cpp_code.cpp

compiler/mlds_to_mcpp.m:
    No longer output a reference to <modulename>.dll, as the cpp code
    doesn't refer to any of the entities defined in this dll.

compiler/modules.m:
    If a module contains some foreign code and we are on the IL backend
    generate a dependency which causes the foreign code dll to be built.
    Generate the make variable .foreign, .foreign_cs, .foreign_os and
    .foreign_dlls which refer to all the foreign modules.
    Generate rules to clean the foreign modules up.

scripts/Mmake.rules:
    Turn some unix paths into windows paths.

library/Mmakefile:
    Use the new .foreign variables to build the library instead of the
    previous hacks.
2001-07-17 15:40:38 +00:00
Peter Ross
03f1a1ece3 Improve the mmake support for the IL backend.
Estimated hours taken: 4
Branches: main

Improve the mmake support for the IL backend.
We still need to add code to do the pragma foreign code.

configure.in:
    To determine the extension off executable files use the new macro
    AC_EXEEXT.

compiler/modules.m:
    In the .dep file add a check to see if we are compiling in an IL
    grade.  If so, use a different top level rule.
    Add rules to generate, remove and so on all the .dll files.

scripts/Mmake.vars.in:
    Minor changes.
2001-07-17 08:56:32 +00:00
Zoltan Somogyi
142f66e8e6 Document why we don't uninstall $(EMACS_SCRIPTS) here.
Estimated hours taken: 0.2
Branches: main

scripts/Mmakefile:
	Document why we don't uninstall $(EMACS_SCRIPTS) here.
2001-07-16 08:08:47 +00:00
Zoltan Somogyi
1a0b253854 Add rules for installing the deep profiler from source. (Installing it from
Estimated hours taken: 2
Branches: main

Add rules for installing the deep profiler from source. (Installing it from
binary distributions is future work.)

configure.in:
	Add an option, --enable-deep-profiler=/path/name, that specifies the
	path name of the directory in which the CGI script should be installed
	(the default is apache's /usr/lib/cgi-bin).

	Report an error if the user requests deep profiling but it is not
	available.

Mmakefile:
	Remind the user to copy the CGI script to its directory.

scripts/Mmakefile:
	Document why we can't install the CGI script automatically.

	Be consistent about the order of rules.

scripts/Mmake.vars.in:
	Record the CGI directory for use in the toplevel Mmakefile.

scripts/mdprof.in:
	Record that mdprof_cgi and mdprof_server are installed in the directory
	for non-user-visible programs, alongside mercury_compile and
	mercury_profile.
2001-07-09 04:58:52 +00:00
Simon Taylor
6e46b775b6 Fix a bug in my change to add timestamps for `.c' files.
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.rules:
	Fix a bug in my change to add timestamps for `.c' files.
	Create the subdirectories for the `.c_date', `.il_date',
	`.s_date' and `.pic_s_date' files when running `mmake depend'
	to work around a GNU make bug. (This duplicates similar code
	for `.date' etc. files).

	Fix a typo in the rules for `.pic_s' files.
2001-07-08 11:02:25 +00:00
Simon Taylor
120e4abf0c Fix a bug in my last change - add .PRECIOUS rules for
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.rules:
	Fix a bug in my last change - add .PRECIOUS rules for
	the new date stamp files to stop make removing them.
2001-07-07 05:50:51 +00:00
Simon Taylor
4a7fb746f9 Use a timestamp file mechanism similar to that used for `.int' files
Estimated hours taken: 3

Use a timestamp file mechanism similar to that used for `.int' files
to avoid rechecking whether a module needs to be recompiled on each
mmake if no used interfaces have changed.

compiler/mercury_compile.m:
	Touch a `.c_date', `.il_date', `.s_date' or `.pic_s_date' file
	after compilation has finished.

compiler/recompilation_check.m:
	Touch a `.c_date', `.il_date', `.s_date' or `.pic_s_date' file
	if a module does not need to be recompiled.

compiler/modules.m:
scripts/Mmake.rules:
	Set up the make dependencies for timestamp files, in a similar
	manner to the `.date' files.

	Remove the timestamp files in the `clean' mmake target.

	Handle `.s' and `.pic_s' files as for the `.o' files
	when using `--target asm'. There are no `.s' or `.pic_s'
	files for nested modules.

scripts/Mmake.vars.in:
	Set up the subdir variables for the timestamp files.

Mmakefile:
scripts/mercury_cleanup_install:
	Save/restore the timestamp files and the `.used' files
	across the library grade installation.

configure.in:
	Remove the `.c_date' files for the `.c' files that
	need to be rebuilt.

doc/user_guide.texi:
	Document the new file extensions.
2001-07-06 11:25:36 +00:00
Fergus Henderson
aa6193d139 When searching for the clauses that match a given predicate
Estimated hours taken: 0.5
Branches: main

scripts/mtags:
	When searching for the clauses that match a given predicate
	declaration, assume that the clause has the same number of
	qualifiers as the declaration.  This is more likely to be
	correct than always assuming that the clause has the same
	number of qualifiers as the call, which is what we did previously.

	(The ideal thing to do here would be to search for clauses with
	any number of qualifiers, but that is tricky to do right, because
	the right operator to use for disjunction in the search pattern
	varies depending on the exact vim options set; it could be either
	"|" or "\|".)
2001-07-05 18:13:52 +00:00
Zoltan Somogyi
48dc5aae2c Fix a problem that used to cause installs into not-yet-created directories
Estimated hours taken: 0.5
Branches: main

Fix a problem that used to cause installs into not-yet-created directories
to fail.

scripts/Mmake.rules:
	Instead of invoking $(MC) --errorcheck-only when creating .err files,
	invoke the macros $(MCE).

scripts/Mmake.vars:
	Define the default value of $(MCE) as $(MC) --errorcheck-only.

compiler/Mmakefile:
	Override the default value of $(MCE) to specify the search path,
	just as all the other invocations of the Mercury compiler in this
	directory do. The absence of such override could lead to a raft
	of messages about interface files not being found when trying to
	create maybe_mlds_to_gcc.err.
2001-07-03 09:49:41 +00:00
Simon Taylor
9dd11b2fc6 Smart recompilation. Record version numbers for each item
Estimated hours taken: 400

Smart recompilation. Record version numbers for each item
in interface files. Record which items are used in each compilation.
Only recompile a module if the output file does not exist or
nothing has changed.

There is still some work to do on this:
- it doesn't work with inter-module optimization.
- it doesn't work when the module name doesn't match the file name.
  (this problem will go away when mmake functionality is moved into
  the compiler.

I'll hold off documenting this change in the NEWS file and
on the web page for a month or so, until I've had a bit more
experience using it.

compiler/options.m:
compiler/handle_options.m:
doc/user_guide.texi:
	Add an option `--smart-recompilation', currently off by default.

	Add an internal option `--generate-version-numbers' to control
	whether version numbers are written to the interface files. If
	`--smart-recompilation' is disabled because the module
	is being compiled with `--intermodule-optimization' (e.g. in the
	standard library), we still want to write the version numbers
	to the interface files.

	Add an option `--verbose-recompilation' (default off)
	to write messages describing why recompilation is needed.

	Add an option `--warn-smart-recompilation' (default on)
	to control warnings relating to the smart recompilation
	system. Warn if smart recompilation will not work with
	the output and inter-module optimization options given.

compiler/recompilation.m:
	Type declarations for smart recompilation.
	Predicates to record program items used by compilation.

compiler/recompilation_version.m:
	Compute version numbers for program items in interface files.

compiler/recompilation_usage.m:
	Find all items used by a compilation.

compiler/recompilation_check.m:
	Check whether recompilation is necessary.

compiler/timestamp.m:
	Timestamp ADT for smart recompilation.

compiler/mercury_compile.m:
	Invoke the smart recompilation passes.

compiler/modules.m:
compiler/prog_io.m:
	Return timestamps for modules read.

	When reading a module make sure the current input stream
	is reset to its old value, not stdin.

	Handle version number items in interface files.

compiler/module_qual.m:
compiler/unify_proc.m:
compiler/make_hlds.m:
	Record all items used by local items.

compiler/make_hlds.m:
	Process `:- pragma type_spec' declarations in
	add_item_list_clauses. The qual_info is needed
	when processing `:- pragma type_spec' declarations
	so that any equivalence types used by the declaration
	can be recorded as used by the predicate or function to
	which the `:- pragma type_spec' applies.

compiler/equiv_type.m:
	For each imported item, record which equivalence types
	are used by that item.

compiler/hlds_module.m:
	Add a field to the module_info to store information about
	items used during compilation of a module.

compiler/check_typeclass.m:
	Make sure any items used in clauses for typeclass method
	implementations are recorded in the `.used' file.

compiler/prog_data.m:
compiler/*.m:
	Factor out some duplicated code by combining the
	pred and func, and pred_mode and func_mode items.

	Make it easier to extract the name of a type, inst or mode
	from its declaration.

	Add an item type to hold the version numbers for an interface file.

	Allow warnings to be reported for `nothing' items (used for
	reporting when version numbers are written using an
	obsolete format).

compiler/prog_io.m:
compiler/prog_io_util.m:
compiler/typecheck.m:
compiler/type_util.m:
compiler/*.m:
	Strip contexts from all types, not just those in class constraints.
	This makes it possible to use ordinary unification to check
	whether items have changed (with the exception of clauses).

	Remove code to create types with contexts in typechecking.

	Remove code scattered through the compiler to remove contexts
	from types in class constraints.

compiler/hlds_pred.m:
compiler/prog_util.m:
	Move hlds_pred__adjust_func_arity to prog_util, so that it
	can be used by the pre-hlds passes.

compiler/typecheck.m:
compiler/hlds_module.m:
	Move typecheck__visible_modules to hlds_module.m, so it can
	be used by recompilation_usage.m.

compiler/typecheck.m:
	Add a comment telling where updates may be required if the
	code to typecheck a var-functor unification changes.

compiler/error_util.m:
	Allow writing messages without contexts (used for the verbose
	recompilation messages).

	Add functions to format sym_name and sym_name_and_arity,
	and to add punctuation to the end of an error message
	without unwanted line breaks before the punctuation.

scripts/Mmake.rules:
compiler/modules.m:
	Don't remove the output file before running the compiler. We need
	to leave the old output file intact if smart recompilation detects
	that recompilation is not needed.

compiler/notes/compiler_design.html:
	Document the new modules.

library/io.m:
NEWS:
	Add predicates to find the modification time of files
	and input_streams.

library/set.m:
NEWS:
	Add a predicate version of set__fold

	Don't sort the output of set__filter, it's already sorted.

library/std_util.m:
NEWS:
	Add a predicate `std_util__map_maybe/3' and a function
  	`std_util__map_maybe/2' to apply a predicate or a function to
    	a value stored in a term of type `std_util__maybe'.

configure.in:
runtime/mercury_conf.h.in:
runtime/RESERVED_MACRO_NAMES:
	When checking whether the compiler is recent enough, check for
	the --warn-smart-recompilation option.

	Check for stat().

library/Mmakefile:
	Disable warnings about smart recompilation not working with
	`--intermodule-optimization'.

browser/Mmakefile:
	Disable warnings about smart recompilation not working when
	the module name doesn't match the file name.

runtime/mercury_string.h:
	Add a macro MR_make_string_const() which automates computation
	of the length of string argument to MR_string_const().

tests/recompilation/Mmakefile:
tests/recompilation/runtests:
tests/recompilation/test_functions:
tests/recompilation/TESTS:
tests/recompilation/README:
	A framework for testing smart recompilation.
	The option currently only works for the recompilation directory.

tests/recompilation/TEST.m.{1,2}:
tests/recompilation/TEST_2.m.{1,2}:
tests/recompilation/TEST.exp.{1,2}:
tests/recompilation/TEST.err_exp.2:
	Test cases, where TEST is one of add_constructor_r, add_instance_r,
	add_instance_2_r, add_type_nr, change_class_r, change_instance_r,
	change_mode_r, field_r, func_overloading_nr, func_overloading_r,
	lambda_mode_r, nested_module_r, no_version_numbers_r,
	pragma_type_spec_r, pred_ctor_ambiguity_r, pred_overloading_r,
	add_type_re, remove_type_re, type_qual_re.

tests/handle_options:
	Add an option `-e' to generate any missing expected output files.
2001-06-27 05:05:21 +00:00
Mark Brown
6f8beed44d Update this file.
Estimated hours taken: 0

scripts/.cvsignore:
	Update this file.
2001-06-25 16:00:26 +00:00
Fergus Henderson
a63454386c Fix some quoting bugs in my previous change.
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.vars.in:
	Fix some quoting bugs in my previous change.
2001-06-18 05:58:15 +00:00
Fergus Henderson
3913870d4a Fix a couple of bugs in Tyson's recent change:
Estimated hours taken: 0.5
Branches: main

scripts/Mmake.vars.in:
	Fix a couple of bugs in Tyson's recent change:
	- $(MS_VISUALCPP_DIR) may contain spaces, and so must be in quotes
	- "/include" uses Unix-style path separators rather than Windows
	  path separators and so should be outside the call to cygpath.
2001-06-18 02:37:04 +00:00
Tyson Dowd
61fc5c0818 Fixes required for .NET Beta 2.
Estimated hours taken: 6
Branches: main

Fixes required for .NET Beta 2.

aclocal.m4:
	Autodetect the C++ compiler and find the VC++ directory from it.

compiler/mlds_to_il.m:
	Put "public" annotations on the IL we generate (private is now the
	default).

library/char.m:
	Fix a use of c_header_code to be foreign_decl("C",

runtime/mercury_il.il:
	Put "public" annotations on the IL (private is now the default).

scripts/Mmake.vars.in:
	Fix the include path and commandline for VC++.
2001-06-14 22:36:24 +00:00
Fergus Henderson
62a1c59b4b Fix a missing newline in the help message.
Estimated hours taken: 0.1
Branches: main, release

scripts/mmake.in:
	Fix a missing newline in the help message.
2001-06-03 16:04:03 +00:00
Mark Brown
ea9a820db8 Add two entries.
Estimated hours taken: 0
Branches: main

scripts/.cvsignore:
	Add two entries.
2001-05-31 10:42:07 +00:00
Zoltan Somogyi
04e614485d Implement deep profiling; merge the changes on the deep2 branch back
Estimated hours taken: 500
Branches: main

Implement deep profiling; merge the changes on the deep2 branch back
onto the trunk.

The main documentation on the general architecture of the deep profiler
is the deep profiling paper.

doc/user_guide.texi:
	Document how to use the deep profiler.

deep_profiler:
deep_profiler/Mmakefile:
	A new directory holding the deep profiler and its mmakefile.

Mmakefile:
	Add targets for the new directory.

	Add support for removing inappropriate files from directories.

deep_profiler/interface.m:
	The deep profiler consists of two programs: mdprof_cgi.m, which acts
	as a CGI "script", and mdprof_server.m, which implements the server
	process that the CGI script talks to. Interface.m defines the
	interface between them.

script/mdprof.in:
	A shell script template. ../configure uses it to generate mdprof,
	which is a wrapper around mdprof_cgi that tells it how to find
	mdprof_server.

deep_profiler/mdprof_cgi.m:
	The CGI "script" program.

deep_profiler/mdprof_server.m:
	The top level predicates of the server.

deep_profiler/profile.m:
	The main data structures of the server and their operations.

deep_profiler/read_profile.m:
	Code for reading in profiling data files.

deep_profiler/startup.m:
	Code for post-processing the information in profiling data files,
	propagating costs from procedures to their ancestors and performing
	various kinds of summaries.

deep_profiler/server.m:
	Code for responding to requests from the CGI script.

deep_profiler/cliques.m:
	Code to find cliques in graphs.

deep_profiler/array_util.m:
deep_profiler/util.m:
	Utility predicates.

deep_profiler/dense_bitset.m:
	An implementation of (part of) the set ADT with dense bit vectors.

deep_profiler/measurements.m:
	Operations on profiling measurements.

deep_profiler/timeout.m:
	An implementation of a timeout facility.

deep_profiler/conf.m:
	Functions that depend on autoconfigured settings.

configure.in:
	Find out what command to use to find the name of the local host.

	Install deep profiling versions of the standard library along with the
	other profiling versions.

runtime/mercury_conf.h.in:
	Add some macros for deep_profiler/conf.m to use.

library/profiling_builtin.m:
runtime/mercury_deep_call_port_body.h:
runtime/mercury_deep_leave_port_body.h:
runtime/mercury_deep_redo_port_body.h:
	A new library module that implements deep profiling primitives.
	Some of these primitives have many versions, whose common code is
	factor is factored out in three new include files in the runtime.

compiler/deep_profiling.m:
	New module to perform the program transformations described in the
	paper.

compiler/notes/compiler_design.html:
	Document the new compiler module.

compiler/mercury_compiler.m:
	Invoke the new module in deep profiling grades. Allow global static
	data to be generated by deep_profiling.m.

compiler/options.m:
	Add options to turn on deep profiling and (for benchmarking purposes)
	control its implementation.

	Add an optiooption disable tailcall optimization in the LLDS backend,
	to help benchmarking deep profiling.

compiler/jumpopt.m:
compiler/optimize.m:
	Obey the option to disable tailcalls.

compiler/handle_options.m:
	Handle the implications of deep profiling.

compiler/modules.m:
	In deep profiling grades, automatically import profiling_builtin.m.

compiler/prog_util.m:
doc/Makefile:
library/library.m:
	Handle the new builtin module.

compiler/export.m:
	In deep profiling grades, wrap deep profiling code around exported
	procedures to handle the "unscheduled call" aspects of callbacks to
	Mercury from the foreign language.

compiler/higher_order.m:
profiler/demangle.m:
util/demangle.c:
	When creating a name for a higher-order-specialized predicate, include
	the mode number in the name.

compiler/add_trail_ops.m:
compiler/type_util.m:
	Move c_pointer_type from add_trail_ops to type_util, so it can also be
	used by deep_profiling.m.

compiler/hlds_goal.m:
	Add a new goal feature that marks a tail call, for use by
	deep_profiling.m.

compiler/hlds_pred.m:
	Add a new field to proc_info structures for use by deep_profiling.m.

	Add a mechanism for getting proc_ids for procedure clones.

	Remove next_proc_id, an obsolete and unused predicate.

compiler/hlds_data.m:
	Add a new cons_id to refer to the proc_static structure of a procedure.

compiler/bytecode_gen.m:
compiler/code_util.m:
compiler/dependency_graph.m:
compiler/hlds_out.m:
compiler/mercury_to_mercury.m:
compiler/ml_unify_gen.m:
compiler/opt_debug.m:
compiler/prog_rep.m:
compiler/rl_exprn.m:
compiler/switch_util.m:
compiler/unify_gen.m:
	Trivial changes to handle the new cons_id, goal feature and/or
	proc_info argument.

compiler/rtti.m:
	Add a utility predicate for extracting pred_id and proc_id from an
	rtti_proc_label, for use by hlds_out.m

compiler/layout.m:
compiler/layout_out.m:
compiler/llds.m:
compiler/llds_common.m:
	Add support for proc_static and call_site_static structures.

compiler/layout_out.m:
compiler/llds_out.m:
	Add code for the output of proc_static structures.

compiler/code_util.m:
	Make code_util__make_proc_label_from_rtti a function, and export it.

util/mkinit.c:
compiler/llds_out.m:
compiler/layout.m:
compiler/modules.m:
	Add support for a fourth per-module C function, for writing out
	proc_static structures (and the call_site_static structures they
	contains).

	Since proc_static structures can be referred to from LLDS code (and not
	just from other static structures and compiler-generated C code),
	reorganize the declarations of static structures slightly.

	Change the schema for the name of the first per-module C function
	slightly, to make it the addition of the fourth function easier.
	The scheme now is:

		mercury__<modulename>__init
		mercury__<modulename>__init_type_tables
		mercury__<modulename>__init_debugger
		mercury__<modulename>__write_out_proc_statics

	Improve formatting of the generated C code.

library/*.m:
runtime/mercury.c:
runtime/mercury_context.c:
runtime/mercury_engine.c:
runtime/mercury_ho_call.c:
runtime/mercury_tabling.c:
runtime/mercury_trace_base.c:
runtime/mercury_wrapper.c:
trace/mercrury_trace.[ch]:
trace/mercrury_trace_declarative.c:
trace/mercrury_trace_external.c:
trace/mercrury_trace_internal.c:
	Conform to the new scheme for initialization functions for hand-written
	modules.

compiler/mercury_compile.m:
library/benchmarking.m:
runtime/mercury_conf_param.h:
runtime/mercury.h:
runtime/mercury_engine.c:
runtime/mercury_goto.c:
runtime/mercury_grade.h:
runtime/mercury_ho_call.c:
runtime/mercury_label.[ch]:
runtime/mercury_prof.[ch]:
	Add an MR_MPROF_ prefix in front of the C macros used to control the
	old profiler.

compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
	Make deep profiling completely separate from the old profiling system,
	by making the deep profiling grade independent of MR_MPROF_PROFILE_TIME
	and the compiler option --profile-time.

library/array.m:
library/builtin.m:
library/std_util.m:
runtime/mercury_hand_unify_body.h:
runtime/mercury_hand_compare_body.h:
	In deep profiling grades, wrap the deep profiling call, exit, fail
	and redo codes around the bodies of hand-written unification
	and comparison procedures.

	Make the reporting of array bounds violations switchable between
	making them fatal errors, as we currently, and reporting them by
	throwing an exception. Throwing an exception makes debugging code
	using arrays easier, but since exceptions aren't (yet) propagated
	across engine boundaries, we keep the old behaviour as the default;
	the new behaviour is for implementors.

runtime/mercury_deep_profiling_hand.h:
	New file that defines macros for use in Mercury predicates whose
	definition is in hand-written C code.

library/exception.m:
runtime/mercury_exception_catch_body.h:
runtime/mercury_stacks.h:
	In deep profiling grades, wrap the deep profiling call, exit, fail
	and redo codes around the bodies of the various modes of builtin_catch.

	Provide a function that C code can use to throw exceptions.

library/benchmarking.m:
library/exception.m:
library/gc.m:
library/std_util.m:
runtime/mercury_context.[ch]:
runtime/mercury_engine.[ch]:
runtime/mercury_debug.c:
runtime/mercury_deep_copy.c:
runtime/mercury_overflow.h:
runtime/mercury_regs.h:
runtime/mercury_stacks.h:
runtime/mercury_thread.c:
runtime/mercury_wrapper.c:
	Add prefixes to the names of the fields in the engine and context
	structures, to make code using them easier to understand and modify.

runtime/mercury_deep_profiling.[ch]:
	New module containing support functions for deep profiling and
	functions for writing out a deep profiling data file at the end of
	execution.

runtime/mercury_debug.[ch]:
	Add support for debugging deep profiling.

	Add support for watching the value at a given address.

	Make the buffered/unbuffered nature of debugging output controllable
	via the -du option.

	Print register contents only if -dr is specified.

runtime/mercury_goto.h:
runtime/mercury_std.h:
	Use the macros in mercury_std.h instead of defining local variants.

runtime/mercury_goto.h:
runtime/mercury_stack_layout.h:
runtime/mercury_stack_trace.c:
runtime/mercury_tabling.c:
trace/mercury_trace.c:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
trace/mercury_trace_vars.c:
	Standardize some of the macro names with those used in the debugger
	paper.

runtime/mercury_heap.h:
	Add support for memory profiling with the deep profiler.

runtime/mercury_prof.[ch]:
runtime/mercury_prof_time.[ch]:
	Move the functionality that both the old profiler and the deep profiler
	need into the new module mercury_prof_time. Leave mercury_prof
	containing stuff that is only relevant to the old profiler.

runtime/mercury_prof.[ch]:
runtime/mercury_strerror.[ch]:
	Move the definition of strerror from mercury_prof to its own file.

runtime/mercury_wrapper.[ch]:
	Add support for deep profiling.

	Add suppory for controlling whether debugging output is buffered or
	not.

	Add support for watching the value at a given address.

runtime/Mmakefile:
	Mention all the added files.

scripts/mgnuc.in:
	Add an option for turning on deep profiling.

	Add options for controlling the details of deep profiling. These
	are not documented because they are intended only for benchmarking
	the deep profiler itself, for the paper; they are not for general use.

tools/bootcheck:
	Compile the deep_profiler directory as well as the other directories
	containing Mercury code.

	Turn off the creation of deep profiling data files during bootcheck,
	since all but one of these in each directory will be overwritten
	anyway.

	Add support for turning on --keep-objs by default in a workspace.

tools/speedtest:
	Preserve any deep profiling data files created by the tests.

trace/mercury_trace.c:
	Trap attempts to perform retries in deep profiling grades, since they
	would lead to core dumps otherwise.

util/Mmakefile:
	Avoid compile-time warnings when compiling getopt.

tests/*/Mmakefile:
tests/*/*/Mmakefile:
	In deep profiling grades, switch off the tests that test features
	that don't work with deep profiling, either by design or because
	the combination hasn't been implemented yet.
2001-05-31 06:00:27 +00:00
Fergus Henderson
273bbc39b5 A small start towards getting the Mercury compiler to run on Mingw,
Estimated hours taken: 5
Branches: main

A small start towards getting the Mercury compiler to run on Mingw,
without Cygwin: add a `mercury.bat' batch file for invoking the Mercury
compiler.

Note that currently Cygwin is still required:
	(1) For `c2init' and `ml'.
	(2) For `mmake'.
	(3) For installation (`configure' and `make install').
	(4) For mercury_update_interface.
	(5) For mkdir.
	(6) For fact tables.

However, there are work-arounds for most of these:
	(1) Currently the only work-around for `c2init' and `ml' is to use
	    the .NET back-end, which doesn't require them.
	(2) `mmake' is not strictly necessary; you can always invoke the
	    necessary commands by hand.  This is of course tedious and
	    error-prone, so we might eventually include more of mmake's
	    functionality into the Mercury compiler itself.
	(3) This would be easy enough to avoid; if we're willing to hard-code
	    the installation path, we could easily package up the installation
	    in a WinZip file or something similar.
	(4) XXX There's no good work-around for this right now.
	(5) Don't use --use-subdirs or --split-c-files.
	(6) Don't use fact tables.

scripts/mercury.bat.in:
	New file.  This is a rewrite of scripts/mmc.in using Windows batch
	file commands rather than Bourne shell.
	Note that this is named mercury.bat.in rather than mmc.bat.in
	because on Windows 2000 the name `mmc' is used for the
	Microsoft Management Console.

configure.in:
bindist/bindist.configure.in:
	Generate scripts/mercury.bat.
	Also add a new autoconf variable WINDOWS_LIBDIR, which is like
	LIBDIR except in Windows path format rather than Cygwin (Unix)
	path format; this is used by scripts/mercury.bat.in.

scripts/Mmakefile:
	Add mercury.bat to the list of scripts to install.
2001-05-27 10:52:08 +00:00
Tyson Dowd
bd732f891c Track the changes in the latest version of the .NET C++ compiler.
Estimated hours taken: 0.5
Branches: main

Track the changes in the latest version of the .NET C++ compiler.

scripts/Mmake.rules:
	Add mscoree.lib to the parameters passed to the C++ compiler.
2001-05-23 09:06:29 +00:00
Simon Taylor
46b8cd7a50 Fix a problem caused by my change to remove the RM_C mmake
Estimated hours taken: 0.1
Branches: main

scripts/Mmake.vars.in:
	Fix a problem caused by my change to remove the RM_C mmake
	variable. RM_C is still referred to by `.d' files generated
	before that change, so it still needs to be defined.
2001-05-19 13:53:06 +00:00
Simon Taylor
319df48866 Remove the RM_C mmake variable, which controlled whether the intermediate
Estimated hours taken: 0.5
Branches: main

Remove the RM_C mmake variable, which controlled whether the intermediate
`.c' files were removed (now they never are).

The implementation was buggy (it didn't work with parallel makes), and
made it difficult to avoid always recompiling the `.c' file with smart
recompilation.

Mmake.common.in:
configure.in:
README.AIX:
bindist/bindist.build_vars.in:
bindist/bindist.configure.in:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
compiler/modules.m:
tools/bootcheck:
tools/binary_step:
*/Mmakefile:
	Remove references to RM_C, DEFAULT_RM_C and LIBRARY_RM_C.

compiler/modules.m:
	The `.o' and `.pic_o' file now depends only on the `.c' file,
	not on everthing the `.c' file depends on. The extra dependencies
	were only needed because the intermediate `.c' file could
	be removed by RM_C. This change is needed to avoid recompiling
	unchanged `.c' files with smart recompilation.
2001-05-18 14:23:59 +00:00
Fergus Henderson
c08e710e54 Fix a bug in c2init where, if an error occurred, it would leave the
Estimated hours taken: 2
Branches: main

Fix a bug in c2init where, if an error occurred, it would leave the
invalid output file around, causing problems the next time you ran Mmake.

This change also eliminates a dependency on using shell redirection (">")
when invoking system commands.

util/mkinit.c:
	Add new option `-o' for specifying the output file name.
	Also, if this option is specified, and there are any errors,
	then remove the output file. This fixes the bug mentioned above.
	Also, consistently use exit(EXIT_FAILURE) rather than exit(1).

scripts/c2init.in:
	Add new option `-o'/`--output', which just passes `-o' to mkinit.

compiler/modules.m:
compiler/mercury_compile.m:
	Use `-o' rather than shell redirection when invoking c2init.
2001-05-08 12:48:34 +00:00
Tyson Dowd
5ddff184df A few fixes for the scripts in the .NET backend.
Estimated hours taken: 0.5
Branches: main

A few fixes for the scripts in the .NET backend.


scripts/Mmake.rules:
	Use -CLR instead of -com+, the latter is undocumented, confusing and
	may stop working in the future.

scripts/Mmake.vars.in:
	Remove the reference to the .NET libraries as these are no longer
	needed when using the command line C++ compiler cl.
	Remove ALL_CFLAGS from the CLFLAGS -- the wrong flags were being
	passed to cl (such as the -g flag) which it didn't understand.
2001-04-25 15:16:49 +00:00
Fergus Henderson
f4d815cd67 Don't enable `--strip' by default on MacOS X (Darwin),
Estimated hours taken: 0.25

scripts/ml.in:
	Don't enable `--strip' by default on MacOS X (Darwin),
	since `cc -s' doesn't seem to do the right thing.
2001-04-16 09:34:21 +00:00
Tyson Dowd
10315a1cb3 Fix CPU recognition problems with the Pentium 4.
Estimated hours taken: 0.75
Branches: main release dotnet-foreign

Fix CPU recognition problems with the Pentium 4.

The P4 reports its CPUID as "15" which is pretty unexpected
as previously Intel chips used numbers such as "4", "5" and "6".

Many scripts assumed the pattern i?86 or i[345678]86 would match
x86 chips.

The result of mis-identifying the chip is generally failure to compile,
and even if you do hack around the compilation problems it will almost
certainly fail to build the garbage collector correctly.

config.guess:
config.sub:
configure.in:
scripts/mgnuc.in:
scripts/ml.in:
tools/test_mercury:
	Replace i?86 with i*86, and i[345678]86 with i[0-9]*86.
2001-04-10 15:37:38 +00:00
Fergus Henderson
7f0ff9ac19 Delete an old bootstrapping hack that is no longer needed.
Estimated hours taken: 0.25
Branches: release, main

scripts/mmc.in:
	Delete an old bootstrapping hack that is no longer needed.
2001-04-09 08:54:05 +00:00
Fergus Henderson
8bc8db5018 Delete some accidentally duplicated code.
Estimated hours taken: 0.25
Branches: main

scripts/mmake.in:
	Delete some accidentally duplicated code.
	The code for handling `--no-use-subdirs' was there twice.
2001-03-20 02:10:34 +00:00
Fergus Henderson
151502a160 Don't enable -Wpointer-arith, since for gcc < 3.0 it causes too many
Estimated hours taken: 0.25
Branches: release, main

scripts/mgnuc.in:
	Don't enable -Wpointer-arith, since for gcc < 3.0 it causes too many
	spurious warnings in system header files.  (This is fixed in gcc 3.0,
	though, so at some point we should re-enable it.)
2001-03-20 02:01:34 +00:00
David Jeffery
19ceeaf30f Merge the changes from the HAL branch onto the main branch.
Estimated hours taken: 40
                       (to do this merge... 100s of hours on the HAL branch
		        itself by myself and Warwick Harvey though).

Merge the changes from the HAL branch onto the main branch. With the recent
changes made to the HAL implementation, this means adding just one grade,
`.rt' or --reserve-tag, which reserves one tag (zero) in each type for
use by HAL's Herbrand constraint solver. This disables no-tag types and
enumerations.

This grade will now bootstrap, and passes all tests, except for a few failing
cases in the debugger and tabling directories.

compiler/options.m:
compiler/handle_options.m:
	Add the `.rt' or --reserve-tag grade option.
runtime/mercury_conf_param.h:
	Document the macro MR_RESERVE_TAG
doc/user_guide.texi:
	Document the `.rt' grade.

compiler/make_hlds.m:
	Don't record any types as no-tag types if we are in a .rt grade.
compiler/make_tags.m:
compiler/type_ctor_info.m:
	Allocate tags starting from `1' in .rt grades.
compiler/rtti_out.m:
	In .rt grades, output a dummy ptag definition for tag `0'.
compiler/type_util.m:
	Add predicates `type_util__constructors_are_dummy_argument_type' and
	`type_constructors_are_type_info' for use when allocating tags to
	ensure that type infos and dummy types (io__state/0 and store__store/1)
	are still treated as no-tag types in .rt grades.

library/sparse_bitset.m:
	When allocating a sparse bitset element, use tag `1' if we are in a
	.rt grade.

runtime/mercury_tags.h:
	Define a macro `MR_UNIV_TAG' which is `1' is we in a .rt grade and
	`0' otherwise. (Now that univ is a user defined type, it is a also
	assigned a `var' tag).
	Also make the definitions of MR_RAW_TAG_NIL and MR_RAW_TAG_CONS take the
	.rt grade into account.
runtime/mercury_type_info.h:
	Define `MR_unravel_univ' and
	`MR_initialise_univ' for taking apart and putting together univs.

	Add a new secondary tag alternative: MR_SECTAG_VARIABLE, used to
	represent Herbrand variables.

library/std_util.m:
	Use MR_UNIV_TAG, MR_unravel_univ and MR_initialise_univ when
	manipulating univs.

	Handle the new MR_SECTAG_VARIABLE secondary tag by aborting.

runtime/mercury_deep_copy_body.h:
runtime/mercury_tabling.c:
runtime/mercury_unify_compare_body.h:
	Handle the new MR_SECTAG_VARIABLE secondary tag by aborting.

library/std_util.m:
	Add a constant for MR_SECTAG_VARIABLE in the MC++ back end.

scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
	Process the new grade.

scripts/mmake.in:
	Add an option `--include-makefile', which includes a Makefile given
	as a command line argument into the Makefile generated by mmake.
	This is used to implement `halmake', a make program for HAL which
	just passes a bunch of extra rules and variable definitions onto
	mmake.

tests/debugger/existential_type_classes.m:
tests/hard_coded/existential_types_test.m:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
trace/mercury_trace_internal.c:
	Use MR_UNIV_TAG.

TODO:
	- The declarative debugger falls over in .rt grades. This is possibly
	  because compiler/static_term.m assumes that the generated code uses
	  the same data representation as the compiler itself. This should be
	  fixed, although it is not critical; the declarative debugger won't
	  work with trailing as is, and the .rt grade is only ever used in
	  conjunction with trailing (.tr) at this stage.
2001-03-18 23:10:17 +00:00
Tyson Dowd
96eac21430 Modify Mmakefiles so that we don't try to install unnecessary
Estimated hours taken: 1
Branches: main release

boehm_gc/Mmakefile:
browser/Mmakefile:
trace/Mmakefile:
	Modify Mmakefiles so that we don't try to install unnecessary
	subsystems in IL grades.

runtime/Mmakefile:
	Add some support for installing the MCPP_HDRS and the DLLs in IL
	grades (largely untested).
	Fix some missing dependencies on the 'install_dirs' target.

library/Mmakefile:
scripts/Mmake.rules:
	Remove the check for ils_subdir, as this appears to be a
	cut-and-paste error -- the rules it surrounds are not for doing
	subdir builds.
	Use a clearer test for il as a substring in GRADE.
2001-03-16 01:40:43 +00:00
Fergus Henderson
9dcfc8663e Fix a problem where the nightly tests were failing the `--target asm'
Estimated hours taken: 0.5
Branches: main release

Fix a problem where the nightly tests were failing the `--target asm'
tests, because they were passing `--pic-reg', and that option was
being used with different semantics for the gcc back-end.

scripts/Mmake.rules:
	Use `--pic' rather than `--pic-reg'.
	(I forgot to commit this with my earlier changes.)
2001-03-11 16:52:45 +00:00
Fergus Henderson
3360d1cb59 Fix some more bugs in the handling of `DEFAULT_GRADE' and the
Estimated hours taken: 0.5

scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
	Fix some more bugs in the handling of `DEFAULT_GRADE' and the
	`-s<grade>' option.  Obviously this code had never been exercised.
2001-02-11 14:53:41 +00:00
Fergus Henderson
e09f36c7dd Fix another cut-and-paste error: change the second "case 0)" to
Estimated hours taken: 0.25

scripts/parse_grade_options.sh-subr:
	Fix another cut-and-paste error: change the second "case 0)" to
	"case *)".
2001-02-11 14:20:44 +00:00
Fergus Henderson
e74fb9ca42 Fix a cut-and-paste error: change the second "case 0)" to "case *)".
Estimated hours taken: 0.25

scripts/init_grade_options.sh-subr:
	Fix a cut-and-paste error: change the second "case 0)" to "case *)".
	This broke the default grade setting.
2001-02-11 12:47:40 +00:00
Fergus Henderson
787b241fc6 Fix a bug: s/allow_undefined/allow_undef/,
Estimated hours taken: 0.25

scripts/ml.in:
	Fix a bug: s/allow_undefined/allow_undef/,
	to match the variable name used elsewhere in this script.
2001-02-11 04:42:45 +00:00
Julien Fischer
9602919bbe Added new compiler options to support the Java backend and
Estimated hours taken: 4

Added new compiler options to support the Java backend and
updated documentation to reflect this.

compiler/globals.m:
	Removed comment about Java backend not being implemented.
	Replaced it by one say that it is work in progress.

compiler/mercury_compile.m:
	If Target = java then call the Java backend.

compiler/options.m:
	Added new options for compiling Java files:
	`--java'
	`--java-only'
	`--java-compiler' ('--javac')
	`--java-flags'
	`--java-classpath'
	`--java-object-file-extension'

compiler/handle_options.m:
	If compiling to Java then don't link.
	Added "java" grade.

compiler/mlds_to_java.m
	New file.
	XXX Currently just prints an error message about
	    the Java backend not being implemented.

doc/user_guide.texi:
	Documented new options for compiling Java files.

scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/final_grade_options.sh-subr:
	Added support for "java" grade.
2001-01-29 01:55:08 +00:00
Fergus Henderson
81d6a2316b Work-around gcc bug that broke library/table_builtin.m when built
Estimated hours taken: 1

scripts/mgnuc.in:
	Work-around gcc bug that broke library/table_builtin.m when built
	with `MCFLAGS = -O6' and `--intermodule-optimization'.
	GNU C version egcs-1.1.2 reported the following error message:
		table_builtin.c: In function `table_builtin_module':
		table_builtin.c:1880: fixed or forbidden register 3 (bx)
		was spilled for class GENERAL_REGS.
		This may be due to a compiler bug or to impossible asm
		statements or clauses.
	The work-around is to compile with `-O0'.
2001-01-28 10:23:11 +00:00
Fergus Henderson
05475302fd Add Mmake support for building code that uses the C interface
Estimated hours taken: 4

Add Mmake support for building code that uses the C interface
with the GCC back-end.

The GCC back-end already compiles code using the C interface to a
separate C file.  This changes add Mmake support for compiling that
file and linking it into the final executable (or library).

scripts/Mmake.rules:
	Add a rule for building the *__c_code.{o,pic_o} files.

compiler/modules.m:
	Add field names to the `modules_import' type.
	Add a new field `foreign_code' which records whether
	or not the module contains foreign code.
	For target asm, if the module does contain foreign code,
	include the *__c_code.o files as extra object files to link.

compiler/intermod.m:
compiler/mercury_compile.m:
	Trivial changes to reflect the new field of the modules_import
	type.
2001-01-24 13:18:26 +00:00
Fergus Henderson
624651fb03 Fix a bug in the Mmake support for shared libraries
Estimated hours taken: 0.75

Fix a bug in the Mmake support for shared libraries
for `--target asm'.

scripts/Mmake.rules:
	When generating the `.pic_s' file, pass `--pic-reg' to mmc.
	(XXX we should perhaps use a different option,
	e.g. `--pic', for this.)

compiler/mlds_to_gcc.m:
	If `--pic-reg' is passed, generate the output in a `.pic_s'
	file, rather than a `.s' file.
2001-01-24 06:28:34 +00:00
Fergus Henderson
da1f8c7f6a Fix a bug where the Mmake rule for making `.pic_s' files didn't work,
Estimated hours taken: 0.5

Fix a bug where the Mmake rule for making `.pic_s' files didn't work,
because it was passing $(CFLAGS_FOR_PIC), i.e. `-fpic -DPIC',
to the GCC back-end, but the GCC back-end didn't understand `-DPIC'.
(The GCC *driver* understands `-D', as does the GCC C front-end,
but the back-end doesn't.)

scripts/Mmake.vars.in:
	Define new variable GCCFLAGS_FOR_PIC, and set it to `-fpic'.

scripts/Mmake.rules:
	In the rule for making `.pic_s' files, use $(GCCFLAGS_FOR_PIC)
	instead of $(CFLAGS_FOR_PIC).
2001-01-23 16:12:56 +00:00
Fergus Henderson
67df9a7894 Add some comments explaining that the `--target il' option is
Estimated hours taken: 0.25

scripts/mmake.in:
	Add some comments explaining that the `--target il' option is
	not supported.  Issue a warning if it is used.
2001-01-17 09:16:51 +00:00