X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FMBlock.c;h=eae83d2dc5fb1647454f998876c442044f8d26f5;hb=f98aaf1088d0b654ebf6c887c7dbebe5bb6f5f5f;hp=eeb3bdea74684a5990cfe00cf195e7062a028c41;hpb=4ca466da9af039d6d0d72333f464b687f2fd4a07;p=ghc-hetmet.git diff --git a/ghc/rts/MBlock.c b/ghc/rts/MBlock.c index eeb3bde..eae83d2 100644 --- a/ghc/rts/MBlock.c +++ b/ghc/rts/MBlock.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: MBlock.c,v 1.13 1999/12/15 09:43:24 simonmar Exp $ + * $Id: MBlock.c,v 1.18 2000/09/06 11:12:07 rrt Exp $ * * (c) The GHC Team 1998-1999 * @@ -39,7 +39,7 @@ #include #endif -#if freebsd2_TARGET_OS || freebsd3_TARGET_OS +#if freebsd2_TARGET_OS || freebsd_TARGET_OS /* Executable is loaded from 0x0 * Shared libraries are loaded at 0x2000000 * Stack is at the top of the address space. The kernel probably owns @@ -51,6 +51,8 @@ /* NetBSD i386 shared libs are at 0x40000000 */ #define ASK_FOR_MEM_AT 0x50000000 +#elif openbsd_TARGET_OS +#define ASK_FOR_MEM_AT 0x50000000 #elif linux_TARGET_OS /* Any ideas? */ @@ -152,11 +154,12 @@ char* base_non_committed = (char*)0; #define SIZE_RESERVED_POOL ( 128 * 1024 * 1024 ) /* This predicate should be inlined, really. */ +/* TODO: this only works for a single chunk */ int is_heap_alloced(const void* x) { return (((char*)(x) >= base_non_committed) && - ((char*)(x) <= (base_non_committed + 128 * 1024 * 1024))); + ((char*)(x) <= (base_non_committed + SIZE_RESERVED_POOL))); } void * @@ -170,6 +173,10 @@ getMBlocks(nat n) if ( (base_non_committed == 0) || (next_request + size > base_non_committed + SIZE_RESERVED_POOL) ) { +#ifdef ENABLE_WIN32_DLL_SUPPORT + if (base_non_committed) + barf("Windows programs can only use 128Mb of heap; sorry!"); +#endif base_non_committed = VirtualAlloc ( NULL , SIZE_RESERVED_POOL , MEM_RESERVE