[m-rev.] diff: fix for ho_solns test case

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Feb 19 02:08:54 AEDT 2003


I tracked down what was causing that ho_solns test case to go
into an infinite loop in hlc.agc grade.  The problem was that
it was trying to do heap reclamation on failure.
Damn, I knew about the need for this fix ages ago,
but I forgot to get around to implementing and committing it.
My punishment for that was a couple of hours of tedious debugging :-(

----------

Estimated hours taken: 2
Branches: main

Fix a bug that broke tests/hard_coded/ho_soln in grade hlc.agc.

compiler/handle_options.m:
	If accurate GC is enabled, disable heap reclamation on failure.
	This is needed because accurate GC currently doesn't support
	heap reclamation on failure.

Workspace: /home/ceres/fjh/mercury
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.172
diff -u -d -r1.172 handle_options.m
--- compiler/handle_options.m	13 Feb 2003 00:24:38 -0000	1.172
+++ compiler/handle_options.m	18 Feb 2003 14:59:26 -0000
@@ -822,6 +822,21 @@
 	% For the MLDS back-end, `--gc accurate' requires just typeinfo
 	% liveness.
 	%
+	% XXX Currently we also need to disable heap reclamation on failure
+	% if accurate GC is enabled.
+	% There are two issues with heap reclamation on failure:
+	% (i) For heap reclamation on failure to work at all,
+	%      we also need at least some degree of liveness-accuracy.
+	%      Otherwise a local variable may get initialized to point
+	%      to the heap, then the heap is reset, then the memory
+	%      is overwritten with new allocations, and then a collection
+	%      occurs, at which point the local variable now points to
+	%      a value of the wrong type.
+	% (ii) The current method of handling saved heap pointers during GC
+	%      means that we lose heap reclamation on failure after a
+	%      GC occurs. A better method would be to just allocate a
+	%      word of heap space at each choice point.
+	%
 	% XXX currently accurate GC also requires disabling the higher-order
 	% specialization pass, since that pass creates procedures
 	% which don't respect left-to-right scoping of type_info parameters,
@@ -834,6 +849,10 @@
 		globals__io_set_option(body_typeinfo_liveness, bool(yes)),
 		globals__io_set_option(allow_hijacks, bool(no)),
 		globals__io_set_option(optimize_frames, bool(no)),
+		globals__io_set_option(
+			reclaim_heap_on_semidet_failure, bool(no)),
+		globals__io_set_option(
+			reclaim_heap_on_nondet_failure, bool(no)),
 		globals__io_set_option(optimize_higher_order, bool(no))
 	;
 		[]

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