[m-rev.] diff: dotnet: fix bug with unify/2
Fergus Henderson
fjh at cs.mu.OZ.AU
Mon Jun 18 19:17:42 AEST 2001
Estimated hours taken: 3
Branches: main
compiler/mlds_to_il.m:
Fix a bug that broke unify/2 in IL grades:
handle semidet `:- external' routines.
XXX `:- external' functions are still not supported.
Index: mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.32
diff -u -d -u -r1.32 mlds_to_il.m
--- mlds_to_il.m 2001/06/14 22:36:16 1.32
+++ mlds_to_il.m 2001/06/18 09:16:39
@@ -316,7 +316,7 @@
% Generate the code of the statement.
( { MaybeStatement = yes(Statement) } ->
- statement_to_il(Statement, InstrsTree0)
+ statement_to_il(Statement, InstrsTree1)
;
% If there is no function body,
% generate forwarding code instead.
@@ -325,7 +325,21 @@
InstrsTree0),
% The code might reference locals...
il_info_add_locals(["succeeded" -
- mlds__native_bool_type])
+ mlds__native_bool_type]),
+ ( { Returns = [_] } ->
+ % XXX Bug!
+ % We assume that if there is a return value,
+ % then it must be a semidet procedure, so
+ % we return `succeeded'.
+ % This is wrong for functions!
+ { InstrsTree1 = tree__list([
+ InstrsTree0,
+ instr_node(ldloc(name("succeeded"))),
+ instr_node(ret)
+ ]) }
+ ;
+ { InstrsTree1 = InstrsTree0 }
+ )
),
% If this is main, add the entrypoint, set a
@@ -357,7 +371,7 @@
{ InstrsTree = tree__list([
context_node(Context),
instr_node(start_block(scope(Locals), BlockId)),
- InstrsTree0,
+ InstrsTree1,
MaybeRet,
instr_node(end_block(scope(Locals), BlockId))
])
--
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