Commit Graph

26 Commits

Author SHA1 Message Date
Zoltan Somogyi
43c37fe2b1 Fix some bit-rot.
Estimated hours taken: 0.1
Branches: main

tools/binary_step:
	Fix some bit-rot.
2011-07-28 06:55:16 +00:00
Zoltan Somogyi
5ad9a27793 Speed up the compiler's handling of code that constructs large ground terms
Estimated hours taken: 80
Branches: main

Speed up the compiler's handling of code that constructs large ground terms
by specializing the treatment of such code.

This diff reduces the compilation time for training_cars_full.m from 106.9
seconds to 30.3 seconds on alys, my laptop. The time on tools/speedtest
stays pretty much the same.

compiler/hlds_goal.m:
	Record the classification of from_ground_term scopes as purely
	constructing terms, purely deconstructing them or something other.

	Fix an old potential bug: variables inside the construct_how fields
	of unifications weren't being renamed along with other variables.
	This is a bug if any part of the compiler later looks at those
	variables. (I am not sure whether or not this happens.)

compiler/superhomogenous.m:
	Provisionally mark newly constructed static terms as being
	from_ground_term_construct. Mode checking will either confirm this
	or change the scope kind.

compiler/options.m:
compiler/handle_options.m:
	Add a new option, from_ground_term_threshold, that allows the user to
	set the boundary between ground terms that get scopes and ground terms
	do not. I plan to experiment with different settings later.

compiler/modes.m:
	Make this classification. For scopes that construct ground terms,
	use a specialized algorithm that avoids quadratic behavior.
	(It does not access the unify_inst_table, which is where the
	factor of N other than the length of the goal list came from.)
	The total size of the instmap_deltas, if printed out, still looks like
	O(N^2) in size, but due to structure sharing it needs only O(N) memory.

	For scopes that construct ground terms, set the determinism information
	so that det_analysis.m doesn't have to traverse such scopes.

	When handling disjunctions, check whether some nonlocals of the
	disjunctions are constructed by from_ground_term_construct scopes.
	For any such nonlocals, set their insts to just ground, throwing away
	the precise information we have about exactly what function symbols
	they and ALL their subterms are bound to. This is HUGE win, since
	it allows us avoid spending a lot of time building a huge merge_inst
	table, which later passes of the compiler (e.g. equiv_type_hlds) would
	then have to spend similarly huge times traversing.

	This approach does have a down side. If lots of arms of a disjunction
	bind a nonlocal to a large ground term, but a few bind it to a SMALL
	ground term, a term below the from_ground_term_threshold, this
	optimization won't kick in. That could be one purpose of the new
	option. It isn't documented yet; I will seek feedback about its
	usefulness first.

compiler/modecheck_unify.m:
	Handle the three different kinds of right hand sides separately.
	This yields a small speedup, because now we don't test rhs_vars and
	rhs_functors (the common right hand sides) for a special case
	(goals containing "any" insts) that is applicable only to
	rhs_lambda_goals.

compiler/unique_modes.m:
	Don't traverse scopes that construct ground terms, since modes.m has
	already done everything that needs to be done.

compiler/det_analysis.m:
	Don't traverse scopes that construct ground terms, since modes.m has
	already done the needed work.

compiler/instmap.m:
	Add a new predicate for use by modes.m.

	Many predicate names in this module were quite uninformative; give them
	informative names.

compiler/polymorphism.m:
	If this pass invalidates the from_ground_term_construct invariants,
	then mark the relevant scope as from_ground_term_other.

	Delete two unused access predicates.

compiler/equiv_type_hlds.m:
	Don't traverse scopes that construct ground terms, since modes.m
	ensures that their instmap deltas do not contain typed insts, and
	thus the scope cannot contain types that need to be expanded.

	Convert some predicates to single clauses.

compiler/goal_form.m:
compiler/goal_util.m:
	In predicates that test goals for various properties, don't traverse
	scopes that construct ground terms when the outcome of the test
	is the same for all such scopes.

	Convert some predicates to single clauses.

