[m-rev.] for review: implement det exceptions on the .NET backend.

Tyson Dowd trd at cs.mu.OZ.AU
Tue Aug 28 02:02:26 AEST 2001


This change causes a build failure with -O4 and intermodule optimization
due to a bug in intermodule optimization of mode-specific clauses.

>From test-latest-hg.out:
exception.opt:401: In clause mode annotation:
exception.opt:401:   error: undefined inst `exception:handler'/0.
exception.opt:403: In clause mode annotation:
exception.opt:403:   error: undefined inst `exception:handler'/0.
exception.opt:405: In clause mode annotation:
exception.opt:405:   error: undefined inst `exception:handler'/0.
exception.opt:407: In clause mode annotation:
exception.opt:407:   error: undefined inst `exception:handler'/0.
exception.opt:409: In clause mode annotation:
exception.opt:409:   error: undefined inst `exception:handler'/0.
exception.opt:411: In clause mode annotation:
exception.opt:411:   error: undefined inst `exception:handler'/0.


So I will disable it using the following patch, until the compiler is
fixed.

Index: exception.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.50
diff -u -r1.50 exception.m
--- exception.m	2001/08/27 12:15:35	1.50
+++ exception.m	2001/08/27 16:03:38
@@ -612,7 +612,9 @@
 % unsorted_solutions/2), and Mercury does not (yet?) support
 % impure higher-order pred terms.
 %
-:- pragma promise_pure(catch_impl/3).
+% XXX no promise_pure for now, as the multiple modes are disabled
+% due to a bug in intermodule optimization.
+%:- pragma promise_pure(catch_impl/3).
 :- /* impure */
    pred catch_impl(pred(T), handler(T), T).
 :- mode catch_impl(pred(out) is det,       in(handler), out) is det.
@@ -628,19 +630,23 @@
 throw_impl(Univ::in) :-
 	builtin_throw(Univ).
 
-
-catch_impl(Pred::(pred(out) is det), Handler::in(handler), T::out) :-
-	builtin_catch(Pred, Handler, T).
-catch_impl(Pred::(pred(out) is semidet), Handler::in(handler), T::out) :-
-	builtin_catch(Pred, Handler, T).
-catch_impl(Pred::(pred(out) is cc_multi), Handler::in(handler), T::out) :-
-	builtin_catch(Pred, Handler, T).
-catch_impl(Pred::(pred(out) is cc_nondet), Handler::in(handler), T::out) :-
-	builtin_catch(Pred, Handler, T).
-catch_impl(Pred::(pred(out) is multi), Handler::in(handler), T::out) :-
+catch_impl(Pred, Handler, T) :-
 	builtin_catch(Pred, Handler, T).
-catch_impl(Pred::(pred(out) is nondet), Handler::in(handler), T::out) :-
-	builtin_catch(Pred, Handler, T).
+
+% XXX the multiple modes are disabled due to a bug in intermodule optimization.
+%
+%catch_impl(Pred::(pred(out) is det), Handler::in(handler), T::out) :-
+%	builtin_catch(Pred, Handler, T).
+%catch_impl(Pred::(pred(out) is semidet), Handler::in(handler), T::out) :-
+%	builtin_catch(Pred, Handler, T).
+%catch_impl(Pred::(pred(out) is cc_multi), Handler::in(handler), T::out) :-
+%	builtin_catch(Pred, Handler, T).
+%catch_impl(Pred::(pred(out) is cc_nondet), Handler::in(handler), T::out) :-
+%	builtin_catch(Pred, Handler, T).
+%catch_impl(Pred::(pred(out) is multi), Handler::in(handler), T::out) :-
+%	builtin_catch(Pred, Handler, T).
+%catch_impl(Pred::(pred(out) is nondet), Handler::in(handler), T::out) :-
+%	builtin_catch(Pred, Handler, T).
 
 % builtin_throw and builtin_catch are implemented below using
 % hand-coded low-level C code.
@@ -1109,7 +1115,12 @@
 
 	% For the .NET backend we override throw_impl as it is easier to 
 	% implement these things using foreign_proc.
+	%
+	% XXX disabled for now due to a bug in intermodule optimization
+	% that stops the mode specific clauses for throw_impl from being
+	% used.
 
+/*
 :- pragma foreign_proc("C#", throw_impl(T::in), [will_not_call_mercury], "
 	throw new mercury.runtime.Exception(T);
 ").
@@ -1139,7 +1150,6 @@
 			TypeInfo_for_T, Handler, ex.mercury_exception, ref T);
 	}
 ").
-/*
 
 	% We can't implement these until we implement semidet procedures 
 	% for the C# interface.

--------------------------------------------------------------------------
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