summaryrefslogtreecommitdiff
path: root/rts/sm
diff options
context:
space:
mode:
authorSimon Marlow <simonmar@microsoft.com>2007-06-27 09:36:46 +0000
committerSimon Marlow <simonmar@microsoft.com>2007-06-27 09:36:46 +0000
commit73637ad66b7f88e57dcd0e0ea93b3d7bf8fb0d78 (patch)
treec62bf2ddcfd0f2ae16f43b301cfdf6208dab3c83 /rts/sm
parente1ddf51abb3a89392cc9da9a36b74f0d69f9a36b (diff)
downloadhaskell-73637ad66b7f88e57dcd0e0ea93b3d7bf8fb0d78.tar.gz
+RTS -xbXXXXX sets the "heap base" to 0xXXXXXX
When debugging the GC and storage manager we often want repeated runs of the program to allocate memory at the same addresses, so that we can set watch points. Unfortunately the OS doesn't always give us memory at predictable addresses. This flag gives the OS a hint as to where we would like our memory allocated. Previously I did this by changing the HEAP_BASE setting in MBlock.h and recompiling, this patch just adds a flag so I don't have to recompile.
Diffstat (limited to 'rts/sm')
-rw-r--r--rts/sm/MBlock.c13
-rw-r--r--rts/sm/MBlock.h17
-rw-r--r--rts/sm/Storage.c2
3 files changed, 15 insertions, 17 deletions
diff --git a/rts/sm/MBlock.c b/rts/sm/MBlock.c
index 85fe02da6e..601387cf80 100644
--- a/rts/sm/MBlock.c
+++ b/rts/sm/MBlock.c
@@ -49,6 +49,18 @@
lnat mblocks_allocated = 0;
+#if !defined(mingw32_HOST_OS) && !defined(cygwin32_HOST_OS)
+static caddr_t next_request = 0;
+#endif
+
+void
+initMBlocks(void)
+{
+#if !defined(mingw32_HOST_OS) && !defined(cygwin32_HOST_OS)
+ next_request = (caddr_t)RtsFlags.GcFlags.heapBase;
+#endif
+}
+
/* -----------------------------------------------------------------------------
The MBlock Map: provides our implementation of HEAP_ALLOCED()
-------------------------------------------------------------------------- */
@@ -258,7 +270,6 @@ gen_map_mblocks (lnat size)
void *
getMBlocks(nat n)
{
- static caddr_t next_request = (caddr_t)HEAP_BASE;
caddr_t ret;
lnat size = MBLOCK_SIZE * n;
nat i;
diff --git a/rts/sm/MBlock.h b/rts/sm/MBlock.h
index 1cc0dc5a1f..ecce6f81d9 100644
--- a/rts/sm/MBlock.h
+++ b/rts/sm/MBlock.h
@@ -11,26 +11,11 @@
extern lnat RTS_VAR(mblocks_allocated);
+extern void initMBlocks(void);
extern void * getMBlock(void);
extern void * getMBlocks(nat n);
extern void freeAllMBlocks(void);
-#if osf3_HOST_OS
-/* ToDo: Perhaps by adjusting this value we can make linking without
- * -static work (i.e., not generate a core-dumping executable)? */
-#if SIZEOF_VOID_P == 8
-#define HEAP_BASE 0x180000000L
-#else
-#error I have no idea where to begin the heap on a non-64-bit osf3 machine.
-#endif
-
-#else
-
-// we're using the generic method
-#define HEAP_BASE 0
-
-#endif
-
/* -----------------------------------------------------------------------------
The HEAP_ALLOCED() test.
diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c
index 097c727ca7..f9e32f288a 100644
--- a/rts/sm/Storage.c
+++ b/rts/sm/Storage.c
@@ -115,6 +115,8 @@ initStorage( void )
return;
}
+ initMBlocks();
+
/* Sanity check to make sure the LOOKS_LIKE_ macros appear to be
* doing something reasonable.
*/