rename MYMALLOC -> model_malloc
authorBrian Norris <banorris@uci.edu>
Tue, 2 Oct 2012 01:16:24 +0000 (18:16 -0700)
committerBrian Norris <banorris@uci.edu>
Tue, 2 Oct 2012 01:19:11 +0000 (18:19 -0700)
cyclegraph.cc
mymemory.cc
mymemory.h
nodestack.cc
snapshot-interface.cc
snapshot.cc

index 2bfe76ac424c274bf8152638543ad7dd6bc1d31f..ae80fcf8fda2b4b2d8f04dcc9cbc13a40ef72359 100644 (file)
@@ -170,7 +170,7 @@ bool CycleGraph::checkReachable(const ModelAction *from, const ModelAction *to)
  */
 bool CycleGraph::checkReachable(CycleNode *from, CycleNode *to) {
        std::vector<CycleNode *, MyAlloc<CycleNode *> > queue;
-       HashTable<CycleNode *, CycleNode *, uintptr_t, 4, MYMALLOC, MYCALLOC, MYFREE> discovered;
+       HashTable<CycleNode *, CycleNode *, uintptr_t, 4, model_malloc, MYCALLOC, MYFREE> discovered;
 
        queue.push_back(from);
        discovered.put(from, from);
index b702d39945fa5cbaa7953b106aad3f7fa748a273..4b393cb4a29fac98fdb7b912fef5991d7a7c458a 100644 (file)
@@ -41,7 +41,7 @@ void *MYCALLOC(size_t count, size_t size) {
 }
 
 /** Non-snapshotting malloc for our use. */
-void *MYMALLOC(size_t size) {
+void *model_malloc(size_t size) {
 #if USE_MPROTECT_SNAPSHOT
        static void *(*mallocp)(size_t size)=NULL;
        char *error;
index 3059e699960be53290c67064389bfd2c5087df4e..21f636f584f7c6b66cbc534ef3708c2fe2f667f3 100644 (file)
  *     memory in the non-snapshotting heap. */
 #define MEMALLOC \
        void * operator new(size_t size) { \
-               return MYMALLOC(size);\
+               return model_malloc(size);\
        }\
        void operator delete(void *p, size_t size) { \
                MYFREE( p ); \
        }\
        void * operator new[](size_t size) { \
-               return MYMALLOC(size);\
+               return model_malloc(size);\
        }\
        void operator delete[](void *p, size_t size) {\
                MYFREE(p);\
@@ -27,7 +27,7 @@
  *     memory in the snapshotting heap. */
 #define SNAPSHOTALLOC
 
-void *MYMALLOC(size_t size);
+void *model_malloc(size_t size);
 void *MYCALLOC(size_t count, size_t size);
 void MYFREE(void *ptr);
 
@@ -100,7 +100,7 @@ template <class T>
 
        // allocate but don't initialize num elements of type T
        pointer allocate (size_type num, const void* = 0) {
-           pointer p = ( pointer )MYMALLOC( num * sizeof( T ) );
+           pointer p = ( pointer )model_malloc( num * sizeof( T ) );
            return p;
        }
 
index 136e3a2eb4a2f72325db5e95e5fc9205160450b2..e59b99511b89d30d1d33ce1c81b2e5ec8f6ac4b1 100644 (file)
@@ -218,7 +218,7 @@ bool Node::read_from_empty() {
 void Node::explore_child(ModelAction *act, bool * is_enabled)
 {
        if ( ! enabled_array )
-               enabled_array=(bool *)MYMALLOC(sizeof(bool)*num_threads);
+               enabled_array=(bool *)model_malloc(sizeof(bool)*num_threads);
        if (is_enabled != NULL)
                memcpy(enabled_array, is_enabled, sizeof(bool)*num_threads);
        else {
index d93e5c20dce3203378c2ea9d4f611bb90580686d..8d7591b82efa1afccb5e00a3b5bb990c5b7447fe 100644 (file)
@@ -130,7 +130,7 @@ int SnapshotStack::backTrackBeforeStep(int seqindex) {
 
 /** This method takes a snapshot at the given sequence number. */
 void SnapshotStack::snapshotStep(int seqindex) {
-       struct stackEntry *tmp=(struct stackEntry *)MYMALLOC(sizeof(struct stackEntry));
+       struct stackEntry *tmp=(struct stackEntry *)model_malloc(sizeof(struct stackEntry));
        tmp->next=stack;
        tmp->index=seqindex;
        tmp->snapshotid=takeSnapshot();
index b7e4ec1ca5ae789915e6ff2931e73668bb845034..642885b038df274b68eb028e7a25d5563b9f2ec6 100644 (file)
@@ -67,13 +67,13 @@ static void * ReturnPageAlignedAddress(void * addr) {
  *  structures for the mprotect based snapshot.
  */
 static void initSnapShotRecord(unsigned int numbackingpages, unsigned int numsnapshots, unsigned int nummemoryregions) {
-       snapshotrecord=( struct SnapShot * )MYMALLOC(sizeof(struct SnapShot));
-       snapshotrecord->regionsToSnapShot=( struct MemoryRegion * )MYMALLOC(sizeof(struct MemoryRegion)*nummemoryregions);
-       snapshotrecord->backingStoreBasePtr= ( struct SnapShotPage * )MYMALLOC( sizeof( struct SnapShotPage ) * (numbackingpages + 1) );
+       snapshotrecord=( struct SnapShot * )model_malloc(sizeof(struct SnapShot));
+       snapshotrecord->regionsToSnapShot=( struct MemoryRegion * )model_malloc(sizeof(struct MemoryRegion)*nummemoryregions);
+       snapshotrecord->backingStoreBasePtr= ( struct SnapShotPage * )model_malloc( sizeof( struct SnapShotPage ) * (numbackingpages + 1) );
        //Page align the backingstorepages
        snapshotrecord->backingStore=( struct SnapShotPage * )PageAlignAddressUpward(snapshotrecord->backingStoreBasePtr);
-       snapshotrecord->backingRecords=( struct BackingPageRecord * )MYMALLOC(sizeof(struct BackingPageRecord)*numbackingpages);
-       snapshotrecord->snapShots= ( struct SnapShotRecord * )MYMALLOC(sizeof(struct SnapShotRecord)*numsnapshots);
+       snapshotrecord->backingRecords=( struct BackingPageRecord * )model_malloc(sizeof(struct BackingPageRecord)*numbackingpages);
+       snapshotrecord->snapShots= ( struct SnapShotRecord * )model_malloc(sizeof(struct SnapShotRecord)*numsnapshots);
        snapshotrecord->lastSnapShot=0;
        snapshotrecord->lastBackingPage=0;
        snapshotrecord->lastRegion=0;
@@ -139,7 +139,7 @@ void initSnapShotLibrary(unsigned int numbackingpages,
                unsigned int numheappages, VoidFuncPtr entryPoint) {
        /* Setup a stack for our signal handler....  */
        stack_t ss;
-       ss.ss_sp = MYMALLOC(SIGSTACKSIZE);
+       ss.ss_sp = model_malloc(SIGSTACKSIZE);
        ss.ss_size = SIGSTACKSIZE;
        ss.ss_flags = 0;
        sigaltstack(&ss, NULL);
@@ -171,7 +171,7 @@ void initSnapShotLibrary(unsigned int numbackingpages,
        HandlePF(SIGSEGV, &si, NULL);
        snapshotrecord->lastBackingPage--; //remove the fake page we copied
 
-       basemySpace=MYMALLOC((numheappages+1)*PAGESIZE);
+       basemySpace=model_malloc((numheappages+1)*PAGESIZE);
        void * pagealignedbase=PageAlignAddressUpward(basemySpace);
        mySpace = create_mspace_with_base(pagealignedbase,  numheappages*PAGESIZE, 1 );
        addMemoryRegionToSnapShot(pagealignedbase, numheappages);
@@ -284,7 +284,7 @@ snapshot_id takeSnapshot( ){
  */
 void rollBack( snapshot_id theID ){
 #if USE_MPROTECT_SNAPSHOT
-       HashTable< void *, bool, uintptr_t, 4, MYMALLOC, MYCALLOC, MYFREE> duplicateMap;
+       HashTable< void *, bool, uintptr_t, 4, model_malloc, MYCALLOC, MYFREE> duplicateMap;
        for(unsigned int region=0; region<snapshotrecord->lastRegion;region++) {
                if( mprotect(snapshotrecord->regionsToSnapShot[region].basePtr, snapshotrecord->regionsToSnapShot[region].sizeInPages*sizeof(struct SnapShotPage), PROT_READ | PROT_WRITE ) == -1 ){
                        perror("mprotect");