[MLton-commit] r4094

Matthew Fluet MLton@mlton.org
Tue, 13 Sep 2005 19:50:37 -0700


Adopting the convention that the cardinality of an array is denoted by
a variable with name "zzzLength", while variables with name "zzzSize"
denote the size of the object in bytes.

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

U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.h
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.c

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

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.c	2005-09-14 02:43:18 UTC (rev 4093)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.c	2005-09-14 02:50:33 UTC (rev 4094)
@@ -20,7 +20,7 @@
  */
 static inline void foreachGlobalObjptr (GC_state s, 
                                         GC_foreachObjptrFun f) {
-  for (unsigned int i = 0; i < s->globalsSize; ++i) {
+  for (unsigned int i = 0; i < s->globalsLength; ++i) {
     if (DEBUG_DETAILED)
       fprintf (stderr, "foreachGlobal %u\n", i);
     maybeCall (f, s, &s->globals [i]);
@@ -154,7 +154,7 @@
       }
       frameLayout = getFrameLayoutFromReturnAddress (s, returnAddress);
       frameOffsets = frameLayout->offsets;
-      top -= frameLayout->numBytes;
+      top -= frameLayout->size;
       for (i = 0 ; i < frameOffsets[0] ; ++i) {
         if (DEBUG)
           fprintf(stderr, "  offset %"PRIx16"  address "FMTOBJPTR"\n",

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.c	2005-09-14 02:43:18 UTC (rev 4093)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.c	2005-09-14 02:50:33 UTC (rev 4094)
@@ -24,11 +24,11 @@
   if (DEBUG_DETAILED)
     fprintf (stderr, 
              "index = %"PRIx32
-             "  frameLayoutsSize = %"PRIu16"\n",
-            index, s->frameLayoutsSize);
-  assert (index < s->frameLayoutsSize);
+             "  frameLayoutsLength = %"PRIu32"\n",
+            index, s->frameLayoutsLength);
+  assert (index < s->frameLayoutsLength);
   layout = &(s->frameLayouts[index]);
-  assert (layout->numBytes > 0);
+  assert (layout->size > 0);
   return layout;
 }
 

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.h	2005-09-14 02:43:18 UTC (rev 4093)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.h	2005-09-14 02:50:33 UTC (rev 4094)
@@ -19,17 +19,17 @@
  * isC field identified whether or not the frame is for a C
  * call. (Note: The ML stack is distinct from the system stack.  A C
  * call executes on the system stack.  The frame left on the ML stack
- * is just a marker.)  The numBytes field indicates the size of the
- * frame, including space for the return address.  The offsets field
- * points to an array (the zeroeth element recording the size of the
- * array) whose elements record byte offsets from the bottom of the
- * frame at which live heap pointers are located.
+ * is just a marker.)  The size field indicates the size of the frame,
+ * including space for the return address.  The offsets field points
+ * to an array (the zeroeth element recording the size of the array)
+ * whose elements record byte offsets from the bottom of the frame at
+ * which live heap pointers are located.
  */
 typedef uint16_t *GC_frameOffsets;
 
 typedef struct GC_frameLayout {
   bool isC;
-  uint16_t numBytes;
+  uint16_t size;
   GC_frameOffsets offsets;
 } GC_frameLayout;
 

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h	2005-09-14 02:43:18 UTC (rev 4093)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h	2005-09-14 02:50:33 UTC (rev 4094)
@@ -8,11 +8,11 @@
   struct GC_cumulativeStatistics cumulative;
   objptr currentThread; /* Currently executing thread (in heap). */
   GC_frameLayout *frameLayouts; /* Array of frame layouts. */
-  uint32_t frameLayoutsSize; /* Cardinality of frameLayouts array. */
+  uint32_t frameLayoutsLength; /* Cardinality of frameLayouts array. */
   pointer frontier; /* heap.start <= frontier < limit */
   struct GC_generationalMaps generational;
   objptr *globals;
-  uint32_t globalsSize;
+  uint32_t globalsLength;
   struct GC_heap heap;
   struct GC_lastMajorStatistics lastMajor;
   pointer limit; /* limit = heap.start + heap.totalBytes */
@@ -20,7 +20,7 @@
   uint32_t maxFrameSize;
   /*Bool*/bool mutatorMarksCards;
   GC_objectType *objectTypes; /* Array of object types. */
-  uint32_t objectTypesSize; /* Cardinality of objectTypes array. */
+  uint32_t objectTypesLength; /* Cardinality of objectTypes array. */
   size_t pageSize;
   uint32_t (*returnAddressToFrameIndex) (GC_returnAddress ra);
   objptr savedThread; /* Result of GC_copyCurrentThread.

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c	2005-09-14 02:43:18 UTC (rev 4093)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c	2005-09-14 02:50:33 UTC (rev 4094)
@@ -13,14 +13,14 @@
     fprintf (stderr, "invariant\n");
   // assert (ratiosOk (s));
   /* Frame layouts */
-  for (unsigned int i = 0; i < s->frameLayoutsSize; ++i) {
+  for (unsigned int i = 0; i < s->frameLayoutsLength; ++i) {
     GC_frameLayout *layout;
     
     layout = &(s->frameLayouts[i]);
-    if (layout->numBytes > 0) {
+    if (layout->size > 0) {
       GC_frameOffsets offsets;
       
-      assert (layout->numBytes <= s->maxFrameSize);
+      assert (layout->size <= s->maxFrameSize);
       offsets = layout->offsets;
       /* No longer correct, since handler frames have a "size"
        * (i.e. return address) pointing into the middle of the frame.

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c	2005-09-14 02:43:18 UTC (rev 4093)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c	2005-09-14 02:50:33 UTC (rev 4094)
@@ -46,7 +46,7 @@
 
   assert (1 == (header & GC_VALID_HEADER_MASK)); 
   objectTypeIndex = (header & TYPE_INDEX_MASK) >> TYPE_INDEX_SHIFT; 
-  assert (objectTypeIndex < s->objectTypesSize); 
+  assert (objectTypeIndex < s->objectTypesLength); 
   objectType = &s->objectTypes [objectTypeIndex]; 
   tag = objectType->tag; 
   hasIdentity = objectType->hasIdentity; 

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.c	2005-09-14 02:43:18 UTC (rev 4093)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.c	2005-09-14 02:50:33 UTC (rev 4094)
@@ -67,7 +67,7 @@
   
   assert (not (stackIsEmpty (stack)));
   layout = topFrameLayout (s, stack);
-  return layout->numBytes;
+  return layout->size;
 }
 
 static inline size_t stackReserved (GC_state s, size_t r) {