compiler/simplify.m:
	Do not look for common structs in from_ground_term_construct scopes,
	both because this speeds up the compiler, and because retaining
	references to ground terms is in fact a pessimization, not an
	optimization. This is because (a) those references need to be stored in
	stack slots across calls, and (b) the C code generators ensure that
	the cells representing ground terms will be shared as needed.

	If all arms of a switch are from_ground_term_construct scopes,
	do not merge the instmap_deltas from those arms, since this is
	both time-consuming (even after the other changes in this diff)
	and extremely unlikely to improve the instmap_delta.

	Disable common_struct in from_ground_term_construct scopes,
	since for these scopes, it is actually a pessimization.

	Do not delete from_ground_term_construct scopes, since many
	compiler passes can now use them.

	Do some manual deforestation, break up some large predicates,
	and give better names to some.

compiler/liveness.m
	Special-case the handling from_ground_term_construct scopes. This
	allows us to traverse them just once instead of three times, and this
	traversal is simpler and faster than any of the three.

	In some traversals, we were switching on the goal type twice; once
	in e.g. detect_liveness_in_goal_2, and once by calling
	goal_expr_has_subgoals. Eliminate the double switching by merging
	the relevant predicates. (The double-switching structure was easier
	to work with before we had multi-cons-id switches.)

compiler/typecheck.m:
	Move a lookup after a test, so we don't have to do it if the test
	fails.

	Provide a specialized mode for a predicate. This should allow the
	compiler to eliminate an argument and a test in the common case.

	Note a possible chance for a speedup.

compiler/typecheck_info.m:
	Don't apply empty substitutions to the types of a possibly very large
	set of variables.

compiler/quantification.m:
	Don't quantify from_ground_term_construct scopes. They are created
	correctly quantified, and any compiler pass that invalidates that
	quantification also removes the from_ground_term_construct mark.

	Don't apply empty renamings to a possibly very large set of variables.

	Move the code for handling scopes to its own predicate, to avoid
	overwhelming the code that handles other kinds of goals. Even from
	this, factor out the renaming code, since it is needed only for
	some kinds of scopes.

	Make some predicate names better reflect what the predicate does.

compiler/pd_cost.m:
	For from_ground_term_construct scopes, instead of computing their cost
	by adding up the costs of the goals inside, make their cost a constant,
	since binding a variable to a static term takes constant time.

compiler/pd_info.m:
	Add prefixes on field names to avoid ambiguities.

compiler/add_heap_ops.m:
compiler/add_trail_ops.m:
compiler/closure_analysis.m:
compiler/constraint.m:
compiler/cse_detection.m:
compiler/dead_proc_elim.m:
compiler/deep_profiling.m:
compiler/deforest.m:
compiler/delay_construct.m:
compiler/delay_partial_inst.m:
compiler/dep_par_conj.m:
compiler/distance_granularity.m:
compiler/exception_analysis.m:
compiler/follow_code.m:
compiler/follow_vars.m:
compiler/format_call.m:
compiler/granularity.m:
compiler/higher_order.m:
compiler/implicit_parallelism.m:
compiler/inlining.m:
compiler/interval.m:
compiler/lambda.m:
compiler/lco.m:
compiler/live_vars.m:
compiler/loop_inv.m:
compiler/middle_rec.m:
compiler/mode_util.m:
compiler/parallel_to_plain_conj.m:
compiler/saved_vars.m:
compiler/stm_expand.m:
compiler/store_alloc.m:
compiler/stratify.m:
compiler/structure_reuse.direct.detect_garbage.m:
compiler/structure_reuse.lbu.m:
compiler/structure_sharing.analysis.m:
compiler/switch_detection.analysis.m:
compiler/trail_analysis.m:
compiler/term_pass1.m:
compiler/tupling.m:
compiler/unneeded_code.m:
compiler/untupling.m:
compiler/unused_args.m:
	These passes have nothing to do in from_ground_term_construct scopes,
	so don't traverse them.

	In some modules (e.g. dead_proc_elim), some traversals had to be kept.

	In loop_inv.m, replace a code structure that updated accumulators
	with functions (which prevented the natural use of state variables),
	that in lots of places reconstructed the term it had just
	deconstructed, and obscured the identical handling of different kinds
	of goals, with a structure based on predicates, state variables and
	shared code for different goal types where possible.

	In store_alloc.m, avoid some double switching on the same value.

	In stratify.m, unneeded_code.m and unused_args.m, rename predicates
	to avoid ambiguities.

