We don't need this heap for fork-based snapshotting, so clearly separate
the functionality here.
This also makes PageAlignedAdressUpdate() available only for
mprotect-based snapshotting.
#include <stdlib.h>
#include <limits>
#include <stdlib.h>
#include <limits>
/** MEMALLOC declares the allocators for a class to allocate
* memory in the non-snapshotting heap. */
#define MEMALLOC \
/** MEMALLOC declares the allocators for a class to allocate
* memory in the non-snapshotting heap. */
#define MEMALLOC \
extern mspace create_mspace_with_base(void* base, size_t capacity, int locked);
extern mspace create_mspace(size_t capacity, int locked);
extern mspace create_mspace_with_base(void* base, size_t capacity, int locked);
extern mspace create_mspace(size_t capacity, int locked);
+#if USE_MPROTECT_SNAPSHOT
/** @brief mspace for the snapshotting heap */
extern mspace snapshot_space;
/** @brief mspace for the snapshotting heap */
extern mspace snapshot_space;
#ifdef __cplusplus
}; /* end of extern "C" */
#endif
#ifdef __cplusplus
}; /* end of extern "C" */
#endif
static ucontext_t savedSnapshotContext;
static ucontext_t savedUserSnapshotContext;
static snapshot_id snapshotid = 0;
static ucontext_t savedSnapshotContext;
static ucontext_t savedUserSnapshotContext;
static snapshot_id snapshotid = 0;
+
+#else /* USE_MPROTECT_SNAPSHOT */
/** PageAlignedAdressUpdate return a page aligned address for the
* address being added as a side effect the numBytes are also changed.
/** PageAlignedAdressUpdate return a page aligned address for the
* address being added as a side effect the numBytes are also changed.
return (void *)((((uintptr_t)addr)+PAGESIZE-1)&~(PAGESIZE-1));
}
return (void *)((((uintptr_t)addr)+PAGESIZE-1)&~(PAGESIZE-1));
}
-#if USE_MPROTECT_SNAPSHOT
-
/** ReturnPageAlignedAddress returns a page aligned address for the
* address being added as a side effect the numBytes are also changed.
*/
/** ReturnPageAlignedAddress returns a page aligned address for the
* address being added as a side effect the numBytes are also changed.
*/
// Handle error by quitting?
}
}
// Handle error by quitting?
}
}
-#endif //nothing to handle for non snapshotting case.
+#endif /* USE_MPROTECT_SNAPSHOT */
#if !USE_MPROTECT_SNAPSHOT
void createSharedMemory(){
#if !USE_MPROTECT_SNAPSHOT
void createSharedMemory(){