Commit Graph

83 Commits

Author SHA1 Message Date
Warwick Harvey
f1de7db5a9 Fixed a couple of problems with the bootcheck script.
Estimated hours taken: 4

Fixed a couple of problems with the bootcheck script.

tools/bootcheck:
	Changed the stage 2 and 3 builds to always use the stage 1 version
	of `mmake' rather than the installed version (it had been using a
	rather bizarre mix of the two, which made bootstrapping changes to
	mmake rather difficult).  As part of this, made the definitions of
	`MMAKE_VPATH' and `MMAKE_DIR' apply to all invocations of mmake for
	stages 2 and 3, rather than just some of them.
1999-07-14 06:17:28 +00:00
Simon Taylor
c163d493be Document that `mmake depend' needs to be run
Estimated hours taken: 1

Mmake.common.in:
	Document that `mmake depend' needs to be run
	in the compiler directory if the setting
	of `INCLUDE_ADITI_OUTPUT' is changed.

compiler/Mmakefile:
	Change the action of `mmake depend' so that it always
	regenerates the `.m' files for which `.pp' files exist.

	Don't update the timestamp on a `.m' file if regenerating
	it does not change it.

tools/bootcheck:
	Link rather than copy `.pp' files now that reprocessing
	them is handled by `mmake depend'.
1999-06-23 03:09:31 +00:00
Simon Taylor
846ce3f47e Copy the .pp files rather than linking them.
Estimated hours taken: 0.1

tools/bootcheck:
	Copy the .pp files rather than linking them.
	This is a more robust way making sure the corresponding
	.m files are rebuilt in stages 2 and 3 because it doesn't
	require any changes if someone adds some more .pp files.
1999-05-05 05:24:28 +00:00
Simon Taylor
43164d3be4 Make sure rl_out.m and rl_file.m are recreated in
Estimated hours taken: 0.1

tools/bootcheck:
	Make sure rl_out.m and rl_file.m are recreated in
	the stage 2 and 3 directories with the value of
	INCLUDE_ADITI_OUTPUT from Mmake.stage.params.
1999-05-05 01:36:12 +00:00
Zoltan Somogyi
1e64117950 Allow multiple -d options. Factor out some common code to make the
Estimated hours taken: 0.2

tools/bootcheck:
	Allow multiple -d options. Factor out some common code to make the
	change easier.
1999-04-29 07:52:40 +00:00
Zoltan Somogyi
b8ba941e5d Fix a stupid mistake: use the stage2 runtime, library etc
Estimated hours taken: 0.1

tools/bootcheck:
	Fix a stupid mistake: use the stage2 runtime, library etc
	if the stage2 grade and the test grade are the same, not if
	they are different.
1999-04-29 00:59:31 +00:00
Zoltan Somogyi
c52ccf8f51 Fix grammar in comment.
Estimated hours taken: 0.01

tools/bootcheck:
	Fix grammar in comment.
1999-04-26 00:52:27 +00:00
Simon Taylor
f18ac4159e Fix a syntax error.
Estimated hours taken: 0.1

tools/bootcheck:
	Fix a syntax error.
1999-04-22 05:47:35 +00:00
Zoltan Somogyi
427c9e62d1 Fix spelling error.
Estimated hours taken: 0.01

tools/bootcheck:
	Fix spelling error.
1999-04-22 02:25:12 +00:00
Zoltan Somogyi
19f1d3be9a Make it much more convenient to do a full bootcheck, including all the tests,
Estimated hours taken: 1

Make it much more convenient to do a full bootcheck, including all the tests,
in a grade other than the default one.

