From: Morgan Deters Date: Tue, 17 Aug 2010 05:06:09 +0000 (+0000) Subject: Add "no trash" CDMap elements, so that CDMap elements can themselves X-Git-Tag: cvc5-1.0.0~8887 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=daf715e2ccb53bd88c6f374840b5d41e72c61c90;p=cvc5.git Add "no trash" CDMap elements, so that CDMap elements can themselves be allocated in context memory. CDMap black-box test extended. --- diff --git a/src/context/cdmap.h b/src/context/cdmap.h index 66f897818..c218d05f3 100644 --- a/src/context/cdmap.h +++ b/src/context/cdmap.h @@ -329,7 +329,9 @@ public: ++i) { // mark it as being a destruction (short-circuit restore()) (*i).second->d_map = NULL; - (*i).second->deleteSelf(); + if(!(*i).second->d_noTrash) { + (*i).second->deleteSelf(); + } } d_map.clear(); d_first = NULL; @@ -349,7 +351,9 @@ public: ++i) { // mark it as being a destruction (short-circuit restore()) (*i).second->d_map = NULL; - (*i).second->deleteSelf(); + if(!(*i).second->d_noTrash) { + (*i).second->deleteSelf(); + } } d_map.clear(); d_first = NULL; @@ -486,7 +490,9 @@ public: d_map.erase(j);//FIXME multithreading Debug("gc") << "key " << k << " obliterated zero-scope: " << elt << std::endl; // was already destructed, so don't call ->deleteSelf() - ::operator delete(elt); + if(!elt->d_noTrash) { + ::operator delete(elt); + } } } } diff --git a/test/unit/context/cdmap_black.h b/test/unit/context/cdmap_black.h index 7b8953dc0..37beb5054 100644 --- a/test/unit/context/cdmap_black.h +++ b/test/unit/context/cdmap_black.h @@ -930,9 +930,8 @@ public: }; void testMapOfLists() { - try{ - //Debug.on("gc"); - //Debug.on("context"); + //Debug.on("gc"); + //Debug.on("context"); CDMap*, int_hasher> map(d_context); @@ -1055,6 +1054,13 @@ public: } TS_ASSERT(d_context->getLevel() == 0); - } catch(Exception& e) { cout << e << std::endl; throw e; } + } + + void testCmmElementsAtLevel0() { + // this was crashing + + CDMap map(d_context); + int* a = (int*)d_context->getCMM()->newData(sizeof(int)); + map.insertDataFromContextMemory(1, a); } };