[m-rev.] diff: AGC debug fixes

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Oct 22 21:05:39 AEST 2003


Estimated hours taken: 2
Branches: main

More bug fixes for accurate GC in LLDS grades:

runtime/mercury_agc_debug.c:
	- Fix an off-by-one error with the use of MR_copy_regs_to_saved_regs().
	- Don't call MR_print_proc_id() if it would abort.
	- Use MR_free() rather than free() to deallocate the return value from
	  MR_materialize_type_params_base().

Workspace: /home/ceres/fjh/mercury
Index: runtime/mercury_agc_debug.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_agc_debug.c,v
retrieving revision 1.21
diff -u -d -r1.21 mercury_agc_debug.c
--- runtime/mercury_agc_debug.c	19 Aug 2002 06:42:08 -0000	1.21
+++ runtime/mercury_agc_debug.c	22 Oct 2003 09:46:01 -0000
@@ -51,7 +51,7 @@
 		** the saved registers).
 		*/
 		MR_restore_registers();
-		MR_copy_regs_to_saved_regs(MR_MAX_FAKE_REG, saved_regs);
+		MR_copy_regs_to_saved_regs(MR_MAX_FAKE_REG - 1, saved_regs);
 
 		MR_hp = MR_ENGINE(debug_heap_zone->min);
 		MR_virtual_hp = MR_ENGINE(debug_heap_zone->min);
@@ -61,7 +61,7 @@
 		fflush(NULL);
 		fprintf(stderr, "\n");
 
-		MR_copy_saved_regs_to_regs(MR_MAX_FAKE_REG, saved_regs);
+		MR_copy_saved_regs_to_regs(MR_MAX_FAKE_REG - 1, saved_regs);
 		MR_save_registers();
 		roots = roots->next;
 	}
@@ -250,7 +250,7 @@
 	** not live yet for any call except the top one.
 	*/
 	MR_restore_registers();
-	MR_copy_regs_to_saved_regs(MR_MAX_FAKE_REG, saved_regs);
+	MR_copy_regs_to_saved_regs(MR_MAX_FAKE_REG - 1, saved_regs);
 	if (top_frame) {
 		current_regs = saved_regs;
 	} else {
@@ -261,7 +261,9 @@
 
 	for (i = 0; i < long_var_count; i++) {
 		fprintf(stderr, "%-12s\t", "");
-		MR_print_proc_id(stderr, label_layout->MR_sll_entry);
+		if (MR_PROC_LAYOUT_HAS_PROC_ID(label_layout->MR_sll_entry)) {
+			MR_print_proc_id(stderr, label_layout->MR_sll_entry);
+		}
 
 		dump_long_value(MR_long_desc_var_locn(label_layout, i),
 			heap_zone, stack_pointer, current_frame, top_frame);
@@ -292,7 +294,9 @@
 
 	for (; i < short_var_count; i++) {
 		fprintf(stderr, "%-12s\t", "");
-		MR_print_proc_id(stderr, label_layout->MR_sll_entry);
+		if (MR_PROC_LAYOUT_HAS_PROC_ID(label_layout->MR_sll_entry)) {
+			MR_print_proc_id(stderr, label_layout->MR_sll_entry);
+		}
 
 		dump_short_value(MR_short_desc_var_locn(label_layout, i),
 			heap_zone, stack_pointer, current_frame, top_frame);
@@ -322,9 +326,9 @@
 	}
 
 
-	MR_copy_saved_regs_to_regs(MR_MAX_FAKE_REG, saved_regs);
+	MR_copy_saved_regs_to_regs(MR_MAX_FAKE_REG - 1, saved_regs);
 	MR_save_registers();
-	free(type_params);
+	MR_free(type_params);
 }
 
 static void

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