Commit Graph

5 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
Peter Wang
d3dc779b89 Add some thread-local mutables to these test cases.
Estimated hours taken: 0
Branches: main

tests/hard_coded/mutable_decl.exp:
tests/hard_coded/mutable_decl.m:
tests/hard_coded/pure_mutable.exp:
tests/hard_coded/pure_mutable.m:
tests/invalid/bad_mutable.err_exp:
tests/invalid/bad_mutable.m:
	Add some thread-local mutables to these test cases.
	(Forgot to commit them earlier.)
2007-01-15 02:24:28 +00: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
Zoltan Somogyi
c3b1c2003e Support constant "mutables". Though this sounds like a contradiction in terms,
Estimated hours taken: 3
Branches: main

Support constant "mutables". Though this sounds like a contradiction in terms,
they can be useful, because in some cases they are the best alternative.

- For some types, e.g. arrays, there is no way to write manifest constants.

- For some other types, one can write manifest constants, but the compiler
  may be too slow in compiling clauses containing them if the constant is
  very large (even after my recent improvements).

- Using a tabled zero-arity function incurs overhead on every access to check
  whether the result was recorded previously or not. This is a bad idea e.g.
  in the inner loop of a scanner (which may want to use an array for the
  representation of the DFA).

compiler/prog_item.m:
	Add a new attribute to say whether the mutable is constant or not.

compiler/prog_io.m:
	Recognize the "constant" mutable attribute.

compiler/prog_mutable.m:
	Provide predicates to construct the signatures of the get and set
	predicates of constant mutables. Rename some existing predicates
	to better reflect their purpose.

compiler/make_hlds_passes.m:
compiler/modules.m:
	Modify the code for creating mutables' get, set and init predicates
	to do the right thing for constant mutables.

doc/reference_manual.texi:
	Document the new attribute.

tests/hard_coded/pure_mutable.{m,exp}:
	Test the new attribute.
2006-04-27 07:34:37 +00:00
Julien Fischer
192a58021b Add optional support for generating a pure interface to mutables.
Estimated hours taken: 8
Branches: main

Add optional support for generating a pure interface to mutables.  This is
done by adding a new mutable attribute, `attach_to_io_state'.  If this
attribute is specified in the mutable declaration then in addition to the
usual non-pure access predicates, the compiler will also add a pair of access
predicates that take the IO state.

compiler/prog_data.m:
	Add the `attach_to_io_state' mutable attribute.

	Add the necessary access predicates for the mutable_var_attributes
	structure.

compiler/prog_io.m:
	Parse the `attach_to_io_state' attribute.

compiler/prog_mutable.m:
	Shift some of the code for constructing items related to mutables to
	this module from make_hlds_passes.  This reduces unnecessary clutter in
	the latter.

	Remove the XXX comment about needing to mangle the names of the
	globals - we now do that.

compiler/make_hlds_passes.m:
	If a mutable has the `attach_to_io_state' attribute specified then
	create pure access predicates that take the IO state in addition
	to the non-pure ones.

compiler/modules.m:
	If we are generating the pure access predicates then output the
	declarations for these predicates in private interfaces.

compiler/type_util.m:
	Replace the use of ':' as a module qualifier in some comments.

doc/reference_manual.texi:
	Document the `attach_to_io_state' mutable attribute.

vim/syntax/mercury.vim:
	Highlight various mutable attributes appropriately.

tests/hard_coded/Mmakefile:
tests/hard_coded/pure_mutable.m:
tests/hard_coded/pure_mutable.exp:
	Test mutables with pure access predicates.

tests/hard_coded/ppc_bug.m:
	Unrelated change: update the comments in this test case so
	they describe what the cause of the bug and the fix were.
2005-10-06 08:26:12 +00:00