compiler/goal_path.m:
compiler/goal_util.m:
compiler/implementation_defined_literals.m:
compiler/intermode.m:
compiler/mark_static_terms.m:
compiler/ml_code_gen.m:
compiler/mode_ordering.m:
compiler/ordering_mode_constraints.m:
compiler/prop_mode_constraints.m:
compiler/purity.m:
compiler/rbmm.actual_region_arguments.m:
compiler/rbmm.add_rbmm_goal_infos.m:
compiler/rbmm.condition_renaming.m:
compiler/rbmm.execution_path.m:
compiler/rbmm.region_transformation.m:
compiler/structure_reuse.direct.choose_reuse.m:
compiler/structure_reuse.indirect.m:
compiler/structure_reuse.lfu.m:
compiler/structure_reuse.versions.m:
compiler/term_const_build.m:
compiler/term_traversal.m:
compiler/unused_imports.m:
	Mark places where we cannot (yet) special case
	from_ground_term_construct scopes.

	In structure_reuse.lfu.m, turn nested if-then-elses into a switch in.

compiler/size_prof.m:
	Turn from_ground_term_construct scopes into from_ground_term_other
	scopes, since in term size profiling grades, we need to attach sizes to
	terms.

	Give predicates better names.

compiler/*.m:
	Minor changes to conform to the changes above.

compiler/make_hlds_passes.m:
	With -S, print statistics after the third pass over items, since
	this is the time-consuming one.

compiler/mercury_compile.m:
	Conform to the new names of some predicates.

	When declining to output a HLDS dump because it would be identical to
	the previous dump, don't confuse the user either by being silent about
	the decision, or by leaving an old dump laying around that could be
	mistaken for a new one.

tools/binary:
tools/binary_step:
	Bring these tools up to date.

compiler/Mmakefile:
	Add an int3s target for use by the new code in the tools. The
	Mmakefiles in the other directories with Mercury code already have
	such a target.

compiler/notes/allocation.html:
	Fix an out-of-date reference.

tests/debugger/polymorphic_ground_term.{m,inp,exp}:
	New test case to check whether liveness.m handles typeinfo liveness
	of ground terms correctly.

tests/debugger/Mmakefile:
	Enable the new test case.

tests/debugger/polymorphic_output.{m,exp}:
	Fix tab/space mixup.
2008-12-23 01:38:03 +00:00
Zoltan Somogyi
fb71faf167 Fix oversights in tools/binary and its components. Copy across .int0
Estimated hours taken: 0.5
Branches: main

tools/binary:
tools/binary_step:
	Fix oversights in tools/binary and its components. Copy across .int0
	files as well as other .int* files, and be prepared for problems that
	arise in the mdbcomp directory.
2008-05-30 02:04:51 +00:00
Peter Wang
ef81b66625 Move the intermodule analysis framework into the `compiler' directory, in
Estimated hours taken: 2
Branches: main

Move the intermodule analysis framework into the `compiler' directory, in
preparation for making it specific to the Mercury compiler, rather than having
it generic in case some fictional being might want to use it with a .NET
compiler one day.  This will make it easier to use and modify.

compiler/analysis.file.m:
compiler/analysis.m:
	Copy these files from the `analysis' directory.

compiler/top_level.m:
	Include analysis.m as a new package.

compiler/Mercury.options:
	Add a bug workaround line from analysis/Mercury.options.

analysis/Mercury.options:
analysis/Mmakefile:
analysis/analysis.file.m:
analysis/analysis.m:
analysis/mer_analysis.m:
	Replace the contents of these files with comments that the analysis
	framework is now in the `compiler' directory.  We don't actually
	delete them so their histories remain easily accessible.

analysis/README:
	Mention that the code has been moved.

compiler/notes/compiler_design.html:
compiler/notes/overall_design.html:
	Update documentation.

Mmake.workspace:
Mmakefile:
configure.in:
compiler/.mgnuc_copts:
compiler/COMP_FLAGS.in:
compiler/Mmakefile:
deep_profiler/.mgnuc_copts:
scripts/Mmake.vars.in:
scripts/c2init.in:
scripts/mercury_config.in:
scripts/prepare_tmp_dir_fixed_part.in:
tools/binary:
tools/binary_step:
tools/bootcheck:
tools/lmc.in:
tools/make_arena:
compiler/notes/coding_standards.html:
	Remove references to the `analysis' directory and `libmer_analysis'.
2008-02-20 03:10:00 +00:00
Zoltan Somogyi
4fe703c7b9 Implement a more cache-friendly translation of lookup switches.
Estimated hours taken: 8
Branches: main

Implement a more cache-friendly translation of lookup switches. Previously,
for a switch such as the one in

	:- pred p(foo::in, string::out, bar::out, float::out) is semidet.

	p(d, "four", f1, 4.4).
	p(e, "five", f2, 5.5).
	p(f, "six", f4("hex"), 6.6).
	p(g, "seven", f5(77.7), 7.7).

we generated three static cells, one for each argument, and then indexed
into each one in turn to get the values of HeadVar__2, HeadVar__3 and
HeadVar__4. The different static cells each represent a column here.
Each of the loads accessing the columns will access a different cache block,
so with this technique we expect to get as many cache misses as there are
output variables.

This diff changes the code we generate to use a vector of static cells
where each cell represents a row. The assignments to the output variables
will now access the different fields of a row, which will be next to each
other. We thus expect only one cache miss irrespective of the number of output
variables, at least up to the number of variables that actually fit into one
cache block.

compiler/global_data.m:
	Provide a mechanism for creating not just single (scalar) static cells,
	but arrays (vectors) of them.

compiler/lookup_switch.m:
	Use the new mechanism to generate code along the lines described above.

	Put the information passed between the two halves of the lookup switch
	implementation (detection and code generation) into an opaque data
	structure.

compiler/switch_gen.m:
	Conform to the new interface of lookup_switch.m.

compiler/ll_pseudo_type_info.m:
compiler/stack_layout.m:
compiler/string_switch.m:
compiler/unify_gen.m:
compiler/var_locn.m:
	Conform to the change to global_data.m.

compiler/llds.m:
	Define the data structures for holding vectors of static cells. Rename
	the function symbols we used to use to refer to static cells to make
	clear that they apply to scalar cells only. Provide similar mechanisms
	for representing static cell vectors and references to them.

	Generalize heap_ref heap references to allow the index to be computed
	at runtime, not compile time. For symmetry's sake, do likewise
	for stack references.

compiler/llds_out.m:
	Add the code required to write out static cell vectors.

	Rename decl_ids to increase clarity and avoid ambiguity.

compiler/code_util.m:
compiler/exprn_aux.m:
	Modify code that traverses rvals to now also traverse the new rvals
	inside memory references.

compiler/name_mangle.m:
	Provide the prefix for static cell vectors.

compiler/layout_out.m:
compiler/rtti_out.m:
compiler/opt_debug.m:
	Conform to the change to data_addrs and decl_ids.

compiler/code_info.m:
	Provide access to the new functionality in global_data.m, and conform
	to the change to llds.m.

	Provide a utility predicate needed by lookup_switch.m.

compiler/hlds_llds.m:
	Fix the formatting of some comments.

tools/binary:
tools/binary_step:
	Fix the bit rot that has set in since they were last used (the rest
	of the system has changed quite a lot since then). I had to do so
	to debug one part of this change.

tests/hard_coded/dense_lookup_switch2.{m,exp}:
tests/hard_coded/dense_lookup_switch3.{m,exp}:
	New test cases to exercise the new algorithm.

tests/hard_coded/Mmakefile:
	Enable the new test cases, as well as an old one (from 1997!)
	that seems never to have been enabled.
2006-03-30 02:46:08 +00:00
Zoltan Somogyi
ecdc285bc7 Split the existing browser library into two libraries, by making the
Estimated hours taken: 10
Branches: main

Split the existing browser library into two libraries, by making the
program_representation module into its own library. This is useful because
the compiler refers to program_representation.m, whose code thus needs to be
linked into compiler executables even if the compiler isn't compiled with
debugging enabled. By creating a new library for this module, we avoid any
chance of the linker dragging in the rest of the modules in the browser
library. (This is a problem with an upcoming diff.).

The name of the new library is "mdbcomp", because the intention is that it
contain code that is shared between the debugger and the compiler. This means
mostly the definitions of data structures that the compiler generates for the
debugger, and the predicates that operate on them.

Mmake.common.in:
	Allow MDB_COMP_ as a prefix for symbol names in the browser directory.

Mmake.workspace:
	Add a make variable holding for the name of the new library, and
	add the name to the relevant lists of libraries.

	Avoid duplicating the lists of filenames that need to be updated
	when adding new libraries or changing their names.

Mmakefile:
	Use make variables to refer to library names.

browser/mdbcomp.m:
browser/mer_mdbcomp.m:
	Add these files as the top modules of the new library.

browser/program_representation.m:
	Make program_representation.m a submodule of mdbcomp, not mdb.

browser/program_representation.m:
browser/browser_info.m:
	Move a predicate from program_representation.m to browser_info.m
	to avoid the mdbcomp library depend on the browser library, since
	this would negate the point of the exercise.

browser/mdb.m:
	Delete program_representation.m from the list of submodules.

browser/Mmakefile:
	Update this file to handle the new module.

browser/Mercury.options:
	Mention the new module.

browser/*.m:
	Update the lists of imported modules. Import only one browser module
	per line.

compiler/notes/overall_design.html:
	Document the new library.

compiler/compile_target_code.m:
	Add the mdbcomp library to the list of libraries we need to link with.

compiler/prog_rep.m:
trace/mercury_trace_internal.c:
	Import program_representation.m by its new name.

scripts/c2init.in:
	Centralize knowledge about which files need to be updated when the list
	of libraries changes here.

scripts/c2init.in:
scripts/ml.in:
tools/binary:
tools/binary_step:
tools/bootcheck:
tools/linear:
tools/lml:
	Update the list of libraries programs are linked with.
2003-10-27 06:00:50 +00:00
Simon Taylor
287e868e21 Make it easier to boostrap the addition of new configuration
Estimated hours taken: 0.5
Branches: main

Make it easier to boostrap the addition of new configuration
options.

scripts/Mercury.config.bootstrap.in:
	A version of Mercury.config.in that does not contain
	any options which are not understood by the installed
	compilers. This is used when building the stage1 compiler.

	Mercury.config is used to build the stage2 and stage3
	compilers, and when running the tests. Mercury.config is
	installed by `mmake install'.

	Mercury.config.bootstrap.in is currently the same
	as Mercury.config.in.

Mmake.workspace:
tools/bootcheck:
tools/binary_step:
tools/lmc.in:
	Work out which configuration file to use.

configure.in:
scripts/Mmakefile:
scripts/mercury_config.in:
	Handle Mercury.config.bootstrap.
2003-05-15 07:23:45 +00:00
Simon Taylor
2b6712425e Clean up the handling of environment variables.
Estimated hours taken: 0.5
Branches: main

Clean up the handling of environment variables.

scripts/Mmake.rules:
scripts/c2init.in:
scripts/mgnuc.in:
scripts/ml.in:
scripts/mmc.in:
scripts/parse_ml_options.sh-subr.in:
scripts/binary_step.in:
	Remove support for the environment variables which were
	previously used to override the location of the standard
	library (MERCURY_ALL_C_INCL_DIRS, MERCURY_ALL_MC_C_INCL_DIRS,
	MERCURY_INT_DIR, MERCURY_C_LIB_DIR, MERCURY_MOD_LIB_MODS,
	MERCURY_TRACE_LIB_MODS).

scripts/Mercury.config.in:
	Fix syntax errors.

	Set the DEFAULT_MERCURY_LINKAGE variable here rather
	than in the mmc script.

scripts/mmc.in:
	Setting DEFAULT_MCFLAGS is no longer required -- mmc
	now reads its configuration information from the
	Mercury.config file. This also fixes a bug which
	caused failures in the `mmc --make' tests in
	debugging grades on mundroo -- `mmc --make' wasn't
	including /usr/local/lib and /usr/local/include in
	the search paths for libraries and headers.

configure.in:
	Check that the installed compiler is capable of
	reading the Mercury.config file.
	Bootstrap tag: bootstrap_20030413_read_config_file.

NEWS:
doc/user_guide.texi:
	Document the change.
2003-04-13 05:48:37 +00:00
Simon Taylor
9406f99f9d Allow tools/bootcheck to be run using `mmake --use-mmc-make'.
Estimated hours taken: 5
Branches: main

Allow tools/bootcheck to be run using `mmake --use-mmc-make'.
The tests don't work yet.

compiler/make.m:
compiler/make.module_target.m:
	Handle targets such as `<module>.cs' and `<module>.ints',
	which are used when building stage 3.

Mmake.common.in:
*/Mmakefile:
*/Mercury.options:
	Add Mercury.options files to pass module-specific flags to
	`mmc --make'.

	Avoid triggering the .DEFAULT rule introduced with `--use-mmc-make'
	for optional files like Mmake.params.

