[m-rev.] IL back-end: fix bug with `:- external'

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Oct 18 04:42:03 AEST 2002


Estimated hours taken: 1
Branches: main

compiler/mlds_to_il.m:
	Fix a bug with the handling of procedures declared as `:- external':
	make sure we generate "ret" instructions.  This bug broke all the
	test cases that called the generic unify or compare procedures,
	e.g. tests/general/disj_disj.m, in il* grades.

Workspace: /home/ceres/fjh/mercury
Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.119
diff -u -d -r1.119 mlds_to_il.m
--- compiler/mlds_to_il.m	23 Jul 2002 08:50:58 -0000	1.119
+++ compiler/mlds_to_il.m	17 Oct 2002 18:05:16 -0000
@@ -1010,7 +1010,14 @@
 		% Generate the code of the statement.
 	( 
 		{ MaybeStatement = defined_here(Statement) },
-		statement_to_il(Statement, InstrsTree1)
+		statement_to_il(Statement, InstrsTree1),
+			% Need to insert a ret for functions returning
+			% void (MLDS doesn't).
+		{ Returns = [] ->
+			MaybeRet = instr_node(ret)
+		;
+			MaybeRet = empty
+		}
 	; 
 		{ MaybeStatement = external },
 
@@ -1029,16 +1036,9 @@
 			node(LoadInstrs),
 			instr_node(call(get_static_methodref(ClassName,
 				MemberName, ILRetType, TypeParams)))
-			]) }
+			]) },
+		{ MaybeRet = instr_node(ret) }
 	),
-
-		% Need to insert a ret for functions returning
-		% void (MLDS doesn't).
-	{ Returns = [] ->
-		MaybeRet = instr_node(ret)
-	;
-		MaybeRet = empty
-	},
 
 		% Retrieve the locals, put them in the enclosing
 		% scope.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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