[m-rev.] diff: fix hlc.agc runtime

Julien Fischer juliensf at cs.mu.OZ.AU
Sat Sep 17 00:47:12 AEST 2005


Estimated hours taken: 0.5
Branches: main

Fix the compilation of the runtime in hlc.agc.

XXX This grade is broken on the main branch.

library/private_builtin.m:
runtime/mercury.h:
runtime/mercury_accurate_gc.c:
	Conform to the new field names of the zone structure.

Julien.

Index: library/private_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.141
diff -u -r1.141 private_builtin.m
--- library/private_builtin.m	13 Sep 2005 04:56:20 -0000	1.141
+++ library/private_builtin.m	16 Sep 2005 14:19:20 -0000
@@ -1003,8 +1003,8 @@
 #ifdef MR_NATIVE_GC
     *(MR_Word *)Pointer =
         MR_agc_deep_copy(* (MR_Word *) Pointer, (MR_TypeInfo) TypeInfo_for_T,
-            MR_ENGINE(MR_eng_heap_zone2->min),
-            MR_ENGINE(MR_eng_heap_zone2->hardmax));
+            MR_ENGINE(MR_eng_heap_zone2->MR_zone_min),
+            MR_ENGINE(MR_eng_heap_zone2->MR_zone_hardmax));
 #else
     MR_fatal_error(""private_builtin__gc_trace/2: ""
         ""called when accurate GC not enabled"");
Index: runtime/mercury.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury.h,v
retrieving revision 1.69
diff -u -r1.69 mercury.h
--- runtime/mercury.h	15 Dec 2004 06:57:49 -0000	1.69
+++ runtime/mercury.h	16 Sep 2005 14:11:33 -0000
@@ -294,7 +294,7 @@
 #define MR_GC_check()							\
 	do {								\
 		if ((char *) MR_hp >=					\
-		    MR_ENGINE(MR_eng_heap_zone)->gc_threshold)		\
+		    MR_ENGINE(MR_eng_heap_zone)->MR_zone_gc_threshold)	\
 		{							\
 			MR_save_registers();				\
 			MR_garbage_collect();				\
Index: runtime/mercury_accurate_gc.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_accurate_gc.c,v
retrieving revision 1.38
diff -u -r1.38 mercury_accurate_gc.c
--- runtime/mercury_accurate_gc.c	7 Jul 2004 07:11:08 -0000	1.38
+++ runtime/mercury_accurate_gc.c	16 Sep 2005 13:52:26 -0000
@@ -161,7 +161,7 @@
     ** The new heap pointer starts at the bottom of the new heap.
     */
     swap_heaps();
-    MR_virtual_hp = new_heap->min;
+    MR_virtual_hp = new_heap->MR_zone_min;

     /*
     ** Copy any roots on the stack
@@ -213,11 +213,13 @@
 static void
 resize_and_reset_gc_threshold(MR_MemoryZone *old_heap, MR_MemoryZone *new_heap)
 {
-    /* These counts include some wasted space between ->min and ->bottom. */
+    /* These counts include some wasted space between
+    ** ->MR_zone_min and ->MR_zone_bottom.
+    */
     size_t old_heap_space =
-        (char *) old_heap->gc_threshold - (char *) old_heap->bottom;
+        (char *) old_heap->MR_zone_gc_threshold - (char *) old_heap->MR_zone_bottom;
     size_t new_heap_usage =
-        (char *) MR_virtual_hp - (char *) new_heap->bottom;
+        (char *) MR_virtual_hp - (char *) new_heap->MR_zone_bottom;
     size_t gc_heap_size;

     /*
@@ -231,7 +233,8 @@
     if (gc_heap_size < old_heap_space) {
         gc_heap_size = old_heap_space;
     }
-    old_heap->gc_threshold = ((char *) old_heap->bottom + gc_heap_size);
+    old_heap->MR_zone_gc_threshold =
+        ((char *) old_heap->MR_zone_bottom + gc_heap_size);
 }

 /*---------------------------------------------------------------------------*/
@@ -919,9 +922,9 @@
         fprintf(stderr, "\nGarbage collection started.\n");

         fprintf(stderr, "old_heap->min:  %lx \t old_heap->hardmax:  %lx\n",
-            (long) old_heap->min, (long) old_heap->hardmax);
+            (long) old_heap->MR_zone_min, (long) old_heap->MR_zone_hardmax);
         fprintf(stderr, "new_heap->min: %lx \t new_heap->hardmax: %lx\n",
-            (long) new_heap->min, (long) new_heap->hardmax);
+            (long) new_heap->MR_zone_min, (long) new_heap->MR_zone_hardmax);

         fprintf(stderr, "MR_virtual_hp:  %lx\n", (long) MR_virtual_hp);
     }
@@ -948,11 +951,11 @@
         fprintf(stderr, "MR_virtual_hp: %lx\n", (long) MR_virtual_hp);

         fprintf(stderr, "old heap: %ld bytes, new heap: %ld bytes\n",
-            (long) ((char *) old_hp - (char *) old_heap->min),
-            (long) ((char *) MR_virtual_hp - (char *) new_heap->min));
+            (long) ((char *) old_hp - (char *) old_heap->MR_zone_min),
+            (long) ((char *) MR_virtual_hp - (char *) new_heap->MR_zone_min));
         fprintf(stderr, "%ld bytes recovered\n",
-            (long) ((char *) old_hp - (char *) old_heap->min) -
-            ((char *) MR_virtual_hp - (char *) new_heap->min));
+            (long) ((char *) old_hp - (char *) old_heap->MR_zone_min) -
+            ((char *) MR_virtual_hp - (char *) new_heap->MR_zone_min));

         fprintf(stderr, "Garbage collection done.\n\n");
     }
@@ -970,7 +973,7 @@
     size_t              num_bytes_for_bitmap;
     static size_t       prev_num_bytes_for_bitmap;

-    heap_size_in_words = old_hp - old_heap->min;
+    heap_size_in_words = old_hp - old_heap->MR_zone_min;
     num_words_for_bitmap = (heap_size_in_words + MR_WORDBITS - 1) / MR_WORDBITS;
     num_bytes_for_bitmap = num_words_for_bitmap * sizeof(MR_Word);
     if (MR_has_forwarding_pointer == NULL
@@ -1015,8 +1018,8 @@

     while (current != NULL) {
         *current->root = MR_agc_deep_copy(*current->root, current->type_info,
-            MR_ENGINE(MR_eng_heap_zone2->min),
-            MR_ENGINE(MR_eng_heap_zone2->hardmax));
+            MR_ENGINE(MR_eng_heap_zone2->MR_zone_min),
+            MR_ENGINE(MR_eng_heap_zone2->MR_zone_hardmax));
         current = current->next;
     }
 }
@@ -1032,7 +1035,7 @@

     if (MR_agc_debug) {
         fprintf(stderr, "Clearing old heap:\n");
-        for (tmp_hp = old_heap->min; tmp_hp <= old_hp; tmp_hp++) {
+        for (tmp_hp = old_heap->MR_zone_min; tmp_hp <= old_hp; tmp_hp++) {
             *tmp_hp = 0xDEADBEAF;
         }
     }

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