compiler/modules.m:
	Build the interface files when building a library in IL grades,
	for consistency with C grades.

library/Mmakefile:
	Improve performance by removing the dependency on the interface
	files when building the library. The files are now always built
	by the libmer_std target.

	Pass the command to build libmer_std.init to `mmc --make'.

tools/bootcheck:
	Add an option `--use-mmc-make'.

	Copy the Mercury.options files into the stage2 and stage3 directories.

scripts/Mmake.rules:
	Don't include the rules for `.dep' files with `--use-mmc-make'.

	Include the rule for `--convert-to-mercury' even with `--use-mmc-make'.

compiler/Mmakefile:
tools/bootcheck:
tools/binary_step:
	`mmc --make' doesn't handle `<module>_init.c' targets, so
	don't make the `cs' target depend on `top_level_init.c'.
	As far as I can tell, that dependency is only present so
	that the stage2 and stage3 compilers have the same set of
	C files. bootcheck and binary_step now only compare `.c'
	files which are present in the stage3 directory.
2002-06-22 19:16:15 +00:00
Simon Taylor
5d693f5a1c Factor out the common Mmake code to set up the mmc, mgnuc
Estimated hours taken: 8
Branches: main

Factor out the common Mmake code to set up the mmc, mgnuc
and ml flags when building the Mercury compiler and libraries.
Use options, not environment variables. This will make it simpler
to use `mmc --make' to compile the compiler.

Mmake.workspace:
	Similar to tools/lmc. Sets up Mmake variables to
	use the library files in a workspace rather than
	an installed library.

configure.in:
	Check for the `--no-mercury-stdlib-dir' mmc option.
	Bootstrap CVS tag: bootstrap_20020429_stdlib_dir

