X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/bde0d71c178139ae001233e6f283a458ab0030f1..85123d65e06f07e8e82dd5464e428816541a8902:/src/mc/compare.cpp diff --git a/src/mc/compare.cpp b/src/mc/compare.cpp index 8420c96546..e2adf2dc52 100644 --- a/src/mc/compare.cpp +++ b/src/mc/compare.cpp @@ -12,29 +12,14 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_compare, xbt, "Logging specific to mc_compare in mc"); +using simgrid::mc::remote; + namespace simgrid { namespace mc { -struct HeapLocation; -typedef std::array HeapLocationPair; -typedef std::set HeapLocationPairs; -struct HeapArea; -struct ProcessComparisonState; -struct StateComparator; - -static int compare_heap_area(StateComparator& state, const void* area1, const void* area2, Snapshot* snapshot1, - Snapshot* snapshot2, HeapLocationPairs* previous, Type* type, int pointer_level); -} -} - -using simgrid::mc::remote; - /*********************************** Heap comparison ***********************************/ /***************************************************************************************/ -namespace simgrid { -namespace mc { - class HeapLocation { public: int block_ = 0; @@ -53,13 +38,16 @@ public: } }; +typedef std::array HeapLocationPair; +typedef std::set HeapLocationPairs; + +struct ProcessComparisonState; +struct StateComparator; + static inline HeapLocationPair makeHeapLocationPair(int block1, int fragment1, int block2, int fragment2) { - return simgrid::mc::HeapLocationPair{{ - simgrid::mc::HeapLocation(block1, fragment1), - simgrid::mc::HeapLocation(block2, fragment2) - }}; + return HeapLocationPair{{HeapLocation(block1, fragment1), HeapLocation(block2, fragment2)}}; } class HeapArea : public HeapLocation { @@ -84,26 +72,8 @@ public: void initHeapInformation(xbt_mheap_t heap, std::vector* i); }; -namespace { - -/** A hash which works with more stuff - * - * It can hash pairs: the standard hash currently doesn't include this. - */ -template class hash : public std::hash { -}; - -template class hash> { -public: - std::size_t operator()(std::pairconst& x) const - { - hash h1; - hash h2; - return h1(x.first) ^ h2(x.second); - } -}; - -} +static int compare_heap_area(StateComparator& state, const void* area1, const void* area2, Snapshot* snapshot1, + Snapshot* snapshot2, HeapLocationPairs* previous, Type* type, int pointer_level); class StateComparator { public: @@ -111,7 +81,7 @@ public: std::size_t heaplimit; std::array processStates; - std::unordered_set, hash>> compared_pointers; + std::unordered_set, simgrid::xbt::hash>> compared_pointers; void clear() { @@ -390,7 +360,6 @@ static bool mmalloc_heap_equal(simgrid::mc::StateComparator& state, simgrid::mc: if (not equal) { XBT_DEBUG("Block %zu not found (size_used = %zu, addr = %p)", i1, heapinfo1->busy_block.busy_size, addr_block1); - i1 = state.heaplimit + 1; return false; } @@ -464,7 +433,6 @@ static bool mmalloc_heap_equal(simgrid::mc::StateComparator& state, simgrid::mc: if (not equal) { XBT_DEBUG("Block %zu, fragment_ %zu not found (size_used = %zd, address = %p)\n", i1, j1, heapinfo1->busy_frag.frag_size[j1], addr_frag1); - i1 = state.heaplimit + 1; return false; } }