Commit Graph

3 Commits

Author SHA1 Message Date
Zoltan Somogyi
33eb3028f5 Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
    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 debugger tests,
    specify the new line numbers in .inp files and expect them in .exp files.
2015-02-14 20:14:03 +11:00
Julien Fischer
fe65fe427e Get rid of the `thread_safe' mutable attribute, since this doesn't actually
Estimated hours taken: 1
Branches: main, release

Get rid of the `thread_safe' mutable attribute, since this doesn't actually
make access to a mutable thread safe (in fact it makes them less thread
safe than the `not_thread_safe' version).

By extension this also removes support for the `not_thread_safe' mutable
attribute.

compiler/prog_io.m:
compiler/prog_item.m:
compiler/prog_mutable.m:
	Remove support for the `thread_safe' mutable attribute.

compiler/make_hlds_passes.m:
	Remove support for the `thread_safe' mutable attribute.

	Mark the foreign clauses for `get' predicates for constant
	mutables as thread safe.

doc/reference_manual.texi:
	Delete the documentation for the `thread_safe' mutable attribute.

tests/hard_coded/mutable_decl.m:
tests/hard_coded/pure_mutable.m:
tests/hard_coded/trace_goal_env_1.m:
tests/hard_coded/trace_goal_env_2.m:
tests/hard_coded/unusual_name_mutable.m:
tests/hard_coded/sub-modules/mutable_child.m:
tests/hard_coded/sub-modules/mutable_grandchild.m:
tests/hard_coded/sub-modules/mutable_parent.m:
tests/invalid/bad_mutable.{err_exp,m}:
tests/invalid/not_in_interface.m:
	Conform to the above change.
2006-08-14 09:09:22 +00:00
Julien Fischer
2856c276d5 Make the declarations for the globals variables used to implement mutables
Estimated hours taken: 8
Branches: main

Make the declarations for the globals variables used to implement mutables
visible across module boundaries.  Not doing so means that we cannot inline
the access predicates across module boundaries (this is currently causing
the tests for mutables and sub-modules to fail on that compile with
--intermodule-optimization).

Doing so requires us to module qualify the globals in the generated code, this
diff also fixes an earlier XXX about not mangling the names of mutables.

Add another mutable attribute, foreign_name, that allows the user to override
the compiler's choice of name for the global variable.  This is useful where
foreign code needs also needs to access the mutable, e.g. in library
bindings.  Currently, we only support this facility in the C backends.
(Actually, it's almost implemented for the other backends as well, but
there's no way to test it at the moment).

Support `trailed' and `not_thread_safe' as mutable attributes.  These are
the defaults so in practice they will probably rarely be used.

compiler/make_hlds_passes.m:
	If there is a foreign_name attribute for a mutable, then use that name
	rather than a compiler generated one.

	Make sure that there is a declaration for the global variable in the
	module's .mh file.

	Emit an error message if an attempt is made to use a trailed mutable
	in a non-trailing grade.

compiler/prog_mutable.m:
	Append the module name to the name of the global variable used to
	implement the mutable.

compiler/prog_data.m:
	Make the set of mutable attributes into an abstract type.  Handle this
	in a similar fashion to foreign code attributes.

	Add access predicates for the above type.

	Fix the positioning of comments and section headings in this module.

	Unrelated change: add a comment explaining why the intermediate
	form of the constraints in the termination2_info pragmas is necessary.

compiler/prog_io.m:
	Parse the new mutable attributes.

	Update the description of the source-to-source transformation used to
	implement mutable variables.

compiler/prog_io_pragma.m:
	Export the predicate parse_foreign_language/2.  It is now needed
	by the code that parses mutable declarations.

compiler/globals.m:
	Add a function that returns the compilation target as a string.

doc/reference_manual.m:
	Document the new attributes.

tests/invalid/Mmakefile:
tests/invalid/Mercury.options:
tests/invalid/trailed_mutable.m:
tests/invalid/trailed_mutable.err_exp:
	Test the error message that results if a trailed mutable is used in a
	non-trailing grade.

tests/hard_coded/bad_mutable.{m,err_exp}:
	Extend this test case to cover the new attributes.

tests/hard_coded/Mmakefile:
tests/hard_coded/foreign_name_mutable.{m,exp}:
tests/hard_coded/unusual_name_mutable.{m,exp}:
	Further test for mutable variables.
2005-09-28 09:02:17 +00:00