[m-rev.] for review: pure mutable access predicates
Ian MacLarty
maclarty at cs.mu.OZ.AU
Wed Oct 5 11:27:26 AEST 2005
On Wed, 5 Oct 2005, Julien Fischer wrote:
>
> For review by Ralph or Ian.
>
> Estimated hours taken: 7
> Branches: main
>
> Add optional support for generating a pure interface to mutables. This is
> done by adding a new mutable attribute, `pure'. 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.
>
I would prefer the pure version to be the default and that there be an `impure'
attribute that generates the impure access predicates. This would be more in
line with our current policy of making impurity explicit.
...
> 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.
You also need to test that io tabling workings properly for the pure
access predicates.
> Index: compiler/make_hlds_passes.m
> ===================================================================
> Index: compiler/modules.m
> ===================================================================
> Index: compiler/prog_data.m
> ===================================================================
> -:- func prog_mutable.init_pred_decl(module_name, string) = item.
> -
> - % XXX We should probably mangle Name for safety...
> - %
> :- func mutable_get_pred_sym_name(sym_name, string) = sym_name.
Does this XXX no longer apply?
...
> +
> + % Return the type io.state.
> + % XXX Perhaps this should be in prog_type?
> + %
Yes, I think it should.
> +:- func io_state_type = (type).
> +
> +io_state_type = defined(qualified(unqualified("io"), "state"), [], star).
> +
> Index: compiler/type_util.m
> ===================================================================
> Index: doc/reference_manual.texi
> ===================================================================
> Index: tests/hard_coded/Mmakefile
> ===================================================================
> Index: tests/hard_coded/ppc_bug.m
> ===================================================================
> RCS file: /home/mercury1/repository/tests/hard_coded/ppc_bug.m,v
> retrieving revision 1.1
> diff -u -r1.1 ppc_bug.m
> --- tests/hard_coded/ppc_bug.m 2 Dec 2004 07:51:28 -0000 1.1
> +++ tests/hard_coded/ppc_bug.m 4 Oct 2005 16:33:35 -0000
> @@ -1,10 +1,13 @@
> -% The following program compiles incorrectly on PPC/MacOS X
> -% in grade reg.gc. find_nth_yes/4 ends up throwing an
> -% exception instead of returning `YesPos = 3'. Passing
> -% `--no-optimize-fulljumps' causes the test to pass.
> +% The following program compiles incorrectly on PPC/MacOS X in grade reg.gc.
> +% find_nth_yes/4 ends up throwing an exception instead of returning `YesPos =
> +% 3'. Passing `--no-optimize-fulljumps' causes the test to pass.
> %
> -% The test passes with gcc 2.95.2 (Apple version)
> -% but fails with gcc 3.3 (Apple version).
> +% The test passes with gcc 2.95.2 (Apple version) but fails with gcc 3.3
> +% (Apple version).
As far as I know the compiler doesn't compile at all with Apple gcc 2.95
because that version of gcc can't handle long identifiers.
> +%
> +% The problem was that gcc's `-floop-optimize' options was incompatible
> +% with our use of global registers. The fix is to make sure that option
> +% is disabled on powerpc-apple-darwin.
>
> :- module ppc_bug.
>
> Index: tests/hard_coded/pure_mutable.exp
> ===================================================================
> Index: tests/hard_coded/pure_mutable.m
> ===================================================================
> Index: vim/syntax/mercury.vim
> ===================================================================
Otherwise that looks fine.
Ian.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list