diff --git a/bolt/runtime/common.h b/bolt/runtime/common.h --- a/bolt/runtime/common.h +++ b/bolt/runtime/common.h @@ -475,7 +475,7 @@ public: bool acquire() { bool Result = true; - asm volatile("lock; xchg %0, %1" : "+m"(InUse), "=r"(Result) : : "cc"); + asm volatile("lock; xchg %0, %1" : "+m"(InUse), "+r"(Result) : : "cc"); return !Result; } void release() { InUse = false; } diff --git a/bolt/runtime/instr.cpp b/bolt/runtime/instr.cpp --- a/bolt/runtime/instr.cpp +++ b/bolt/runtime/instr.cpp @@ -289,6 +289,7 @@ /// Traverses all elements in the table template void forEachElement(void (*Callback)(MapEntry &, Args...), Args... args) { + Lock L(M); if (!TableRoot) return; return forEachElement(Callback, InitialSize, TableRoot, args...); @@ -378,7 +379,6 @@ template void SimpleHashTable::resetCounters() { - Lock L(M); forEachElement(resetIndCallCounter); }