Commit Graph

22 Commits

Author SHA1 Message Date
Zoltan Somogyi
1171e89bc9 Rename X's aux modules as X_helper_N in tabling. 2023-09-18 21:54:30 +10:00
Zoltan Somogyi
a0d6710407 Use "ts=4 sw=4 expandtab" as modeline ...
... in Mercury.options files.
2023-09-16 19:12:52 +10:00
Julien Fischer
383c2c307f Fix failure of trailing/test_trail_reset on Windows.
tests/trailing/test_trail_reset.m:
     Fix mismatched conversion specifier and cast.
2023-07-10 00:11:29 +10:00
Zoltan Somogyi
1f45f91886 Make "mmake runtests" work again.
My commit afe2887882 broke the ability
to run the test suite outside of a bootcheck by executing "mmake runtests"
in the tests directory. This diff fixes that.

tests/Mmake.common:
    Don't define "TESTS_DIR = ..". While every single tests/*/Mmakefile
    defined it as such, I overlooked the fact that tests/Mmakefile itself
    defined it ".", referring to the same directory from a different starting
    point. Document this easily-overlooked fact.

    Rename the old runtests target, which after afe2887 runs the tests
    in a single directory, as runtests_dir, to leave the target name
    "runtests" itself free for tests/Mmakefile to use.

tests/Mmakefile:
    Define "TESTS_DIR = .", and add a target "runtests" which invokes
    "mmake runtests_dir" in each test directory.

tools/bootcheck:
    Invoke "mmake runtests_dir" instead of "mmake runtests" in each
    test directory.

    Initialize a variable just before it is used.

tests/*/Mmakefile:
    Add back the definition "TESTS_DIR = .."
2020-06-10 01:05:15 +10:00
Zoltan Somogyi
afe2887882 Remove stale references to test subdirs.
A long time ago, test directories such as hard_coded had subdirectories
such as hard_coded/typeclasses. These have since been flattened out
(e.g. hard_coded/typeclasses is now just typeclasses), but there were
still remnants of the old approach. This diff deletes those remnants.

tests/*/Mmakefile:
    Delete the TESTS_DIR and the SUBDIRS mmake variables; TESTS_DIR
    was always set to "..", and SUBDIRS to the empty string.

    Delete any references to the make variable NOT_WORKING, since
    it is never used.

tests/Mmake.common:
    Document that Mmakefiles in test directories don't have to set
    TESTS_DIR and SUBDIRS anymore. Fix the formatting of the documentation
    of the make variables they do still have to set.

    Delete the targets and actions for handling subdirectories of
    test directories, since there aren't any.

tests/Mmakefile:
    Simplify some code.
2020-04-14 11:23:12 +10:00
Zoltan Somogyi
8a764392d9 Avoid warnings from make in test directories.
tests/Mmake.common:
    Don't invoke any actions in the clean_local and realclean_local
    targets, since if using mmc --make, the builtin mmake rules
    have actions for those targets as well, and make can't handle
    more than one action for a target having actions. Replace those
    actions with dependencies on other, unique targets that have
    the actions instead.

tests/*/Mmakefile:
    Avoid actions in clean_local and realclean_local targets the same way.

    Sort the test names in some directories that didn't already do so.

    Delete some obsolete comments.

    Fix style.

tests/valid/Mmake.valid.common:
    As for the Mmakefiles above, and also move the definition of a make
    variable before it is needed.
2015-09-08 05:57:53 +10:00
Zoltan Somogyi
73f0a36719 Allow the use of -jN in many test directories.
tests/Mmake.common:
    Replace the -j1 in the runtests_local target used by all the test
    directories with $(MAYBE_J1).

tests/*/Mmakefile:
    Define MAYBE_J1 it as the empty string in test directories in which
    different tests don't share source files.

    Define MAYBE_J1 as -j1 in test directories in which
    different tests do share source files.

tests/submodules/sub2_a.m:
    Add this copy of sub_a.m to allow tests in the submodules directory
    to be done in parallel.

tests/submodules/accessibility2.m:
    Import sub2_a.m instead of sub_a.m.

tests/warnings/ambig_types_high_level.m:
    Add this copy of ambig_types.m to allow tests in the warnings directory
    to be done in parallel.

