[m-rev.] diff: fix Solaris bus error for *.memprof grades

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Feb 22 10:51:09 AEDT 2002


Estimated hours taken: 2
Branches: main

runtime/mercury_prof_mem.h:
runtime/mercury_prof_mem.c:
	Align memory allocated with MR_prof_malloc() to
	double-word boundaries, rather than word boundaries.
	This is needed to avoid bus errors on Solaris,
	now that we use `long long' for MR_Dword.

Workspace: /tmp/fjh/mercury
Index: runtime/mercury_prof_mem.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_prof_mem.c,v
retrieving revision 1.9
diff -u -d -r1.9 mercury_prof_mem.c
--- runtime/mercury_prof_mem.c	2000/09/21 05:01:08	1.9
+++ runtime/mercury_prof_mem.c	2002/02/21 22:15:22
@@ -28,7 +28,7 @@
 #include "mercury_prof_mem.h"
 
 #include "mercury_memory.h"	/* for MR_GC_malloc() */
-#include "mercury_types.h"	/* for MR_Word */
+#include "mercury_dword.h"	/* for MR_Dword */
 
 /*----------------------------------------------------------------------------*/
 
@@ -66,12 +66,13 @@
 	** up to the nearest multiple of the word size.
 	**
 	** Note that the current implementation of MR_prof_malloc only
-	** guarantees that the memory will be MR_Word-aligned; if you want to
+	** guarantees that the memory will be MR_Dword-aligned; if you want to
 	** allocate types that contain data types (e.g. `double') which might
 	** require stricter alignment than that, then you will need to
 	** change this to round the size up accordingly.
 	*/
-	size = ((size + sizeof(MR_Word) - 1) / sizeof(MR_Word)) * sizeof(MR_Word);
+	size = ((size + sizeof(MR_Dword) - 1) / sizeof(MR_Dword))
+		* sizeof(MR_Dword);
 
 	/* Here we waste a bit of space but hopefully not to much */
 	if (mem_left < size) {
Index: runtime/mercury_prof_mem.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_prof_mem.h,v
retrieving revision 1.7
diff -u -d -r1.7 mercury_prof_mem.h
--- runtime/mercury_prof_mem.h	2000/09/21 05:01:08	1.7
+++ runtime/mercury_prof_mem.h	2002/02/21 23:44:59
@@ -30,7 +30,7 @@
 ** calls malloc(), which is not guaranteed to be re-entrant.)
 **
 ** Note that the current implementation of MR_prof_malloc only guarantees
-** that the memory will be MR_Word-aligned; if you want to allocate types
+** that the memory will be MR_Dword-aligned; if you want to allocate types
 ** that contain data types (e.g. `double') which might require stricter
 ** alignment than that, then you will need to change the implementation of
 ** MR_prof_malloc().

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list