[MLton-commit] r4063

Matthew Fluet MLton@mlton.org
Sun, 4 Sep 2005 04:56:32 -0700


Better mnemonics for model.
----------------------------------------------------------------------

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

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

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/model.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/model.c	2005-09-04 11:44:16 UTC (rev 4062)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/model.c	2005-09-04 11:56:31 UTC (rev 4063)
@@ -10,13 +10,13 @@
   intptr_t B_;
   pointer P;
 
-  if GC_MODEL_B {
+  if GC_MODEL_USEBASE {
     B_ = (intptr_t)B;
   } else {
     B_ = 0;
   }
 
-  P = (pointer)((O_ << GC_MODEL_S) + B_);
+  P = (pointer)((O_ << GC_MODEL_SHIFT) + B_);
   if (DEBUG_DETAILED) 
     fprintf (stderr, "objptrToPointer ("FMTOBJPTR") = "FMTPTR"\n", O, (intptr_t)P);
   
@@ -28,13 +28,13 @@
   intptr_t B_;
   objptr O;
 
-  if GC_MODEL_B {
+  if GC_MODEL_USEBASE {
     B_ = (intptr_t)B;
   } else {
     B_ = 0;
   }
 
-  O = (objptr)((P_ - B_) >> GC_MODEL_S);
+  O = (objptr)((P_ - B_) >> GC_MODEL_SHIFT);
   if (DEBUG_DETAILED) 
     fprintf (stderr, "pointerToObjptr ("FMTPTR") = "FMTOBJPTR"\n", (intptr_t)P, O);
 

Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/model.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/model.h	2005-09-04 11:44:16 UTC (rev 4062)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/model.h	2005-09-04 11:56:31 UTC (rev 4063)
@@ -135,16 +135,46 @@
 manageable set for users.
 */
 
-#define GC_MODEL_Z  32
-#define GC_MODEL_S  1
-#define GC_MODEL_B  TRUE
+#define GC_MODEL_G
 
+#if (defined (GC_MODEL_A))
+#define GC_MODEL_BITSIZE  32
+#define GC_MODEL_SHIFT  0
+#define GC_MODEL_USEBASE  FALSE
+#elif (defined (GC_MODEL_AX))
+#define GC_MODEL_BITSIZE  32
+#define GC_MODEL_SHIFT  0
+#define GC_MODEL_USEBASE  TRUE
+#elif (defined (GC_MODEL_B))
+#define GC_MODEL_BITSIZE  32
+#define GC_MODEL_SHIFT  1
+#define GC_MODEL_USEBASE  FALSE
+#elif (defined (GC_MODEL_BX))
+#define GC_MODEL_BITSIZE  32
+#define GC_MODEL_SHIFT  1
+#define GC_MODEL_USEBASE  TRUE
+#elif (defined (GC_MODEL_C))
+#define GC_MODEL_BITSIZE  32
+#define GC_MODEL_SHIFT  2
+#define GC_MODEL_USEBASE  FALSE
+#elif (defined (GC_MODEL_CX))
+#define GC_MODEL_BITSIZE  32
+#define GC_MODEL_SHIFT  2
+#define GC_MODEL_USEBASE  TRUE
+#elif (defined (GC_MODEL_G))
+#define GC_MODEL_BITSIZE  64
+#define GC_MODEL_SHIFT  0
+#define GC_MODEL_USEBASE  FALSE
+#else 
+#error gc model undefined
+#endif
+
 #define OBJPTR_TYPE__(z) uint ## z ## _t
 #define OBJPTR_TYPE_(z) OBJPTR_TYPE__(z)
-#define OBJPTR_TYPE OBJPTR_TYPE_(GC_MODEL_Z)
+#define OBJPTR_TYPE OBJPTR_TYPE_(GC_MODEL_BITSIZE)
 typedef OBJPTR_TYPE objptr;
 #define OBJPTR_SIZE sizeof(objptr)
 #define PRIxOBJPTR__(z) PRIx ## z
 #define PRIxOBJPTR_(z) PRIxOBJPTR__(z)
-#define PRIxOBJPTR PRIxOBJPTR_(GC_MODEL_Z)
+#define PRIxOBJPTR PRIxOBJPTR_(GC_MODEL_BITSIZE)
 #define FMTOBJPTR "0x%016"PRIxOBJPTR