Mmake.common.in:
*/Mmakefile:
	Move common code into Mmake.workspace.

browser/Mmakefile:
library/Mmakefile:
	Avoid invoking the linker explicitly when creating
	libraries of Mercury code. That won't work well
	with `mmc --make'.

tools/bootcheck:
tests/Mmake.common:
	Use Mmake.workspace instead of setting up environment
	variables in bootcheck.

scripts/Mmake.vars.in:
	mmc compiles split C files to object code itself,
	so pass `--cflags "$(ALL_CFLAGS)"' to mmc when
	compiling with `--split-c-files'.

browser/interactive_query.m:
	Use `mmc --make' when compiling the query. This is needed
	to make tests/debugger/interactive_query.m work when linking
	against a workspace using options rather than environment
	variables.  This also fixes a bug -- mmc options were being
	passed to ml.

	Clean up after the query.

tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
	Generate the input file to this test so that MCFLAGS
	and MC_MAKE_FLAGS (from Mmake.workspace) are used when
	compiling queries.

	tests/debugger/Mmakefile now sets SHELL to /usr/local/bash
	to allow the use of $(...) style command substitution
	(`...` style command substitution can't be nested).

tests/warnings/Mmakefile:
tests/dppd/Mmakefile:
	Include tests/Mmake.common.

tools/*:
scripts/c2init.in:
scripts/ml.in:
	Update the lists of files containing the library names.
2002-04-29 08:22:08 +00:00
Fergus Henderson
c2047349bf Change the options for these tools so that the short form of
Estimated hours taken: 0.5
Branches: main

tools/bootcheck:
tools/binary:
tools/binary_step:
tools/linear:
tools/makebatch:
tools/test_mercury:
	Change the options for these tools so that the short form of
	negative options, such as `--no-test-suite', is `-t-' rather
	than `-t', for consistency with the option handling convention
	used by other Mercury programs such as `mmc' and `ml'.

	I made this change because I found it very confusing
	that `-t' *disabled* the tests in the `tests' directory,
	whereas `-e' *enabled* the tests in the `extras' directory.
	With this change, all options that disable things
	are now of the form `-<letter>-' or `--no-<long-name>'.
2001-12-12 08:02:10 +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
Zoltan Somogyi
bdc7c0ce09 Improvements to the infrastructure for debugging code generator changes.
Estimated hours taken: 5

Improvements to the infrastructure for debugging code generator changes.

tools/binary:
	If either stage2.ok or stage2.bad is missing object files, then do not
	complain: instead, recreate the missing object files.

	Fix a bug: copy the library's .pic_o files together with its .o files.

	Fix a bug: make sure that we link *all* the possible relevant .init
	files from the runtime to the stage2 directory.

	If the search narrows down to one file, and the script is trying to
	find out which part of the file is in error, then consider all the
	parts that are identical between the stage2.ok and stage2.bad to be
	known good from the start. This can reduce the number of bootchecks
	needed by one or two.

tools/binary:
tools/binary_step:
	Allow the test to be the successful compilation of the stage 3 library
	directory. (In almost all cases, bad stage 2 compilers fail while
	compiling the stage 3 library. By not compiling the stage 3 compiler
	if the compilation of the stage 3 library succeeds, we can save a lot
	of time.)

	If the search narrows down to one file, and the script is trying to
	find out which part of the file is in error, watch out for errors that
	prevent the stage 2 executable from being built. If such an error
	occurs, then stop right then and there. In such cases, there is no
	point in further binary search, since each further invocation of
	binary_step will just indicate that the source files in stage2.bad and
	stage2.ok are not compatible (e.g. because they do not use the same
	mapping from static term numbers to static term contents.)

tools/binary_step:
	Reduce the time for declaring a program to be in an infinite loop,
	since the slowest machine we may want to use is faster now.

tools/makebatch:
	Fix some glaring bugs: e.g. test uses -lt, not < for comparisons.

	Add an option, --stop-at-failure, that stops makebatch if a bootcheck
	fails and thus preserves the stage[23] directories involved in the
	failure. This allows one to verify that a change works in many grades
	without sacrificing the ability to debug any problems.

	Add another option --c-files, that gathers the C files created
	in each bootcheck. This allows the C files to be compared, e.g.
	for efficiency problems.
2000-07-19 03:45:11 +00:00
Zoltan Somogyi
8c10d06c2d Update the binary script and its helper to accommodate the changes
Estimated hours taken: 0.5

tools/binary:
tools/binary_step:
	Update the binary script and its helper to accommodate the changes
	in the compilation environment in the last year or so.
2000-03-28 10:43:20 +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
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
d1e7095432 Fix a bug: don't use the stage3 libraries when running test cases
Estimated hours taken: 0.1

binary_step:
	Fix a bug: don't use the stage3 libraries when running test cases
	unless we have actually created the stage3 libraries.
1997-05-12 01:50:57 +00:00
Zoltan Somogyi
f8874facc1 Add a capability to compare stage3 to stage2.bad, not just to stage.ok,
Estimated hours taken: 1

binary_step:
	Add a capability to compare stage3 to stage2.bad, not just to stage.ok,
	for use when the stage3 compilation uses the Mmake parameters from
	stage2.bad.

	Fix a bug: when cleaning out the stage3 directories, remove not
	just the source and interface files but also the date stamp and
	optimization files.

binary:
	Add a capability to generate stage3 using the Mmake parameters from
	stage2.bad, with success being judged by comparing stage3 to
	stage2.bad.

	Use $RMSTAGECMD to remove the old stage2 if it is defined.
1997-04-08 06:10:47 +00:00
Zoltan Somogyi
b7f2bb587f Construct a stage3 before starting the search for the bug.
Estimated hours taken: 1

binary:
	Construct a stage3 before starting the search for the bug.
	We used to be able to rely on a stage3 being already present,
	but this reliance has been misplaced since Fergus's modification
	to bootcheck that deletes stage3 on success.

binary_step:
	Impose a limit of 10 CPU-minutes on every process, to catch
	malfunctioning compilers that don't crash but go into infinite loops.
1997-01-10 05:11:43 +00:00
Zoltan Somogyi
c762e51648 Add a option, -d. When used, the successful making of the stage3
Estimated hours taken: 0.5

binary, binary_step:
	Add a option, -d. When used, the successful making of the stage3
	dependencies is taken to indicate the absence of the bug being searched
	for.
1996-12-21 08:24:10 +00:00
Zoltan Somogyi
a9a3814123 Users of the "binary" script so far could choose between testing the
Estimated hours taken: 1

Users of the "binary" script so far could choose between testing the
correctness of the cobbled-together stage2 compiler by attempting to
create a stage3 compiler, or by running all the tests in some directories.

This change adds a third alternative: checking whether a command executes
successfully. This is useful if the symptom of failure of the stage2
compiler is that it aborts when compiling some file.
1996-11-06 06:00:47 +00:00
Zoltan Somogyi
7a3f8d3a1c Link to absolute, not relative path names, since relative path names
Estimated hours taken: 2

bootcheck, binary, linear:
	Link to absolute, not relative path names, since relative path names
	do not work back across symbolic links.

binary, linear:
	Allow the user to give an initial list of suspects.

assemble, binary, linear:
	Allow negative searches, i.e. searches in which the base version is
	the bad version and we want to see which module "fixes" the problem
	caused by the other modules, as opposed to normal searches in which
	we are looking for the module that introduces the problem.
1996-05-29 11:00:24 +00:00
Zoltan Somogyi
88927c049c Fix a stupid oversight.
Estimated hours taken: 0.1

binary_step:
	Fix a stupid oversight.
1996-05-14 07:01:45 +00:00
Zoltan Somogyi
b221d25b52 <overview or general description of changes>
Estimated hours taken: 1

<overview or general description of changes>

<directory>/<file>:
	<detailed description of changes>
1996-05-13 05:10:23 +00:00
Zoltan Somogyi
4f3bf86a00 I moved the scripts bootcheck, binary, binary_step, divide and assemble
Estimated hours taken: 0.5

I moved the scripts bootcheck, binary, binary_step, divide and assemble
into the tools subdirectory from the main mercury directory.
I also added the auxiliary scripts appears, cleanint and half.

I modified binary and binary_step to compare stage3 with stage2.ok,
and only pass a stage2 compiler if the comparison finds no differences.
This requires that the Mmake.params files be copied, not linked, from
the top level's Mmake.stage2.params. The old behavior (no comparison)
is still available; just specify -c (compile-only).
1996-05-12 04:39:01 +00:00
Zoltan Somogyi
ea788e0453 Rename BRANCH_DELAY_SLOT to HAVE_DELAY_SLOT.
Estimated hours taken: 6

configure.in:
	Rename BRANCH_DELAY_SLOT to HAVE_DELAY_SLOT.

bootcheck:
	Add a new option, -r. If given, this makes a copy of the runtime
	directory instead of linking to it in stage[23]. This allows the
	stage[23] versions to use a different grade than stage1.

	Another change is that we now remake only the library and compiler
	dependencies, but not the profiler dependencies.

binary:
	A shell script to find code generation and optimization bugs by
	performing binary search. It depends on the existence of two
	directories, stage2.ok and stage2.bad, containing correct and buggy
	versions of stage2, and tries different mixes of .c code from each
	until it locates the offending part of the offending .c file.

	Note that this script has so far been tested only in pieces.

binary_step:
	Check whether a particular mix of .c files from the ok and bad
	directories is able to build a stage3 compiler. It doesn't check
	for differences from stage2, since stage2 is a patchwork.

divide:
	Divide a .c file into its parts.

assemble:
	Assemble a .c file, with the specified parts coming from the .c file
	in stage2.bad and the others from stage2.ok.

NOTE: these scripts require some other auxiliary scripts. I will put these
into /usr/local/contrib when it is created on cyclone. In the meantime,
they are in ~zs/bin/script.
1996-04-24 00:58:09 +00:00