By passing a grade explicitly to the tests, instead of just grade component
flags, we allow the conditionals in tests/*/Mmakefiles to work in a lot
more cases than previously.

*** IMPORTANT **
If you do not use any grade other than the default one, then this change
does not affect you; if you do, it affects what you can put in Mmake.params
and Mmake.stage.params files. This change requires that there should be
no grade flags (e.g. --use-trail) specified in the file that becomes
stage2/Mmake.params, which is Mmake.stage.params in the top directory
if it exists, and Mmake.params in that directory otherwise.

tools/bootcheck:
	Add two new options, --grade (abbreviated -G) and --test-grade,
	which each take an argument specifying a grade. The purpose of the
	--grade option is to allow you to specify what grade stages 2 and 3
	should be compiled in. The purpose of the -test-grade option is
	to allow you to say that the tests should be done in the same
	grade as stage 1, not stage 2 or 3, although this is not checked.

	If you specify neither, then stages 2 and 3 will be built in the
	default grade, and the tests will be done in the default grade as well.
	The tests will use everything (compiler, library, runtime etc) from
	the stage2 directory.

	If you specify only --grade, then stages 2 and 3 will be built in the
	given grade, and the tests will be done in the given grade as well.
	The tests will use everything (compiler, library, runtime etc) from
	the stage2 directory.

	If you specify both --grade and --testgrade, then stages 2 and 3 will
	be built in the grade given to --grade, while the tests will be done
	in the grade given to --test-grade. The tests will use only the
	compiler from stage2; everything else (library, runtime etc) will be
	from stage 1 directory, since it is assumed that the test grade
	is the same as the grade of stage 1.

	If you specify only --testgrade, then stages 2 and 3 will be built
	in the default grade, while the tests will be done in the given grade.
	The tests will use only the compiler from stage2; everything else
	(library, runtime etc) will be from stage 1 directory, since it is
	assumed that the test grade is the same as the grade of stage 1.

	The runtime and boehm_gc directories of stage2 will be copied instead
	of linked from stage 1 if either of the new options is given, since
	there is no reason to give either option unless the stage 1 grade
	differs from the stage 2 grade, and such grade differences may require
	this copying.

	The old --copy-runtime and --copy-boehm-gc options, which were each
	intended to accomplish one half of this, are both implied by either
	of the two new options being given.
1999-04-21 09:10:18 +00:00
Fergus Henderson
dc2ff9f823 Link the aclocal.m4 file into the stage2 and stage3 directories.
Estimated hours taken: 0.1

tools/bootcheck:
	Link the aclocal.m4 file into the stage2 and stage3 directories.
1999-03-31 08:03:37 +00:00
Zoltan Somogyi
8d3486dbc4 Copy the newly created .mercury-compiler.spec.in file to the
Estimated hours taken: 0.1

tools/bootcheck:
	Copy the newly created .mercury-compiler.spec.in file to the
	stage[23] directories, since without this file the mmakes invoked
	by bootcheck fail.
1999-03-19 04:19:43 +00:00
Fergus Henderson
14728289fa Remove support for NU-Prolog and SICStus Prolog.
Estimated hours taken: 5

Remove support for NU-Prolog and SICStus Prolog.

The reasons for this are:
(a) We now have a proper working debugger, so we don't need to use
    NU-Prolog or SICStus Prolog for debugging.
(b) The Prolog support was only ever a hack, not a proper solution;
    Mercury language features like functions or mode reordering
    were never supported.
(c) It was a maintenance problem.

compiler/make_hlds.m:
	Warn that NU-Prolog `when' declarations are deprecated.

compiler/prog_io.m:
	Update a comment to say that NU-Prolog `when' declarations
	are now deprecated.

library/*.m:
	Delete `when' declarations.

configure.in:
bindist/bindist.configure.in:
	Delete the autoconf tests for NU-Prolog and SICStus Prolog.
	Delete the stuff for generating the NU-Prolog and SICStus Prolog
	scripts.

tools/bootcheck:
	Delete the options for testing using SICStus Prolog.

library/Mmakefile:
	Delete the rules for building NU-Prolog and SICStus Prolog stuff.

library/library.nu.nl.in:
	library/swi_*.m:
	library/*.nu.nl:
library/array.nu.nl:
library/assoc_list.nu.nl:
library/char.nu.nl:
library/float.nu.nl:
library/int.nu.nl:
library/io.nu.nl:
library/library.nu.nl.in:
library/map.nu.nl:
library/mercury_builtin.nu.nl:
library/nc_builtin.nl:
library/require.nu.nl:
library/sp_builtin.nl:
library/sp_lib.nl:
library/std_util.nu.nl:
library/store.nu.nl:
library/string.nu.nl:
library/swi_builtin.m:
library/swi_lib.m:
library/term_io.nu.nl:
	Delete these files.

scripts/mnc.in:
scripts/mnp.in:
scripts/mnl.in:
scripts/msc.in:
scripts/msl.in:
scripts/msp.in:
	Delete these files.

doc/user_guide.texi:
	Delete the documentation about the Prolog support.

NEWS:
w3/news/newsdb.inc:
        Mention that we've removed the Prolog support.
1999-03-15 08:48:36 +00:00
Warwick Harvey
6d1644ce10 If the -g / --copy-boehm-gc option was specified, symlink the
Estimated hours taken: 0.25

tools/bootcheck:
	If the -g / --copy-boehm-gc option was specified, symlink the
	subdirectory "boehm_gc/include", rather than the non-existant
	"boehm_gc/includes".
1998-12-02 00:49:29 +00:00
Zoltan Somogyi
9244c2806d s/wwas/was/
Estimated hours taken: 0.01

tools/bootcheck:
	s/wwas/was/
1998-11-09 01:29:53 +00:00
Fergus Henderson
e16a97032d Ensure that --use-subdirs' defaults to true' if
Estimated hours taken: 0.25

tools/bootcheck:
	Ensure that `--use-subdirs' defaults to `true' if
	there is a `Mercury' subdirectory in the `compiler' directory.
	This avoids various annoyances that occur if you're using subdirs
	and you forget to pass `--use-subdirs' to bootcheck.
1998-11-02 10:29:32 +00:00
Zoltan Somogyi
8a0ceb49aa This checkin has several major purposes, set out in the sections below,
Estimated hours taken: 240

This checkin has several major purposes, set out in the sections below,
all connected with the implementation of the new debugger command set.

DOCUMENT NEW DEBUG COMMAND SET

doc/user_guide.texi:
	Add a new section on the debugger. The description of the commands
	is complete, but some of the background sections, and the section
	about how to build debuggable executables, are not yet done.

	Update the documentation of the tracing options.

doc/generate_mdb_doc:
	A new shell script that automatically converts some of the new
	sections of the user guide into the online documentation of the
	debugger.

doc/mdb_categories:
	The fixed initial part of the online documentation.

doc/Mmakefile:
	Add rules for creating mdb_doc, the file that is the online
	documentation of the debugger, and for installing it together
	with mdbrc.

Mmake.common.in:
	Define INSTALL_DOC_DIR for doc/Mmakefile.

scripts/mdbrc.in:
	A debugger command script that reads in the online documentation
	and then defines some standard aliases.

configure.in:
	Define the variable that scripts/mdb.in and scripts/mdbrc.in use
	to find the right files, and get configure to perform the
	substitutions.

configure.in:
scripts/mdb:
scripts/mdb.in:
	Replace mdb with mdb.in. Mdb is now created during configuration
	from mdb.in, filling in the name of the file that contains the default
	debugger initialization commands.

util/info_to_mdb.c:
	A program that does most of the work involved in automatically
	converting user guide sections into online documentation.
	(This couldn't easily be written in sh, because sh's read
	command has no notion of pushback.)

util/Mmakefile:
	Add info_to_mdb to the list of targets.

tools/bootcheck:
	Make sure that the tests in tests/debugger are executed with an
	initialization setup that is equivalent to what users will see
	by default.

REORGANIZE TRACING OPTIONS

compiler/globals.m:
compiler/handle_options.m:
compiler/options.m:
compiler/trace.m:
	Reorganize the handling of trace levels around the new options
	--trace-internal, --trace-redo, and --trace-return.

compiler/*.m:
	Use the new ways of getting at trace levels.

tests/hard_coded/typeclasses/Mmakefile:
	s/--trace all/--trace deep/

SUPPORT RETRY

compiler/trace.m:
	After every call to MR_trace(), emit code that checks whether it
	should jump away, and if yes, performs the jump. This is used to
	implement retry. (The debugger cannot execute the jump itself
	because it is in the wrong C stack frame.)

compiler/llds.m:
compiler/continuation_info.m:
compiler/stack_layout.m:
	Modify the data structures that record information about live
	value at program points, to record the identity of each variable.
	This is necessary for the implementation of the restart command,
	since we do not want to confuse two distinct variables just because
	they have the same name. For example, a variable whose name is X
	and number is 5 is now recorded in the name array as "5:X".

	Clean up the data structure a bit, so that we don't have to store
	dummy names for values that are not variables.

compiler/*.m:
	Minor changes to conform to the data structure changes.

runtime/mercury_stack_layout.h:
	Redefine an existing macro to strip away the initial number: prefix
	from the "name" of a variable (keeping its original function on
	changed data), and add a new one to access the raw unstripped data.

runtime/mercury_init.h:
runtime/mercury_wrapper.h:
	Update the prototype of MR_trace_{fake,real}, and the type of the
	global that points to them.

runtime/mercury_layout_util.h:
	Add an extra function, MR_get_register_number, for use by retry.

USE FIXED STACK SLOTS FOR TRACE INFO

compiler/code_gen.m:
compiler/code_info.m:
compiler/live_vars.m:
compiler/trace.m:
	If execution tracing is enabled, reserve the first few stack slots
	to hold the event number of the call event, the call number, the
	call depth, the redo layout structure address (if generating redo
	events) and the from_full flag at the time of call (if we are doing
	shallow tracing). By allocating the first four of these to fixed stack
	slots, the debugger knows where to look for them without having
	to be told. It finds out the location of the fifth, if needed,
	from a new slot in the proc layout structure. (It is not possible
	to allocate all five to fixed stack slots without wasting stack space
	in some cases.)

compiler/trace.m:
	Remove from the call to MR_trace the parameters that are now in fixed
	stack slots, since MR_trace can now look them up itself.

compiler/continuation_info.m:
compiler/stack_layout.m:
	Add an extra field to the proc_layout_info. If the module is shallow
	traced, this field says which stack slot holds the saved value of
	MR_from_full. If it is not shallow traced, this field says that
	there is no such stack slot.

runtime/mercury_stack_layout.h:
	Add macros for accessing the fixed stack slots holding the event
	number of the call event, the call number, the call depth, and,
	at a redo event, the redo layout structure address.

	Support the new field in proc layouts that gives the location of the
	from-full flag (if any).

runtime/mercury_trace_base.[ch]:
trace/mercury_trace.[ch]:
	Remove the call number and call depth arguments from MR_trace
	and its avatars, since this info is now in fixed stack slots
	in every procedure that can call MR_trace. This should reduce
	the size of the executable significantly, since there are lots
	of calls to MR_trace.

runtime/mercury_init.h:
runtime/mercury_wrapper.h:
	Update the prototype of MR_trace_{fake,real}, and the type of the
	global that points to them.

START NUMBERING FRAMEVARS FROM ONE

compiler/code_info.m:
compiler/live_vars.m:
compiler/llds_out.m:
compiler/trace.m:
	Start numbering framevars from 1 internally to the compiler;
	the runtime already starts from 1. This simplifies several tasks.

ADD REDO EVENTS

compiler/trace.m:
compiler/code_gen.m:
	Before the code that executes "succeed()", emit code to push a
	a temp nondet frame whose redoip points to a label in the runtime
	that calls MR_trace for a REDO event and then fails, provided
	--trace-redo is set.

compiler/llds.m:
	Add a new code address constant, do_trace_redo_fail, which stands
	for the address in the trace system to which calls MR_trace for
	the redo event and then fails.

compiler/trace.m:
compiler/llds_out.m:
	Provided we are doing redo tracing, fill in the slot that holds
	the layout information for the REDO event.

compiler/*.m:
	Minor changes to conform to handle the new code address constant.

browser/debugger_interface.m:
	Add redo to trace_port_type.

runtime/mercury_trace_base.[ch]:
	Add a C module containing the code that calls MR_trace for REDO
	events.

ENSURE THAT INPUT ARGUMENTS ARE ALWAYS VISIBLE

compiler/trace.m:
	When generating the set of live variables at internal ports,
	the variables that are in the pre-death set of the goal into which
	we are entering may not be available. However, the variables in the
	pre-death set that are also in the resume vars set will be available,
	so now include info about them in the layout structure for the event.
	Since with tracing the non-clobbered input args are in all resume vars
	sets, this ensures that these input args will be available from all
	internal events.

compiler/code_info.m:
	Export a previously internal predicate (current_resume_point_vars)
	to make this possible.

BUG FIX: WANT RETURN LAYOUTS

compiler/globals.m:
compiler/call_gen.m:
compiler/code_info.m:
compiler/mercury_compile.m:
	Add a new pred globals__want_return_layouts, which says whether the
	compiler should generate layout structures for call returns. This pred
	centralizes the several previous copies of the test. One of those
	copies (the one in call_gen) was faulty, leading to a bug: in the
	presence of execution tracing but the absence of accurate gc,
	information about the variables that are live at the call return
	wasn't being gathered properly.

BUG FIX: #include mercury_trace_base.h

compiler/llds_out.m:
	#include mercury_trace_base.h, not mercury_trace.h, since now
	mercury_trace_base.h defines everything directly accessible from
	modules compiled with tracing.

RECAST MERCURY_TRACE_UTIL AS MERCURY_LAYOUT_UTIL

runtime/mercury_trace_util.[ch]:
runtime/mercury_layout_util.[ch]:
	Rename this module from trace_util to layout_util, since it is also
	used by the native garbage collector. Remove "trace" from the names
	of functions.

	Get rid of the global variable MR_saved_regs, and instead thread
	a pointer to this data structure through the relevant functions
	as an extra argument.

	Add a lot more documentation in the header file.

runtime/Mmakefile:
	Reflect the module rename.

runtime/*.c:
	Refer to the new module.

DELETE EASY-TO-MISUSE MACROS

runtime/mercury_stacks.h:
	Delete the based_framevar and based_detstackvar macros, since their
	continued use can lead to off-by-one errors, and the saved_framevar
	and saved_detstackvar macros, since they are no longer used.

runtime/*.c
	Update any references to any macros removed from mercury_stacks.h.

MISC RUNTIME CHANGES

runtime/mercury_trace_base.[ch]:
trace/mercury_trace*.[ch]:
	Make typedef'd names conform to the naming convention.

	Make MR_trace_call_{seqno,depth} consistently Unsigned, rather than
	sometimes Word and sometimes Unsigned.

FIX BUG: MAKE THE DEBUGGER PRINT TO STDOUT, NOT THE CURRENT STREAM

library/io.m:
	Export to C code the predicates that return the identities and types
	of stdin, stdout and stderr, as well as io__print/[34].

library/std_util.m:
	Export to C code a predicate that returns the type_info for the
	type stdutil:type_info. This type_info is required if C code
	wants to invoke make_permanent on any type_info structure,
	as the debugger does.

runtime/mercury_init.h:
	Add extern declarations for the C functions now exported from io.m.

runtime/mercury_wrapper.[ch]:
	Add new global variables to hold the addresses of these C functions.

runtime/mercury_layout_util.c:
	Use indirect calls through these global variables to print Mercury
	values, instead of lower-level code.

util/mkinit.c:
	Assign the addresses of the functions exported from io.m to the
	global variables defined in mercury_wrapper.h.

BUG FIX: STACK TRACE FUNCTIONS DEPEND ON THE LABEL TABLE

runtime/mercury_stack_trace.c:
	On entry to any of the functions exported from this module,
	ensure that the label table is loaded by calling do_init_modules.
	Without a filled-in label table, the stack trace will not be able to
	find any stack layout info.

BUG FIX: REMOVE BROWSER/*.C

configure.in:
	When removing .c files generated by the C compiler, remove those
	in the browser directory as well as the compiler, library and
	profiler directories.

IMPLEMENT NEW DEBUGGER COMMAND SET

runtime/mercury_stack_trace.[ch]:
	Factor out the code that prints the id of a procedure into a function
	of its own, so that it can also be used from the debugger, ensuring
	appearance commonality.

	Add more documentation in the header file.

trace/mercury_trace_internal.c:
	Implement the proposed command set. Command names are now words,
	and several commands now have options allowing the user to override
	the default print level or strictness of the command, or the
	invocation conditions or action of a break point. Allows control
	over command echoing and the scrolling of sequences of event reports.
	Supports aliases, command file sourcing etc. Implements the retry
	command, using the info in the fixed stack slots.

trace/mercury_trace.[ch]:
	Extend the trace controls to support the new functionalities
	required by the new debugger language, which are print levels,
	variable-strictness commands, a more flexible finish command,
	and the retry command.

	Pass the command structure to MR_trace_event_report, since
	the user can now forcibly terminate the scrolling of reports.

trace/mercury_trace_alias.[ch]:
	New module to manage aliases for the debugger.

trace/mercury_trace_help.[ch]:
	New module to interface to browser/help.m.

trace/mercury_trace_spy.[ch]:
	New module to manage break points. The test of whether an event
	matches a break point is now much more efficient than before.
	The new module also allows several breakpoints with different
	actions and different invocation conditions (e.g. all ports,
	entry port, interface ports or specific (possibly internal) port)
	to be defined on the same procedure.

trace/mercury_trace_tables.[ch]:
	New module to manage a table of the debuggable modules, in which
	each such module is linked to the list of the layouts of all the
	procedures defined in that module. This information allows the
	debugger to turn the name of a predicate/function (possibly together
	with its arity and mode number) into the procedure layout structure
	required by the spy point module. Eventually it may also be useful
	in supplying lists of identifiers for command line completion.

	Modules for which no stack layout information is available will
	not be included in the table, since do_init_modules will not
	register any labels for them in the label table.

trace/Mmakefile:
	Mention the new files.

runtime/mercury_array_macros.h:
	A new file holding macros that can be useful in more than one module.

runtime/Mmakefile:
	Mention the new file.

runtime/mercury_conf.h.in:
	Mention a new configuration macro, MR_CANNOT_USE_STRUCTURE_ASSIGNMENT,
	used by runtime/mercury_array_macros.h.

configure.in:
	Find out whether we need to define MR_CANNOT_USE_STRUCTURE_ASSIGNMENT.

ADD TRACE DEPTH HISTOGRAMS

runtime/mercury_conf_param.h:
	Document MR_TRACE_HISTOGRAM.

runtime/mercury_trace_base.[ch]:
	Define the data structures for the histogram, and print the histogram
	when a traced program exits if MR_TRACE_HISTOGRAM is set.

trace/mercury_trace.[ch]:
	If MR_TRACE_HISTOGRAM is defined, record a count of the number of
	events at each depth. This information can help us evaluate space-time
	tradeoffs.

FACTOR OUT SHELL CODE HANDLING GRADE IMPLICATIONS

scripts/final_grade_options.sh-subr:
	A new file to contain any code that implements implications between
	grade flags; currently implements the implication debug -> use trail.

scripts/mgnuc.in:
scripts/ml.in:
	Replace the code that is now in final_grade_options.sh-subr with
	an inclusion of final_grade_options.sh-subr.

configure.in:
	Handle final_grade_options.sh-subr as {init,parse}_grade_options.sh-subr
	are handled.

SIMPLIFY THE MAINTAINANCE OF CONSISTENCY BETWEEN DEBUGGER CODE AND DOCUMENTATION

doc/Mmakefile:
	Add rules for creating mdb_command_list, a C code fragment
	that can included manually in trace/mercury_trace_internal.c
	to supply the list of valid commands, and mdb_command_test.inp,
	which is a list of invalid invocations of debugger commands,
	which tests whether the help message for such invocations
	can be located as expected.

doc/generate_mdb_command_list:
doc/generate_mdb_command_test:
	Awk scripts to create mdb_command_list and mdb_command_test.inp
	respectively from mdb_doc.

tools/bootcheck:
	Copy mdb_command_test.inp from doc to tests/debugger.

tests/debugger/Mmakefile:
	Add a new test that checks whether we get an internal error, unable
	to locate the right help node, for each invalid command invocation in
	mdb_command_test.inp.

UPDATE TEST CASES

tests/debugger/Mmakefile:
	Reenable queens. Conform to the new set of options.

tests/debugger/*.inp:
tests/debugger/*.exp:
	Update the inputs and expected outputs of the debugger test cases
	to use the new command set and output formats.
1998-10-16 06:20:28 +00:00
David Overton
ed91b801be Fix some scripts in the tools directory to work with the new
Estimated hours taken: 0.5

Fix some scripts in the tools directory to work with the new
directories and library names.

tools/binary:
tools/binary_step:
tools/linear:
	Update these scripts to work properly with the new browser and
	trace directories and the renamed libraries.

Mmake.common.in:
scripts/c2init.in:
scripts/ml.in:
	Add tools/binary, tools/binary_step and tools/linear to the
	list of files that know about library names.
1998-10-09 05:41:58 +00:00
Zoltan Somogyi
f633c977f6 Update the comments about the other locations that know the names of
Estimated hours taken: 0.2

Mmake.common.in:
scripts/ml.in:
tools/bootcheck:
	Update the comments about the other locations that know the names of
	the libraries, now that c2init knows them too.

scripts/c2init.in:
	Add a comment about the other locations.
1998-10-01 09:11:10 +00:00
Zoltan Somogyi
8ddce575d4 Introduce two new directories, trace and browser, containing libraries
Estimated hours taken: 10

Introduce two new directories, trace and browser, containing libraries
holding the C and Mercury code of the debugger respectively. (Although
the browser directory does not have a browser in it yet, the browser
should soon become its biggest component.) Take the opportunity to
rename the existing libraries, for consistency.

After this change, the linking order becomes:

	the object of the auto-generated init file
	program object files
	trace library (libmer_trace.a)
	browser library (libmer_browser.a)
	standard library (libmer_std.a)
	runtime library (libmer_rt.a)
	Boehm collector (libgc.a)

To avoid circularities, libraries cannot contain direct calls to
any routines that are defined in libraries (or object files) that
occur earlier in the above list.  Any such calls must be made into
indirect calls via function pointers.

In particular, there was a circularity caused by the library calling
MR_trace() which invokes the tracer which in turn invokes the
library.  This circularity was broken by having MR_trace(),
which is defined in the runtime, call the tracer indirectly via
a global variable named MR_trace_func_ptr.  This global variable
is initialized by the auto-generated *_init.c file.

To avoid linking in the tracer even when it is not being used,
this global variable is only set to point to MR_trace_real()
if you're using a debugging grade or if c2init was invoked
with the `-t' flag.  Otherwise it is set to MR_trace_fake()
which just prints an error message telling the user to
rebuild the executable with debugging enabled.

Makefile.DLLs:
	Reserve random locations for the two new libraries. Whether they work
	will be decided by testing on Windows.

Mmake.common.in:
	Add variables naming the new directories, and create variables
	naming the libraries.

Mmakefile:
	Add targets for the new directories, and modify existing rules
	as appropriate.

browser/Mmakefile:
	Mmakefile for the new directory, modelled on library/Mmakefile.

browser/browser_library.m:
	Umbrella file for the new directory, modelled on library/library.m.

{browser,library}/debugger_interface.m:
	Moved this file from library to browser without change.

browser/help.m:
	A new module for the help system of the debugger. Not yet used.

compiler/Mmakefile:
	Update to refer to the new directories and libraries where
	appropriate.

compiler/mercury_compile.m:
	If we are doing tracing, then pass -t instead of -i to c2init.

compiler/modules.m:
	When generating the .dep file, get the grade flags passed to c2init.

doc/Mmakefile:
	Remove the special treatment of library/debugger_interface.m.

library/Mmakefile:
	Update to refer to the new directories and libraries where
	appropriate, and to conform to the new name of the library.

library/library.m:
	Do not import debugger_interface.

profiler/Mmakefile:
	Update to refer to the new directories and libraries where
	appropriate.

runtime/Mmakefile:
	Update to refer to the new directories and libraries where
	appropriate, and to conform to the new name of the library.

	Remove references to files being moved to the trace directory.

runtime/mercury_init.h:
	Refer to the automatically generated dll header file by its new name
	(renamed because the runtime library is renamed).

	Add declarations to support the new global variable MR_trace_func_ptr.

runtime/mercury_memory_handlers.c:
runtime/mercury_memory_zones.c:
runtime/mercury_misc.c:
	Remove inappropriate #includes of "mercury_trace.h", and substitute
	a #include of "mercury_trace_base.h" if necessary.

{runtime,trace}/mercury_trace.[ch]:
{runtime,trace}/mercury_trace_external.[ch]:
{runtime,trace}/mercury_trace_internal.[ch]:
	Move these files from the runtime to the trace directory.

	The only changes are the removal from mercury_trace.h of declarations
	added to runtime/mercury_trace_base.h, and the change from MR_trace
	to MR_trace_real.

runtime/mercury_trace_base.[ch]:
	Define MR_trace(), which does an indirect call through
	MR_trace_func_ptr if the event should be traced.

	Define MR_trace_fake, which just prints an error message.
	Its address will be assigned to MR_trace_func_ptr if tracing
	is not enabled.

	Define the types needed by the signature of MR_trace.

	Fix an old bug: s/MERCURY_TRACE_PERMANENT_H/MERCURY_TRACE_BASE_H/.

runtime/mercury_wrapper.[ch]:
	Add the new global variable MR_trace_func_ptr.

scripts/c2init.in:
	Add a new option, -t/--trace, which enables tracing by causing the
	address of MR_trace_real to be assigned to MR_trace_func_ptr.

	Have this option be implied by the grade. Also have the old option
	-i (need initialization code) be implied by the grade, as well as by
	-t.

scripts/ml.in:
	Include the new libraries in the link command.

tests/debugger/Mmakefile:
	Include -t instead of -i in the list of c2init options. (-t implies
	-i.)

tools/bootcheck:
	Copy and build the new directories as appropriate. The trace directory
	is treated like the runtime, the browser directory is treated like the
	library.

trace/Mmakefile:
	Mmakefile for the new directory, modelled on runtime/Mmakefile.

util/mkinit.c:
	Add the new option -t, as discussed above.
	Mmakefile for the new directory, modelled on runtime/Mmakefile.

util/Mmakefile:
	Specify -O0, since with the default optimization level, gcc on
	cyclone ignores the assignment of TRUE to need_tracing when -t is
	given (!!!).
1998-09-29 05:12:06 +00:00
Thomas Conway
12e16cd4af fix up the options that I added in the last change.
Estimated hours taken: 0.1

tools/bootcheck:
	fix up the options that I added in the last change. They now are:
		-g, --copy-boehm-gc
	so a bootcheck with a non-mt-safe stage 1 and an mt-safe stage 2/3
	should be invoked:
		bootcheck -r -g ...
1998-09-11 01:06:42 +00:00
Thomas Conway
cc489361e1 Enhance bootcheck to copy the boehm_gc directory as well as the runtime.
Estimated hours taken: 0.25

Enhance bootcheck to copy the boehm_gc directory as well as the runtime.
This was necessary because if the grade for stages 2 and 3 contains *.par.*
but the stage 1 grade doesn't then the collector must be recompiled.

tools/bootcheck:
	Add an option --copy-boehm-gc to copy the boehm_gc directory
	rather than link it.
	Add an option -R which implies --copy-runtime and --copy-boehm-gc.
1998-09-10 07:45:45 +00:00
Zoltan Somogyi
8870e9fc48 Delete stage2/library/*.o only after stage 2 is complete, since
Estimated hours taken: 0.05

tools/bootcheck:
	Delete stage2/library/*.o only after stage 2 is complete, since
	the complete stage2 make requires it.
1998-08-31 04:14:15 +00:00
Zoltan Somogyi
019a8b7cd7 Delete stage2/library/*.o earlier, as soon as we have created the
Estimated hours taken: 0.2

tools/bootcheck:
	Delete stage2/library/*.o earlier, as soon as we have created the
	archive.

	Delete stage2/compiler/*.o later, only after stage3/library has been
	successfully built.

	Set up a better environment for the tests if stages 1 & 2 may have
	different grades.
1998-08-30 03:44:44 +00:00
Zoltan Somogyi
f13e688cd6 If the -r option is given, remove the stage2/runtime directory
Estimated hours taken: 0.5

tools/bootcheck:
	If the -r option is given, remove the stage2/runtime directory
	before creating it. This fixes a problem we used to have with
	the sequence

		tools/bootcheck .....
		tools/bootcheck -2 -r

	which was that the -2 caused the script to leave the stage2 directory
	in place, including the old (symlinked) stage2/runtime, which meant
	that the -r was in effect ignored (stage2/runtime already had the
	right sources), with potentially incorrect results (since
	stage2/runtime have had object files in the wrong grade
	or compiled with the wrong flags).
1998-07-27 11:36:48 +00:00
Zoltan Somogyi
1ab0d14209 Make sure that the environment variable that can cause the
Estimated hours taken: 0.2

tools/bootcheck:
	Make sure that the environment variable that can cause the
	compiler to work interactively is off.
1998-06-19 05:13:54 +00:00
Fergus Henderson
d3c21c0d6a Pass the value of the --use-subdirs option down to
Estimated hours taken: 0.25

tools/bootcheck:
	Pass the value of the --use-subdirs option down to
	subprocesses via the MMAKE_USE_SUBDIRS environment variable.
	This ensures that `tools/bootcheck --use-subdirs' actually
	uses `--use-subdirs' when building the stage2 and stage3
	compilers and when running the test suite.
1998-06-01 00:20:08 +00:00
Fergus Henderson
e6a7d952f6 Use MMAKEFLAGS=-jN' instead of -jN' when doing a make
Estimated hours taken: 0.1

tools/bootcheck:
	Use `MMAKEFLAGS=-jN' instead of `-jN' when doing a make
	at the top level of the stage2 directory.
1998-05-28 10:08:08 +00:00
Fergus Henderson
247b1c24b9 Fix various invasions of the user's namespace by `mercury_builtin.m',
Estimated hours taken: 6

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

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

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

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

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

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

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

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

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

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

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

tests/term/*.trans_opt_exp:
	s/mercury_builtin/builtin/g
1998-05-25 21:55:28 +00:00
Zoltan Somogyi
053498284b If we can't make stage 1, try again after doing "mmake depend"
Estimated hours taken: 1

tools/bootcheck:
	If we can't make stage 1, try again after doing "mmake depend"
	in the library and the compiler directories. This cuts down
	on the number of times when

		you finish work on something
		you do a cvs update
		you fix the conflicts
		you set off an overnight bootcheck
		in the morning you find out that you should have done
			an mmake depend because the update added a new file

tools/test_mercury:
	Now that runtests does mmake realclean instead of mmake clean in
	the benchmark directory if the tests succeed, recreate the .dep
	files explicitly before doing the profiling test.
1998-05-18 09:51:21 +00:00
Zoltan Somogyi
d5c77800ad Add a new option, -d <dir> or --test-dir <dir>, which runs tests
Estimated hours taken: 0.2

tools/bootcheck:
	Add a new option, -d <dir> or --test-dir <dir>, which runs tests
	only in the named directory. This is most useful in conjunction
	with -T, when you want to know whether a change in the runtime
	or test setup is sufficient to cure a problem in a given test dir.

	Reorder option handling to be alphabetical.

	When -T is given, and the script does not do a bootstrap check,
	do not treat this as the failure of the bootstrap check.

tools/binary_step:
	Simplify the code a bit.
1998-05-12 06:05:49 +00:00
Zoltan Somogyi
fcc0e6eaf2 Do not copy the stage 1 compiler into a separate directory,
Estimated hours taken: 0.1

tools/bootcheck:
	Do not copy the stage 1 compiler into a separate directory,
	use the existing copy in the compiler directory.
1998-04-24 02:47:24 +00:00
Zoltan Somogyi
12dfb40683 Remove the stage 2 object files as soon as the stage 2 executable
Estimated hours taken: 0.1

tools/bootcheck:
	Remove the stage 2 object files as soon as the stage 2 executable
	has been successfully created, unless the new -k/--keep-obj option
	is given. (We still keep them if stage 2 fails, since they may
	be useful in analyzing why.)

	This will help us make the most of our limited disk resources,
	so we can waste them more productively :-)
1998-04-15 06:52:37 +00:00
Fergus Henderson
7ebc79e927 Fix some problems with the `--use-subdirs' option.
Estimated hours taken: 6

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

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

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

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

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

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

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

tools/bootcheck:
	Add `--use-subdirs' option (defaults to setting of the
	MMAKE_USE_SUBDIRS environment variable).
	Change the code which compares the stage2 & stage3 C files
	to use the appropriate location for them based on the
	setting of this option.
1998-03-20 02:58:33 +00:00
Zoltan Somogyi
e5af5625c4 Generalize the code that standardizes path names by recognizing some
Estimated hours taken: 0.1

tools/bootcheck:
	Generalize the code that standardizes path names by recognizing some
	more names under which /home/mercury* can be mounted. This allows
	bootchecks on mundook.

	Make sure that when we remove the stage2 or stage3 directory contents,
	we also remove files whose names start with a period.
1998-03-16 00:56:11 +00:00
Fergus Henderson
b18d209e62 Fix a bug: to make all the interface files in the library
Estimated hours taken: 0.5

tools/bootcheck:
	Fix a bug: to make all the interface files in the library
	directory, it needs to do `mmake all-ints', not `mmake ints'.

	(This caused problems with library.int3; previously it happened
	to work becaused that file used to get made from the compiler
	directory, but that doesn't work anymore, because we don't
	allow path names in command-line arguments anymore.)
1998-03-07 03:39:59 +00:00
Zoltan Somogyi
c318fa907b Use a new environment variable MERCURY_ALL_C_INCL_DIRS, which may
Estimated hours taken: 1

scripts/mgnuc.in:
	Use a new environment variable MERCURY_ALL_C_INCL_DIRS, which may
	be defined by the user as a list of -I<dir> options, whose default
	value is -I$MERCURY_C_INCL_DIR. This replaces MERCURY_GC_INCL_DIR.
	The advantage of the new arrangement is that it allows the garbage
	collector header files to be in more than one directory, as they
	are with the Boehm collector (the file gc_inl.h, which is needed at
	-O6, is in boehm_gc/include, while the usual gc.h is in boehm_gc).

tools/bootcheck:
	Set up MERCURY_ALL_C_INCL_DIRS instead of MERCURY_GC_INCL_DIR.
	Tidy some other parts of the script.

doc/user_guide.texi:
	Document the change.
1998-03-03 06:12:35 +00:00
Simon Taylor
673ea1ec4a Set MMAKE_DIR and MERCURY_MOD_LIB_MODS before running the tests.
Estimated hours taken: 0.1

tools/bootcheck
	Set MMAKE_DIR and MERCURY_MOD_LIB_MODS before running the tests.
1998-02-10 23:41:47 +00:00
Zoltan Somogyi
7a2fdbeffc Set things up so that the test suite is not just compiled
Estimated hours taken: 0.5

tools/bootcheck:
	Set things up so that the test suite is not just compiled
	with the stage2 compiler and libraries, but also with the
	stage 2 header files, runtime system garbage collector
	and utility programs.

	Add a new option, -T, that tells bootcheck not to create stages
	2 & 3, and instead runs only the test suite. This is now different
	from simply invoking runtests, since that would not set up
	the environment to test stage 2. This option is useful if
	you find a problem with the tests themselves and want to see
	whether a modification you made to them fixes the problem.
1998-02-08 05:38:08 +00:00
Zoltan Somogyi
83b83f37dc Allow for the possibility of the failure of the RMSTAGECMD command.
Estimated hours taken: 0.1

tools/bootcheck:
	Allow for the possibility of the failure of the RMSTAGECMD command.
1997-12-22 04:04:51 +00:00
Fergus Henderson
da637eeb27 Delete all references to `lp_solve'. It is not needed anymore,
Estimated hours taken: 0.25

.README.in:
Mmakefile:
bindist/Mmakefile:
bindist/bindist.Makefile.in:
tools/bootcheck:
	Delete all references to `lp_solve'. It is not needed anymore,
	now that we have written our own solver.
1997-10-21 14:57:05 +00:00
Fergus Henderson
d3267bd2c8 Link the `lp_solve' directory into the stage2, stage3,
Estimated hours taken: 0.25

tools/bootcheck:
	Link the `lp_solve' directory into the stage2, stage3,
	and stage2sicstus directories, so that `mmake all' works.
1997-10-11 03:27:26 +00:00
Tyson Dowd
acbdcefb73 Fix a bug that was stopping the compiler from being installed correctly.
Estimated hours taken: 1

Fix a bug that was stopping the compiler from being installed correctly.

tools/bootcheck:
	Create links to library.nu.nl.in in the stage 2 and 3 directories.
	(Remove old links to library.m.in at the same time, as it no
	longer exists).

	These missing links were causing the install to fail, because
	the test_mercury script installs from the stage 2 directory.
	(This was in turn leading to an out-of-date compiler being use
	for the tests, so that newly modified test cases would fail
	by giving the old behaviour).
1997-08-07 01:58:45 +00:00
Fergus Henderson
e9d0d85470 Localize the definition of the version number into a single file.
Estimated hours taken: 0.1

Localize the definition of the version number into a single file.
Automate the building of releases, including daily "rotd"
(release-of-the-day) releases.

tools/bootcheck:
	Link .README.in and .INSTALL.in into the stage2 & stage3 directories,
	since they're need by the `all' target.
1997-07-28 09:48:10 +00:00
Fergus Henderson
4f99645558 Localize the definition of the version number into a single file.
Estimated hours taken: 0.25

Localize the definition of the version number into a single file.
Automate the building of releases, including daily "rotd"
(release-of-the-day) releases.

tools/bootcheck:
	When creating the stage2 and stage3 directories,
	link in the VERSION and library/library.m.in files.
1997-07-28 09:40:04 +00:00
Fergus Henderson
3ab044af46 Fix a warning about the rule for making `library/library.init'
clashing with the default rule for creating a `.init' file
in the automatically-generated `library/library.dep' file.
The initialization for the library is different to the
standard automatically-generated initialization, because
the library contains C code that needs explicit initialization.
(because it has BEGIN_MODULE ... END_MODULE macros in it); this
C code hence has `INIT blah' comments in it naming functions that
need to be inserted in the `.init' file so that they will be called
at initialization time.

Mmakefile:
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
tools/bootcheck:
tools/linear:
tools/binary:
	s/library.init/libmercury.init/g
1997-07-21 06:26:43 +00:00
Fergus Henderson
4aa314053e Fix a typo in my previous change: s/$sicstus/$test_sicstus/
Estimated hours taken: 0.1

tools/bootcheck:
	Fix a typo in my previous change: s/$sicstus/$test_sicstus/
1997-05-06 20:34:37 +00:00
Fergus Henderson
6489f7c2fa Implement the following new options:
Estimated hours taken: 1

tools/bootcheck:
	Implement the following new options:
		-s, --sicstus
			As well as running the normal bootcheck, also
			build a SICStus Prolog version of the compiler
			and check it against the stage 2 directory.
		--keep-stage-2-sicstus
			Don't rebuild the SICStus stage 2 directory
			from scratch after building stage 1.  Instead
			use the existing SICStus stage 2 directory.

	Also a few other minor changes:
		- use `&&' rather than `;'
		- avoid problems with symbolic links to /mount/munkora/...
		  not working on mundook, by setting root=$trueroot.
1997-05-06 20:26:32 +00:00
Tyson Dowd
67c5f59e40 Link against the stage 2 libraries when running tests, so that
Estimated hours taken: 1

Link against the stage 2 libraries when running tests, so that
binary incompatabilities don't fail tests that they will pass when
the libraries are installed.

tools/bootcheck:
	Add and export MERCURY_LIBS=... before running tests.
1997-01-24 03:57:19 +00:00
Zoltan Somogyi
52ed13f557 If the environment variable RMSTAGECMD is defined, use it as a prefix
Estimated hours taken: 1.5

binary, bootcheck:
	If the environment variable RMSTAGECMD is defined, use it as a prefix
	on commands to remove stages. This enables those with munkora accounts,
	i.e. me :-) and noone else :-( to execute the rm command on munkora,
	which is faster than removing large numbers of files across NFS.

bootcheck:
	Exit with a non-zero status if the tests directory can't be found.
	This should encourage people to run the tests.

optstages:
	A script to break up the output of mc --debug-opt into several files,
	each containing the output of one optimization stage. This makes it
	easier to run diff and see what has changed.
1997-01-11 07:22:58 +00:00