tests/warnings/ambig_high_level.m:
    Import ambig_types_high_level.m instead of ambig_types.m.
2015-02-19 06:02:45 +11:00
Zoltan Somogyi
fdd141bf77 Clean up the tests in the other test directories.
tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the tests
    that check compiler error messages, expect the new line numbers.

browser/cterm.m:
browser/tree234_cc.m:
    Import only one module per line.

tests/hard_coded/boyer.m:
    Fix something I missed.
2015-02-16 12:32:18 +11:00
Zoltan Somogyi
d33273d033 Tell vim not to expand tabs in Makefiles.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.

*/Makefile:
*/Mmakefile:
    As above.

tests/hard_coded/.gitignore:
    Don't ignore the purity subdir. This ignore must have been left over
    from when purity.m was a test in hard_coded, not hard_coded/purity,
    and it ignored an executable, not a directory.
2015-01-08 22:07:29 +11:00
Julien Fischer
b635ebf80b Convert .cvsignore -> .gitignore files in tests directory.
tests/*/.cvsignore:
    As above.

library/.gitignore:
    Ignore files generated by the namespace cleanliness check.
2013-01-07 14:33:25 +11:00
Julien Fischer
a60beb42e7 Make the none.gc.memprof grade work with MSVC again.
Branches: main, 11.07

Make the none.gc.memprof grade work with MSVC again.

Avoid more warnings when compiling with MSVC.

compiler/layout_out.m:
	Avoid an incomplete type in the declaration of the alloc_sites
	array.  (Similar changes need to be made for the layout structures
	related to debugging and deep profiling - I am in the process of
	testing the former, the latter doesn't currently work on Windows
	any way.)

browser/listing.m:
	Use don't-care variables in some foreign_procs.
	This avoids warnings about assignments from uninitialized
	variables with MSVC.

*/.cvsignore:
	Update cvsignore entries.

	Ignore files generated by mprof.
2011-10-20 06:37:35 +00:00
Julien Fischer
f94d6e3621 Fix the failure of tests/trailing/tu_test2 in low-level C grades.
This test checks that trail usage optimisation is correctly removing trail
operations from around semidet conditions in if-the-elses.
It is failing because inlining is simplifying away the if-then-else.
(Differences in the way the HLDS is transformed for the high-level
C backend means that is it working for that.)

tests/trailing/tu_test2.m:
	Add a no_inline pragma in order to avoid the above problem.
