[m-dev.] for review: alias branch code gen bug fix

David Overton dmo at cs.mu.OZ.AU
Fri May 21 12:59:23 AEST 1999


Hi,

Zoltan, would you please review this.

Estimated hours taken: 2

Fix a code generation bug that was preventing the alias branch from
bootchecking with --optimize-constructor-last-call.

compiler/unify_gen.m:
	When generating code for shared_local_tag,
	base_typeclass_info_constant and tabling_pointer_constant
	construction unifications, check to see whether the result of
	the construction needs to be placed in a memory reference.
	(This is probably not necessary for the latter two, but it is
	a good idea to check all constructions just in case.)
	
Index: unify_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unify_gen.m,v
retrieving revision 1.83.2.12
diff -u -r1.83.2.12 unify_gen.m
--- 1.83.2.12	1999/05/05 01:25:37
+++ unify_gen.m	1999/05/21 02:28:36
@@ -345,9 +345,9 @@
 	{ Code = tree(Code0, Code1) }.
 unify_gen__generate_construction_2(shared_local_tag(Bits1, Num1),
 		Var, _Args, _Modes, _IMDelta, Code) -->
-	{ Code = empty },
-	code_info__cache_expression(Var,
-		mkword(Bits1, unop(mkbody, const(int_const(Num1))))).
+	unify_gen__cache_unification(Var, 
+		mkword(Bits1, unop(mkbody, const(int_const(Num1)))),
+		Code).
 unify_gen__generate_construction_2(type_ctor_info_constant(ModuleName,
 		TypeName, TypeArity), Var, Args, _Modes, _IMDelta, Code) -->
 	( { Args = [] } ->
@@ -364,9 +364,9 @@
 	;
 		{ error("unify_gen: typeclass-info constant has args") }
 	),
-	{ Code = empty },
-	code_info__cache_expression(Var, const(data_addr_const(data_addr(
-		ModuleName, base_typeclass_info(ClassId, Instance))))).
+	unify_gen__cache_unification(Var, const(data_addr_const(data_addr(
+		ModuleName, base_typeclass_info(ClassId, Instance)))),
+		Code).
 unify_gen__generate_construction_2(tabling_pointer_constant(PredId, ProcId),
 		Var, Args, _Modes, _IMDelta, Code) -->
 	( { Args = [] } ->
@@ -374,12 +374,12 @@
 	;
 		{ error("unify_gen: tabling pointer constant has args") }
 	),
-	{ Code = empty },
 	code_info__get_module_info(ModuleInfo),
 	{ code_util__make_proc_label(ModuleInfo, PredId, ProcId, ProcLabel) },
 	{ module_info_name(ModuleInfo, ModuleName) },
 	{ DataAddr = data_addr(ModuleName, tabling_pointer(ProcLabel)) },
-	code_info__cache_expression(Var, const(data_addr_const(DataAddr))).
+	unify_gen__cache_unification(Var, const(data_addr_const(DataAddr)),
+		Code).
 unify_gen__generate_construction_2(code_addr_constant(PredId, ProcId),
 		Var, Args, _Modes, _IMDelta, Code) -->
 	( { Args = [] } ->
-- 
David Overton       Department of Computer Science & Software Engineering
MEngSc Student      The University of Melbourne, Australia
+61 3 9344 9159     http://www.cs.mu.oz.au/~dmo
--------------------------------------------------------------------------
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