From: Brian Norris Date: Mon, 8 Oct 2012 19:58:01 +0000 (-0700) Subject: snapshot: use snapshot_space only in mprotect-based X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=6712d74fa36397ad2b27cea0b017148e9753eafe snapshot: use snapshot_space only in mprotect-based 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. --- diff --git a/mymemory.h b/mymemory.h index 2379b5f6..0e274d2f 100644 --- a/mymemory.h +++ b/mymemory.h @@ -7,6 +7,8 @@ #include #include +#include "config.h" + /** MEMALLOC declares the allocators for a class to allocate * memory in the non-snapshotting heap. */ #define MEMALLOC \ @@ -152,8 +154,11 @@ extern void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size); 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; +#endif + #ifdef __cplusplus }; /* end of extern "C" */ #endif diff --git a/snapshot.cc b/snapshot.cc index a5f292f0..0c90da83 100644 --- a/snapshot.cc +++ b/snapshot.cc @@ -45,7 +45,8 @@ struct SnapShot * snapshotrecord = NULL; static ucontext_t savedSnapshotContext; static ucontext_t savedUserSnapshotContext; static snapshot_id snapshotid = 0; -#endif + +#else /* USE_MPROTECT_SNAPSHOT */ /** PageAlignedAdressUpdate return a page aligned address for the * address being added as a side effect the numBytes are also changed. @@ -54,8 +55,6 @@ static void * PageAlignAddressUpward(void * addr) { 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. */ @@ -109,7 +108,7 @@ static void HandlePF( int sig, siginfo_t *si, void * unused){ // Handle error by quitting? } } -#endif //nothing to handle for non snapshotting case. +#endif /* USE_MPROTECT_SNAPSHOT */ #if !USE_MPROTECT_SNAPSHOT void createSharedMemory(){