[MLton-commit] r5312
Matthew Fluet
fluet at mlton.org
Sun Feb 25 12:00:43 PST 2007
Use __attribute__ ((packed)) on structs that correspond to ML objects.
----------------------------------------------------------------------
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/string.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.h
----------------------------------------------------------------------
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.h 2007-02-25 19:54:43 UTC (rev 5311)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.h 2007-02-25 20:00:36 UTC (rev 5312)
@@ -22,14 +22,20 @@
} body;
pointerAux _p; /* alignment */
} obj;
-} *GC_intInf;
+} __attribute__ ((packed)) *GC_intInf;
COMPILE_TIME_ASSERT(GC_intInf__obj_packed,
- offsetof(struct GC_intInf, obj) == offsetof(struct GC_intInf, counter) + sizeof(GC_arrayCounter) + sizeof(GC_arrayLength) + sizeof(GC_header));
+ offsetof(struct GC_intInf, obj) ==
+ sizeof(GC_arrayCounter)
+ + sizeof(GC_arrayLength)
+ + sizeof(GC_header));
COMPILE_TIME_ASSERT(GC_intInf__obj_body_isneg_packed,
- offsetof(struct GC_intInf, obj.body.isneg) == offsetof(struct GC_intInf, obj));
-COMPILE_TIME_ASSERT(GC_intInf_obj_body_limbs_packed,
- offsetof(struct GC_intInf, obj.body.limbs) == offsetof(struct GC_intInf, obj) + sizeof(mp_limb_t));
+ offsetof(struct GC_intInf, obj.body.isneg) ==
+ offsetof(struct GC_intInf, obj));
+COMPILE_TIME_ASSERT(GC_intInf__obj_body_limbs_packed,
+ offsetof(struct GC_intInf, obj.body.limbs) ==
+ offsetof(struct GC_intInf, obj)
+ + sizeof(mp_limb_t));
#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/string.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/string.h 2007-02-25 19:54:43 UTC (rev 5311)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/string.h 2007-02-25 20:00:36 UTC (rev 5312)
@@ -21,12 +21,16 @@
} body;
pointerAux _p; /* alignment */
} obj;
-} *GC_string8;
+} __attribute__ ((packed)) *GC_string8;
COMPILE_TIME_ASSERT(GC_string8__obj_packed,
- offsetof(struct GC_string8, obj) == offsetof(struct GC_string8, counter) + sizeof(GC_arrayCounter) + sizeof(GC_arrayLength) + sizeof(GC_header));
+ offsetof(struct GC_string8, obj) ==
+ sizeof(GC_arrayCounter)
+ + sizeof(GC_arrayLength)
+ + sizeof(GC_header));
COMPILE_TIME_ASSERT(GC_string8__obj_body_chars_packed,
- offsetof(struct GC_string8, obj.body.chars) == offsetof(struct GC_string8, obj));
+ offsetof(struct GC_string8, obj.body.chars) ==
+ offsetof(struct GC_string8, obj));
#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.h 2007-02-25 19:54:43 UTC (rev 5311)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.h 2007-02-25 20:00:36 UTC (rev 5312)
@@ -20,8 +20,14 @@
* where the top of the exnStack is.
*/
objptr stack; /* The stack for this thread. */
-} *GC_thread;
+} __attribute__ ((packed)) *GC_thread;
+COMPILE_TIME_ASSERT(GC_thread__packed,
+ sizeof(struct GC_thread) ==
+ sizeof(size_t)
+ + sizeof(uint32_t)
+ + sizeof(objptr));
+
#define BOGUS_EXN_STACK 0xFFFFFFFF
#else
More information about the MLton-commit
mailing list