[m-rev.] diff: minor hlc.agc fixes

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jan 7 03:49:30 AEDT 2004


Estimated hours taken: 1
Branches: main

Bug fixes for grade hlc.agc.

runtime/mercury_agc_debug.c:
	Fix compilation errors in grade hlc.agc:
	ensure that code which is specific to the LLDS back-end is
	wrapped inside #ifndef MR_HIGHLEVEL_CODE.
	Delete nested occurrences of "#ifdef MR_NATIVE_GC":
	they are not needed, since the whole of this file is already
	wrapped in that.

runtime/mercury_accurate_gc.c:
	Fix compilation warnings in grade hlc.agc:
	add a missing prototype and delete an unnecessary incorrect cast.

Workspace: /home/jupiter/fjh/ws-jupiter/mercury
Index: runtime/mercury_accurate_gc.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_accurate_gc.c,v
retrieving revision 1.36
diff -u -d -r1.36 mercury_accurate_gc.c
--- runtime/mercury_accurate_gc.c	30 Dec 2003 13:20:37 -0000	1.36
+++ runtime/mercury_accurate_gc.c	6 Jan 2004 16:43:13 -0000
@@ -56,6 +56,8 @@
 
   void          MR_garbage_collect(void);
   static void   traverse_stack(struct MR_StackChain *top);
+  static void   resize_and_reset_gc_threshold(MR_MemoryZone *old_heap,
+                    MR_MemoryZone *new_heap);
 
 #else /* !MR_HIGHLEVEL_CODE */
 
@@ -229,8 +231,7 @@
     if (gc_heap_size < old_heap_space) {
         gc_heap_size = old_heap_space;
     }
-    old_heap->gc_threshold = (MR_Word *)
-            ((char *) old_heap->bottom + gc_heap_size);
+    old_heap->gc_threshold = ((char *) old_heap->bottom + gc_heap_size);
 }
 
 /*---------------------------------------------------------------------------*/
Index: runtime/mercury_agc_debug.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_agc_debug.c,v
retrieving revision 1.24
diff -u -d -r1.24 mercury_agc_debug.c
--- runtime/mercury_agc_debug.c	30 Dec 2003 09:51:31 -0000	1.24
+++ runtime/mercury_agc_debug.c	6 Jan 2004 16:40:53 -0000
@@ -44,8 +44,9 @@
 void
 MR_agc_dump_roots(MR_RootList roots)
 {
-#ifdef MR_NATIVE_GC
+#ifndef MR_HIGHLEVEL_CODE
 	MR_Word	saved_regs[MR_MAX_FAKE_REG];
+#endif
 
 	fflush(NULL);
 	fprintf(stderr, "Dumping roots\n");
@@ -54,6 +55,7 @@
 		while (roots != NULL) {
 
 
+#ifndef MR_HIGHLEVEL_CODE
 			/*
 			** Restore the registers, because we need to save them
 			** to a more permanent backing store (we are going to
@@ -66,21 +68,24 @@
 
 			MR_hp = MR_ENGINE(MR_eng_debug_heap_zone->min);
 			MR_virtual_hp = MR_ENGINE(MR_eng_debug_heap_zone->min);
+#endif /* !MR_HIGHLEVEL_CODE */
 
 			fflush(NULL);
 			MR_write_variable(roots->type_info, *roots->root);
 			fflush(NULL);
 			fprintf(stderr, "\n");
 
+#ifndef MR_HIGHLEVEL_CODE
 			MR_copy_saved_regs_to_regs(MR_MAX_FAKE_REG - 1,
 				saved_regs);
 			MR_save_registers();
+#endif /* !MR_HIGHLEVEL_CODE */
 			roots = roots->next;
 		}
 	}
-#endif /* MR_NATIVE_GC */
 }
 
+#ifndef MR_HIGHLEVEL_CODE
 void
 MR_agc_dump_nondet_stack_frames(MR_Internal *label, MR_MemoryZone *heap_zone,
 	MR_Word *stack_pointer, MR_Word *current_frame, MR_Word *max_frame)
@@ -177,7 +182,6 @@
 MR_agc_dump_stack_frames(MR_Internal *label, MR_MemoryZone *heap_zone,
 	MR_Word *stack_pointer, MR_Word *current_frame)
 {
-#ifdef MR_NATIVE_GC
 	MR_Word			saved_regs[MR_MAX_FAKE_REG];
 	int			i, short_var_count, long_var_count;
 	MR_Word			*type_params;
@@ -238,7 +242,6 @@
 			entry_layout = layout->MR_sll_entry;
 		}
 	}
-#endif /* MR_NATIVE_GC */
 }
 
 static void
@@ -346,7 +349,6 @@
 dump_long_value(MR_Long_Lval locn, MR_MemoryZone *heap_zone,
 	MR_Word *stack_pointer, MR_Word *current_frame, MR_bool do_regs)
 {
-#ifdef MR_NATIVE_GC
 	int	locn_num;
 	MR_Word	value = 0;
 	int	difference;
@@ -425,14 +427,12 @@
 			fprintf(stderr, "\t       \t(%lx)", (long) value);
 		}
 	}
-#endif /* MR_NATIVE_GC */
 }
 
 static void
 dump_short_value(MR_Short_Lval locn, MR_MemoryZone *heap_zone,
 	MR_Word *stack_pointer, MR_Word *current_frame, MR_bool do_regs)
 {
-#ifdef MR_NATIVE_GC
 	int	locn_num;
 	MR_Word	value = 0;
 	int	difference;
@@ -499,7 +499,8 @@
 			fprintf(stderr, "\t       \t(%lx)", (long) value);
 		}
 	}
-#endif /* MR_NATIVE_GC */
 }
+
+#endif /* !MR_HIGHLEVEL_CODE */
 
 #endif /* MR_NATIVE_GC */

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