[m-dev.] tests/hard_coded/ho_solns.m
Fergus Henderson
fjh at cs.mu.oz.au
Sun Feb 16 23:48:14 AEDT 1997
I wrote:
> Hi Tyson,
>
> tests/hard_coded/ho_solns.m breaks in grade `fast';
> it gets a seg fault in deep_copy().
>
> Can you please investigate this?
It's OK, I've found and fixed this one. The problem was that you
forgot the calls to save/restore_transient_regs() around the second
call to deep_copy().
library/std_util.m:
Make sure that we save/restore_transient_regs() before/after
both calls to deep_copy().
Index: std_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/std_util.m,v
retrieving revision 1.70
diff -u -r1.70 std_util.m
--- std_util.m 1997/02/13 16:41:15 1.70
+++ std_util.m 1997/02/16 12:44:35
@@ -325,14 +325,14 @@
/* set heap to solutions heap */
hp = (Word) solutions_heap_pointer;
- /* to be safe, save the registers before the call */
+ /*
+ ** deep_copy() it to the solutions heap, up to the saved_hp.
+ ** Note that we need to save/restore the hp register, if it
+ ** is transient, before/after calling deep_copy().
+ */
save_transient_registers();
-
- /* deep copy it to the solutions heap, up to the saved_hp */
r3 = deep_copy(r1, (Word *) type_info_fv, (Word *) saved_hp_fv,
heap_zone->top);
-
- /* restore the registers */
restore_transient_registers();
/* create a cons cell on the solutions heap */
@@ -364,12 +364,17 @@
&mercury_data_mercury_builtin__base_type_info_list_1;
new_type_info[1] = (Word *) type_info_fv;
- /* deep_copy the list to the mercury heap, copying
- * everything between where we started on the solutions
- * heap, and the top of the solutions heap
- */
+ /*
+ ** deep_copy() the list to the mercury heap, copying
+ ** everything between where we started on the solutions
+ ** heap, and the top of the solutions heap.
+ ** Note that we need to save/restore the hp register, if it
+ ** is transient, before/after calling deep_copy().
+ */
+ save_transient_registers();
solutions_output = deep_copy(list_fv, (Word *) new_type_info,
(Word *) saved_solhp_fv, solutions_heap_zone->top);
+ restore_transient_registers();
}
/* reset solutions heap to where it was before call to solutions */
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list