[m-dev.] for review: IL backend bugfixes

Tyson Dowd trd at cs.mu.OZ.AU
Sun Oct 22 20:09:35 AEDT 2000


On 22-Oct-2000, Tyson Richard DOWD <trd at cs.mu.OZ.AU> wrote:
> On 22-Oct-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> > 
> > The "ml_code_gen" there dates from the time when all that code was in
> > ml_code_gen.m rather than ml_code_util.m.  It seems potentially misleading now.
> > Perhaps it should be "ml_code_util.m" or "MLDS (--high-level-code) back-end".
> > 
> > Apart from that, this change looks fine.
> 
> Probably the best fix is to stop using sorry/1 and unexpected/1
> altogether, and use the approach I used in the IL backend.
> 
> I'll commit this diff and start working on one to do this.


===================================================================


Estimated hours taken: 1

compiler/ml_code_util.m:
	Remove sorry/1 and unexpected/1.
	
compiler/ml_call_gen.m:
compiler/ml_unify_gen.m:
	Use sorry/2 and unexpected/2 instead.


Index: compiler/ml_call_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_call_gen.m,v
retrieving revision 1.15
diff -u -r1.15 ml_call_gen.m
--- compiler/ml_call_gen.m	2000/09/06 05:20:55	1.15
+++ compiler/ml_call_gen.m	2000/10/22 08:28:09
@@ -99,7 +99,7 @@
 
 :- import_module hlds_module.
 :- import_module builtin_ops.
-:- import_module type_util, mode_util.
+:- import_module type_util, mode_util, error_util.
 :- import_module options, globals.
 
 :- import_module bool, int, string, std_util, term, varset, require, map.
@@ -190,7 +190,7 @@
 		{ FuncRval = unop(unbox(FuncType), lval(FuncLval)) }
 	;
 		{ GenericCall = aditi_builtin(_, _) },
-		{ sorry("Aditi builtins") }
+		{ sorry(this_file, "Aditi builtins") }
 	),
 
 	%
@@ -842,3 +842,9 @@
 ml_gen_simple_expr(unary(Op, Expr)) = unop(std_unop(Op), ml_gen_simple_expr(Expr)).
 ml_gen_simple_expr(binary(Op, Expr1, Expr2)) =
 	binop(Op, ml_gen_simple_expr(Expr1), ml_gen_simple_expr(Expr2)).
+
+
+:- func this_file = string.
+this_file = "ml_call_gen.m".
+
+:- end_module ml_call_gen.
Index: compiler/ml_code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_util.m,v
retrieving revision 1.24
diff -u -r1.24 ml_code_util.m
--- compiler/ml_code_util.m	2000/10/22 07:27:19	1.24
+++ compiler/ml_code_util.m	2000/10/22 07:57:31
@@ -85,14 +85,6 @@
 		mlds__statement, mlds__defn, ml_gen_info, ml_gen_info).
 :- mode ml_gen_label_func(in, in, in, in, out, in, out) is det.
 
-	% Call error/1 with a "Sorry, not implemented" message.
-	%
-:- pred sorry(string::in) is erroneous.
-
-	% Call error/1 with an "Unexpected" message.
-	%
-:- pred unexpected(string::in) is erroneous.
-
 %-----------------------------------------------------------------------------%
 %
 % Routines for generating types.
@@ -785,14 +777,6 @@
 	Abstractness = concrete,
 	MLDS_DeclFlags = init_decl_flags(Access, PerInstance,
 		Virtuality, Finality, Constness, Abstractness).
-
-	% Call error/1 with a "Sorry, not implemented" message.
-	%
-sorry(What) :-
-	error_util__sorry("ml_code_gen", What).	
-
-unexpected(What) :-
-	error_util__unexpected("ml_code_gen", What).	
 
 %-----------------------------------------------------------------------------%
 %
Index: compiler/ml_unify_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_unify_gen.m,v
retrieving revision 1.19
diff -u -r1.19 ml_unify_gen.m
--- compiler/ml_unify_gen.m	2000/10/09 08:48:53	1.19
+++ compiler/ml_unify_gen.m	2000/10/22 08:27:43
@@ -76,7 +76,7 @@
 
 :- import_module hlds_module, hlds_out, builtin_ops.
 :- import_module ml_call_gen, ml_type_gen, prog_util, type_util, mode_util.
-:- import_module rtti.
+:- import_module rtti, error_util.
 :- import_module code_util. % XXX needed for `code_util__cons_id_to_tag'.
 :- import_module globals, options.
 
@@ -128,7 +128,7 @@
 	{ require(unify(CodeModel, model_det),
 		"ml_code_gen: construct not det") },
 	{ MaybeAditiRLExprnID = yes(_) ->
-		sorry("Aditi closures")
+		sorry(this_file, "Aditi closures")
 	;
 		true
 	},
@@ -410,11 +410,15 @@
 	;
 		{ EvalMethod = (aditi_bottom_up) },
 		% XXX not yet implemented
-		{ sorry("`aditi_bottom_up' closures") }
+		{ sorry(this_file, "`aditi_bottom_up' closures") }
 	;
 		{ EvalMethod = (aditi_top_down) },
 		% XXX not yet implemented
-		{ sorry("`aditi_top_down' closures") }
+		{ sorry(this_file, "`aditi_top_down' closures") }
 	),
 
 	%
@@ -1753,3 +1757,9 @@
 	;
 		error("ml_gen_field_id: invalid type")
 	).
+
+
+:- func this_file = string.
+this_file = "ml_unify_gen.m".
+
+:- end_module ml_unify_gen.


-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list