[MLton-commit] r4683

Stephen Weeks MLton@mlton.org
Mon, 17 Jul 2006 10:27:14 -0700


Fixed several "cast increases required alignment" warnings that were
showing up on Solaris.

----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h

----------------------------------------------------------------------

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c	2006-07-13 21:31:51 UTC (rev 4682)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c	2006-07-17 17:27:13 UTC (rev 4683)
@@ -153,7 +153,7 @@
   s->generationalMaps.cardMap = 
     GC_mmapAnon_safe (NULL, totalMapSize);
   s->generationalMaps.crossMap = 
-    (GC_crossMapElem*)((pointer)s->generationalMaps.cardMap + cardMapSize);
+    (s->generationalMaps.cardMap + (cardMapSize / CARD_MAP_ELEM_SIZE));
   if (DEBUG_CARD_MARKING)
     fprintf (stderr, "cardMap = "FMTPTR"  crossMap = "FMTPTR"\n",
              (uintptr_t)s->generationalMaps.cardMap,
@@ -167,9 +167,9 @@
   if (s->mutatorMarksCards
       and (s->generationalMaps.cardMapLength * CARD_MAP_ELEM_SIZE)
           != align (sizeToCardMapIndex (s->heap.size), s->sysvals.pageSize)) {
-    GC_cardMapElem *oldCardMap;
+    GC_cardMap oldCardMap;
     size_t oldCardMapSize;
-    GC_crossMapElem *oldCrossMap;
+    GC_crossMap oldCrossMap;
     size_t oldCrossMapSize;
     
     oldCardMap = s->generationalMaps.cardMap;

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h	2006-07-13 21:31:51 UTC (rev 4682)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h	2006-07-17 17:27:13 UTC (rev 4683)
@@ -14,6 +14,12 @@
 
 typedef uint8_t GC_cardMapElem;
 typedef uint8_t GC_crossMapElem;
+
+typedef uint8_t GC_cardMapStart __attribute__ ((aligned (4)));
+typedef uint8_t GC_crossMapStart __attribute__ ((aligned (4)));
+typedef GC_cardMapStart *GC_cardMap;
+typedef GC_crossMapStart *GC_crossMap;
+
 typedef size_t GC_cardMapIndex;
 typedef size_t GC_crossMapIndex;
 #define CARD_MAP_ELEM_SIZE sizeof(GC_cardMapElem)
@@ -31,8 +37,8 @@
    * written since the last minor GC; hence, the corresponding card
    * must be traced at the next minor GC.
    */
-  GC_cardMapElem *cardMap;
-  GC_cardMapElem *cardMapAbsolute;
+  GC_cardMap cardMap;
+  GC_cardMap cardMapAbsolute;
   GC_cardMapIndex cardMapLength;
   /* crossMap is an array with cardinality equal to the size of the
    * heap divided by card size.  Each element in the array is
@@ -40,7 +46,7 @@
    * the offset indicates the start of the last object in the
    * corresponding card from the start of the card.
    */
-  GC_crossMapElem *crossMap;
+  GC_crossMap crossMap;
   GC_crossMapIndex crossMapLength;
   /* crossMapValidSize the size of the prefix of the old generation
    * for which the crossMap is valid.