[m-rev.] trivial diff: don't inline code that assumes --no-reorder-disj

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Mar 22 05:27:37 AEDT 2007


Estimated hours taken: 0.1
Branches: main

library/exception.m:
 	Prevent the compiler from inlining code from the exception module
 	that assumes `--no-reorder-disj' in modules that may not be compiled
 	with that option.

Julien.

Index: exception.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.123
diff -u -r1.123 exception.m
--- exception.m	18 Jan 2007 07:33:02 -0000	1.123
+++ exception.m	21 Mar 2007 18:24:21 -0000
@@ -281,13 +281,17 @@
  :- mode get_determinism_2(pred(out, di, uo) is cc_multi,
      out(bound(exp_detism_cc_multi))) is cc_multi.

-% The calls to error/1 here are needed to ensure that the
-% declarative semantics of each clause is equivalent,
-% but operationally they are unreachable;
-% since each mode has determinism cc_multi,
-% it will pick the first disjunct and discard the call to error/1.
+% The calls to throw/1 here are needed to ensure that the declarative
+% semantics of each clause is equivalent, but operationally they are
+% unreachable; since each mode has determinism cc_multi, it will pick the
+% first disjunct and discard the call to error/1.
  % This relies on --no-reorder-disj.
+%
+% NOTE: since there is no guarantee that modules that opt import these
+% predicates will be compiled with `--no-reorder-disj' we need to make
+% sure they are not inlined in other modules.

+:- pragma no_inline(get_determinism/2).
  :- pragma promise_equivalent_clauses(get_determinism/2).

  get_determinism(_Pred::(pred(out) is det),
@@ -321,6 +325,7 @@
      ; throw(software_error("get_determinism"))
      ).

+:- pragma no_inline(get_determinism_2/2).
  :- pragma promise_equivalent_clauses(get_determinism_2/2).

  get_determinism_2(_Pred::pred(out, di, uo) is det,

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list