[m-rev.] diff: fix assertion failures when ignoring tabling pragmas

Julien Fischer juliensf at cs.mu.OZ.AU
Wed Dec 22 16:43:57 AEDT 2004


Estimated hours taken: 0.5
Branches: main

compiler/table_gen.m:
	Fix the code the that ignores tabling pragmas in
	unsupported grades so that it no longer causes assertion
	failures in the ml code generator.

Julien.

Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.69
diff -u -r1.69 table_gen.m
--- compiler/table_gen.m	20 Dec 2004 07:45:13 -0000	1.69
+++ compiler/table_gen.m	22 Dec 2004 05:40:02 -0000
@@ -139,8 +139,9 @@
 		!ModuleInfo, !GenMap, !IO) :-
 	proc_info_eval_method(ProcInfo0, EvalMethod),
 	( eval_method_requires_tabling_transform(EvalMethod) = yes ->
-		table_gen__transform_proc(EvalMethod, PredId, ProcId,
-			ProcInfo0, _, PredInfo0, _, !ModuleInfo, !GenMap, !IO)
+		table_gen__transform_proc_if_possible(EvalMethod, PredId,
+			ProcId, ProcInfo0, _, PredInfo0, _, !ModuleInfo,
+			!GenMap, !IO)
 	;
 		module_info_globals(!.ModuleInfo, Globals),
 		globals__lookup_bool_option(Globals, trace_table_io, yes),
@@ -361,7 +362,21 @@
 		Msg = [words("Ignoring the pragma"), fixed(EvalMethodStr),
 			words("for"), fixed(Name), words("due to lack of"),
 			words("support on this back end."), nl],
-		error_util__write_error_pieces(Context, 0, Msg, !IO)
+		error_util__write_error_pieces(Context, 0, Msg, !IO),
+		%
+		% XXX We set the evaluation method to eval_normal here
+		% to prevent problems in the ml code generator if we
+		% compiling in a grade that does not support tabling.
+		% (See ml_gen_maybe_add_table_var/6 in ml_code_gen.m for
+		%  further details.)
+		%
+		% We do this here rather than when processing the tabling
+		% pragmas in make_hlds.m so that we can still generate
+		% error message for misuses of the tabling pragmas.
+		%
+		proc_info_set_eval_method(eval_normal, !ProcInfo),
+		module_info_set_pred_proc_info(PredId, ProcId, !.PredInfo,
+			!.ProcInfo, !ModuleInfo)
 	).

 :- pred table_gen__transform_proc(eval_method::in, pred_id::in, proc_id::in,

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