2010-01-06 23:45:42 +00:00
Zoltan Somogyi
dcd2922eb4 Sort the lists of tests in each directory. (We usually keep each list
Estimated hours taken: 0.2
Branches: main

tests/*/Mmakefile:
	Sort the lists of tests in each directory. (We usually keep each list
	sorted, but then we concatenate several lists, which loses the order.)
	This gives you a better idea of how far a bootcheck still has to go.

tools/bootcheck:
	Build the interface files before the rest of the files in the library
	directory. Again, this gives you a better idea of how far a bootcheck
	still has to go.

	Make the dependencies for the slice subdirectory of the stage2 at the
	same time as the other subdirs; don't let it be caught later.

library/Mmakefile:
	Build the interface files in the right order.
2008-12-01 00:32:58 +00:00
Julien Fischer
9c98a60bd5 Add a mechanism for dynamically growing the trail by adding new segments to it
Estimated hours taken: 20
Branches: main

Add a mechanism for dynamically growing the trail by adding new segments to it
in a similar fashion to what we do for the stacks with stack segments.  The
mechanism is enabled by the trseg (trail segments) grade component.  Unlike
stack segments the trail segment mechanism also works with the high-level C
backend.

The mechanism works by adding a test to MR_trail_{value,function} that checks
if we are about to run out of a trail and allocates a new trail segment if
that test succeeds.

Extend mdb's trail_details command to print the current number of trail
segments in trseg grades.

Fix a bug where the MR_trail_ptr was not being reset correctly after
a trail reset.

runtime/mercury_grade.h:
	Add the new grade component.

runtime/mercury_conf_param.h:
	Document the new grade component, and the option used to debug
	trail segments.

runtime/mercury_memory_zones.h:
	Shift the definition MR_MemoryZones to this file in order break
	a cyclic dependency between header files.

runtime/mercury_context.h:
	Add a new field to the context structure to hold a list previous
	trail segments.

	Delete the definition of the type MR_MemoryZones from here.

runtime/mercury_trail.[ch]:
	When adding a new trail entry in trseg grades first check whether we
	need to extend the trail and do so if necessary.

	Export the definitions of MR_TRAIL_{BASE,ZONE}.

	Add a macro, MR_PREV_TRAIL_ZONES, for accessing the list of trail zones
	in a grade independent manner.

	Fix a typo in a comment.

	Add functions for creating and destroying trail segments.

	Handle trail segments in the code that handles untrailing and
	resets.  This also fixes a bug with trail reset where MR_trail_ptr
	was not being reset along with the rest of the trail state.

compiler/options.m:
compiler/handle_options.m:
compiler/compile_target_code.m:
scripts/canonical_grade.sh-subr:
scripts/init_grade_option.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
	Handle the new grade component.

trace/mercury_trace_cmd_developer.c:
	Make the trail_details command print out the number of trail segments
	in trseg grades.

tests/trailing/Mmakefile:
tests/trailing/tr_reset_bug.{m,exp}:
	Regression test for the bug with trail resets.
2008-09-05 11:19:34 +00:00
Julien Fischer
abda0be991 Provide a mechanism for resetting the trail.
Estimated hours taken: 3
Branches: main

Provide a mechanism for resetting the trail.  This allows the reuse of
memory that is occupied by any entries on the trail.  This can only be done
safely after it is certain that any calls that added the trail entries
cannot be backtracked over.  For some programs doing this can prevent trail
exhaustation.

This diff does not provide a way of doing this at the Mercury level, nor
can the compiler currently automatically add calls to reclaim memory used
by trail.  Both these things are future work.

XXX the interaction between this and the debugger is a bit unclear since
trailing and debugging don't currently work together properly.

runtime/mercury_trail.h:
runtime/mercury_trail.c:
 	Add a new function MR_reset_trail().  When called this
 	function walks back along the trail calling function trail entries
 	with the MR_gc untrail reason.  It then zeros out the trail zone
 	and resets the ticket counter and ticket high water mark to their
 	initial values.

 	Define two macros, MR_TRAIL_ZONE and MR_TRAIL_BASE that expand
 	to the addresses of the trail zone and the base of the trail
 	respectively in a grade independent manner.

 	Redefine MR_num_trail_entries() using the MR_TRAIL_BASE macro.

 	Document that MR_gc is now used for this.

 	Fix a typo.

tests/trailing/Mmakefile:
tests/trailing/test_trail_reset.m:
tests/trailing/test_trail_reset.exp:
 	A test of the trail reset functionality.
2008-06-13 07:27:56 +00:00
Julien Fischer
4212e2c7d6 In trailing grades, pass flags to the C compiler that force it to align
Estimated hours taken: 6
Branches: main

In trailing grades, pass flags to the C compiler that force it to align
functions on word boundaries.  For some architectures, and for some C compiler
optimisation settings, function addresses are not aligned and this breaks
function trailing when using tagged trail entries.

XXX this diff only fixes the problem for gcc, it's not clear what,
if anything, needs to be done for other C compilers.

configure.in:
	s/COMPILER/C_COMPILER_TYPE/.  The former is ambiguous as
	Mercury uses compilers for several languages.

	Instantiate the value of C_COMPILER_TYPE in files generated
	by the configure script.

	Add an XXX comment about how the type of the C compiler
	is determined.

	Clean up a few things.

compiler/globals.m:
	Define a type, c_compiler_type/0, that represents the type
	of C compiler we are using.  (This type replaces the old
	compiler_type/0 type from compile_target_code.m).

	Add a new field to the globals structure that stores the
	C compiler type.

	Add access and utility procedures for the new field.

	Delete some business with unique modes that used to be
	required when the I/O globals field was unique.

compiler/options.m:
	Simplify the implementation of `--c-compiler-type'.
	Most of it is now handled by the globals module.

scripts/Mercury.config.in:
	Define a new variable MERCURY_C_COMPILER_TYPE, whose value
	is set by the configuration script.

	Pass the C compiler type to the Mercury compiler.

compiler/compile_target_code.m:
scripts/mgnuc.in:
	When in a trailing grade and using gcc as a C compiler align
	functions on word boundaries in order to avoid problems
	with function trailing.

	Delete the unused type compiler_type/0.

tests/trailing/Mercury.options:
	Remove a workaround for the function alignment problem.
2008-01-23 13:12:17 +00:00
Julien Fischer
e5039e1a91 Document that values and the addresses of functions that are placed on the
Estimated hours taken: 1
Branches: main

Document that values and the addresses of functions that are placed on the
trail must be word aligned.

Fix some failing test cases in the .ll_debug grades.

doc/reference_manual.texi:
	Document that the addresses of the C functions used in function trailing
	need to be word aligned.

tests/trailing/Mercury.options:
	Fix the failure of some trailing test cases in .ll_debug grades by ensuring
	that C functions are aligned on 64-bit boundaries.  (The set of C
	optimisations implied by the .ll_debug grades disable the -falign-functions
	optimisation.)
2008-01-21 03:01:10 +00:00
Peter Wang
890b02d162 Set PROGS variable, otherwise this directory doesn't test properly
Estimated hours taken: 0.5
Branches: main

tests/trailing/Mmakefile:
	Set PROGS variable, otherwise this directory doesn't test properly
	when using `mmc --make'.
2007-09-17 05:26:34 +00:00
Julien Fischer
28724796a1 Ingore .mgnuc* files.
tests/trailing/.cvsignore:
	Ingore .mgnuc* files.
2007-07-23 02:09:08 +00:00
Julien Fischer
b8fd14de7e Fix a bug with trail usage optimization that was causing it to break the G12
Estimated hours taken: 10
Branches: main, release

Fix a bug with trail usage optimization that was causing it to break the G12
fd tests.  The problem was that the optimization we were applying to model_non
disjunctions was incorrect - instead of considering trail updates along all
forward execution paths from the creation of a choicepoint to the commit, it
was only considering updates along parts of those paths.

The fix (for now) is to remove that particular part of the optimization.
(It will be possible to reinstate part of the optimization but doing so
requires creating trail specialized versions of procedures -
something that we don't currently have support for.)

compiler/trailing_analysis.m:
	Treat any goal that creates a choicepoint as potentially modifying
	the trail.

compiler/add_trail_ops.m:
	Modify the MLDS code generator to conform to the above.

compiler/code_model.m:
compiler/disj_gen.m:
compiler/ite_gen.m:
	Do the same for the LLDS code generator.

tests/trailing/tu_test1.{m,exp}:
	Test case for the above bug.

tests/trailing/tu_test2.{m,exp}:
	Test that trail usage optimization of semidet if-then-else
	conditions still works.

tests/trailing/Makefile:
tests/trailing/Mercury.options:
	Enable the new test cases.
2006-09-06 04:04:18 +00:00
Julien Fischer
384cbce776 Fix a cut-and-paste error. Only run these tests in trailing
Estimated hours taken: 0
Branches: main

test/trailing/Mmakefile:
	Fix a cut-and-paste error.  Only run these tests in trailing
	grades, not the other way around.
2006-01-27 05:19:02 +00:00
Julien Fischer
6af09740fd Move some of the regression tests for trailing from
Estimated hours taken: 1
Branches: main

Move some of the regression tests for trailing from
extras/trailed_update/tests to a new trailing subdirectory in the test suite.
The motivation for doing this is that parts of the trailed_update package are
broken (and likely to remain so until the solver type/purity situation is
sorted out) and the tests are not being run.

extras/trailed_update/tests/Mmakefile:
extras/trailed_update/tests/func_trail_test.{m,exp}:
extras/trailed_update/tests/func_trail_test_2.{m,exp}:
	Delete these tests from here.

tests/trailing:
	New subdirectory that contains regression tests for trailing.

tests/trailing/Mmakefile:
tests/trailing/Mercury.options:
tests/trailing/func_trail_test.{m,exp}:
tests/trailing/func_trail_test_2.{m,exp}:
	Move the test cases from extras/trailed_update/tests to here.

	Update the syntax in the test cases and escape some special characters
	in the C code correctly.

tests/README:
	Update this file to mention the trailing directory.
2006-01-11 05:12:23 +00:00