[MLton-commit] r4769

Matthew Fluet fluet at mlton.org
Tue Oct 24 14:53:42 PDT 2006


Move frequently used fields to the front of GC_state
----------------------------------------------------------------------

U   mlton/branches/on-20050822-x86_64-branch/doc/x86_64-port-notes/TODO
U   mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h

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

Modified: mlton/branches/on-20050822-x86_64-branch/doc/x86_64-port-notes/TODO
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/doc/x86_64-port-notes/TODO	2006-10-24 20:41:51 UTC (rev 4768)
+++ mlton/branches/on-20050822-x86_64-branch/doc/x86_64-port-notes/TODO	2006-10-24 21:53:12 UTC (rev 4769)
@@ -1,9 +1,4 @@
 
-* Why does hash-table use malloc/free while generational maps use mmap/munmap?
-
-* Use C99 <assert.h> instead of util/assert.{c,h}
-
-
 (* make-pdf stuff; not really x86_64 specific *)
 http://mlton.org/pipermail/mlton/2006-May/028840.html
  + http://mlton.org/pipermail/mlton/2006-June/028866.html
@@ -38,9 +33,6 @@
  + http://mlton.org/pipermail/mlton-user/2004-November/000556.html
  + http://mlton.org/pipermail/mlton/2004-November/026246.html
 
-(* Fields in GC_state *)
-http://mlton.org/pipermail/mlton/2006-July/028965.html
-
 (* Char signedness *)
 http://mlton.org/pipermail/mlton/2006-July/028970.html
  + http://mlton.org/pipermail/mlton/2006-July/028982.html
@@ -50,3 +42,8 @@
 
 Another minor thing I think we should do:
  * rename arch amd64 to x86_64, to be consistent with gcc target
+
+
+* Why does hash-table use malloc/free while generational maps use mmap/munmap?
+
+* Use C99 <assert.h> instead of util/assert.{c,h}

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	2006-10-24 20:41:51 UTC (rev 4768)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h	2006-10-24 21:53:12 UTC (rev 4769)
@@ -9,6 +9,16 @@
 #if (defined (MLTON_GC_INTERNAL_TYPES))
 
 struct GC_state {
+  /* These fields are at the front because they are the most commonly
+   * referenced, and having them at smaller offsets may decrease code
+   * size and improve cache performance.
+   */
+  pointer frontier; /* heap.start <= frontier < limit */
+  pointer limit; /* limit = heap.start + heap.size */
+  pointer stackTop; /* Top of stack in current thread. */
+  pointer stackLimit; /* stackBottom + stackSize - maxFrameSize */
+  uint32_t exnStack;
+  /* Alphabetized fields follow. */
   size_t alignment; /* */
   bool amInGC;
   bool amOriginal;
@@ -21,11 +31,9 @@
   struct GC_controls controls;
   struct GC_cumulativeStatistics cumulativeStatistics;
   objptr currentThread; /* Currently executing thread (in heap). */
-  uint32_t exnStack;
   struct GC_forwardState forwardState;
   GC_frameLayout frameLayouts; /* Array of frame layouts. */
   uint32_t frameLayoutsLength; /* Cardinality of frameLayouts array. */
-  pointer frontier; /* heap.start <= frontier < limit */
   struct GC_generationalMaps generationalMaps;
   objptr *globals;
   uint32_t globalsLength;
@@ -34,7 +42,6 @@
   struct GC_intInfInit *intInfInits;
   uint32_t intInfInitsLength;
   struct GC_lastMajorStatistics lastMajorStatistics;
-  pointer limit; /* limit = heap.start + heap.size */
   pointer limitPlusSlop; /* limit + GC_HEAP_LIMIT_SLOP */
   int (*loadGlobals)(FILE *f); /* loads the globals from the file. */
   uint32_t magic; /* The magic number for this executable. */
@@ -55,8 +62,6 @@
   struct GC_signalsInfo signalsInfo;
   struct GC_sourceMaps sourceMaps;
   pointer stackBottom; /* Bottom of stack in current thread. */
-  pointer stackLimit; /* stackBottom + stackSize - maxFrameSize */
-  pointer stackTop; /* Top of stack in current thread. */
   uintmax_t startTime; /* The time when GC_init or GC_loadWorld was called. */
   struct GC_sysvals sysvals;
   struct GC_vectorInit *vectorInits;




More information about the MLton-commit mailing list