@@ -2597,17 +2597,16 @@ Node *&getInTree(Node *n, ConflictSet::Impl *impl) {
|
|||||||
: getChildExists(n->parent, n->parentsIndex);
|
: getChildExists(n->parent, n->parentsIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== END IMPLEMENTATION ====================
|
// Internal entry points. Public entry points should just delegate to these
|
||||||
|
|
||||||
// GCOVR_EXCL_START
|
void internal_check(ConflictSet::Impl *impl,
|
||||||
|
const ConflictSet::ReadRange *reads,
|
||||||
void ConflictSet::check(const ReadRange *reads, Result *results,
|
ConflictSet::Result *results, int count) {
|
||||||
int count) const {
|
impl->check(reads, results, count);
|
||||||
return impl->check(reads, results, count);
|
|
||||||
}
|
}
|
||||||
|
void internal_addWrites(ConflictSet::Impl *impl,
|
||||||
void ConflictSet::addWrites(const WriteRange *writes, int count,
|
const ConflictSet::WriteRange *writes, int count,
|
||||||
int64_t writeVersion) {
|
int64_t writeVersion) {
|
||||||
mallocBytesDelta = 0;
|
mallocBytesDelta = 0;
|
||||||
impl->addWrites(writes, count, writeVersion);
|
impl->addWrites(writes, count, writeVersion);
|
||||||
impl->totalBytes += mallocBytesDelta;
|
impl->totalBytes += mallocBytesDelta;
|
||||||
@@ -2618,7 +2617,7 @@ void ConflictSet::addWrites(const WriteRange *writes, int count,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConflictSet::setOldestVersion(int64_t oldestVersion) {
|
void internal_setOldestVersion(ConflictSet::Impl *impl, int64_t oldestVersion) {
|
||||||
mallocBytesDelta = 0;
|
mallocBytesDelta = 0;
|
||||||
impl->setOldestVersion(oldestVersion);
|
impl->setOldestVersion(oldestVersion);
|
||||||
impl->totalBytes += mallocBytesDelta;
|
impl->totalBytes += mallocBytesDelta;
|
||||||
@@ -2628,19 +2627,47 @@ void ConflictSet::setOldestVersion(int64_t oldestVersion) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
ConflictSet::Impl *internal_create(int64_t oldestVersion) {
|
||||||
|
mallocBytesDelta = 0;
|
||||||
|
auto *result = new (safe_malloc(sizeof(ConflictSet::Impl)))
|
||||||
|
ConflictSet::Impl{oldestVersion};
|
||||||
|
result->totalBytes += mallocBytesDelta;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
int64_t ConflictSet::getBytes() const { return impl->totalBytes; }
|
void internal_destroy(ConflictSet::Impl *impl) {
|
||||||
|
impl->~Impl();
|
||||||
|
safe_free(impl, sizeof(ConflictSet::Impl));
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t internal_getBytes(ConflictSet::Impl *impl) { return impl->totalBytes; }
|
||||||
|
|
||||||
|
// ==================== END IMPLEMENTATION ====================
|
||||||
|
|
||||||
|
// GCOVR_EXCL_START
|
||||||
|
|
||||||
|
void ConflictSet::check(const ReadRange *reads, Result *results,
|
||||||
|
int count) const {
|
||||||
|
internal_check(impl, reads, results, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConflictSet::addWrites(const WriteRange *writes, int count,
|
||||||
|
int64_t writeVersion) {
|
||||||
|
internal_addWrites(impl, writes, count, writeVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConflictSet::setOldestVersion(int64_t oldestVersion) {
|
||||||
|
internal_setOldestVersion(impl, oldestVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t ConflictSet::getBytes() const { return internal_getBytes(impl); }
|
||||||
|
|
||||||
ConflictSet::ConflictSet(int64_t oldestVersion)
|
ConflictSet::ConflictSet(int64_t oldestVersion)
|
||||||
: impl((mallocBytesDelta = 0,
|
: impl(internal_create(oldestVersion)) {}
|
||||||
new(safe_malloc(sizeof(Impl))) Impl{oldestVersion})) {
|
|
||||||
impl->totalBytes += mallocBytesDelta;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConflictSet::~ConflictSet() {
|
ConflictSet::~ConflictSet() {
|
||||||
if (impl) {
|
if (impl) {
|
||||||
impl->~Impl();
|
internal_destroy(impl);
|
||||||
safe_free(impl, sizeof(*impl));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2661,50 +2688,27 @@ extern "C" {
|
|||||||
__attribute__((__visibility__("default"))) void
|
__attribute__((__visibility__("default"))) void
|
||||||
ConflictSet_check(void *cs, const ConflictSet_ReadRange *reads,
|
ConflictSet_check(void *cs, const ConflictSet_ReadRange *reads,
|
||||||
ConflictSet_Result *results, int count) {
|
ConflictSet_Result *results, int count) {
|
||||||
((ConflictSet::Impl *)cs)->check(reads, results, count);
|
internal_check((ConflictSet::Impl *)cs, reads, results, count);
|
||||||
}
|
}
|
||||||
__attribute__((__visibility__("default"))) void
|
__attribute__((__visibility__("default"))) void
|
||||||
ConflictSet_addWrites(void *cs, const ConflictSet_WriteRange *writes, int count,
|
ConflictSet_addWrites(void *cs, const ConflictSet_WriteRange *writes, int count,
|
||||||
int64_t writeVersion) {
|
int64_t writeVersion) {
|
||||||
auto *impl = (ConflictSet::Impl *)cs;
|
internal_addWrites((ConflictSet::Impl *)cs, writes, count, writeVersion);
|
||||||
mallocBytesDelta = 0;
|
|
||||||
impl->addWrites(writes, count, writeVersion);
|
|
||||||
impl->totalBytes += mallocBytesDelta;
|
|
||||||
#if SHOW_MEMORY
|
|
||||||
if (impl->totalBytes != mallocBytes) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
__attribute__((__visibility__("default"))) void
|
__attribute__((__visibility__("default"))) void
|
||||||
ConflictSet_setOldestVersion(void *cs, int64_t oldestVersion) {
|
ConflictSet_setOldestVersion(void *cs, int64_t oldestVersion) {
|
||||||
auto *impl = (ConflictSet::Impl *)cs;
|
internal_setOldestVersion((ConflictSet::Impl *)cs, oldestVersion);
|
||||||
mallocBytesDelta = 0;
|
|
||||||
impl->setOldestVersion(oldestVersion);
|
|
||||||
impl->totalBytes += mallocBytesDelta;
|
|
||||||
#if SHOW_MEMORY
|
|
||||||
if (impl->totalBytes != mallocBytes) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
__attribute__((__visibility__("default"))) void *
|
__attribute__((__visibility__("default"))) void *
|
||||||
ConflictSet_create(int64_t oldestVersion) {
|
ConflictSet_create(int64_t oldestVersion) {
|
||||||
mallocBytesDelta = 0;
|
return internal_create(oldestVersion);
|
||||||
auto *result = new (safe_malloc(sizeof(ConflictSet::Impl)))
|
|
||||||
ConflictSet::Impl{oldestVersion};
|
|
||||||
result->totalBytes += mallocBytesDelta;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
__attribute__((__visibility__("default"))) void ConflictSet_destroy(void *cs) {
|
__attribute__((__visibility__("default"))) void ConflictSet_destroy(void *cs) {
|
||||||
using Impl = ConflictSet::Impl;
|
internal_destroy((ConflictSet::Impl *)cs);
|
||||||
((Impl *)cs)->~Impl();
|
|
||||||
safe_free(cs, sizeof(Impl));
|
|
||||||
}
|
}
|
||||||
__attribute__((__visibility__("default"))) int64_t
|
__attribute__((__visibility__("default"))) int64_t
|
||||||
ConflictSet_getBytes(void *cs) {
|
ConflictSet_getBytes(void *cs) {
|
||||||
using Impl = ConflictSet::Impl;
|
return internal_getBytes((ConflictSet::Impl *)cs);
|
||||||
return ((Impl *)cs)->totalBytes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
88
SkipList.cpp
88
SkipList.cpp
@@ -651,13 +651,16 @@ private:
|
|||||||
SkipList skipList;
|
SkipList skipList;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ConflictSet::check(const ReadRange *reads, Result *results,
|
// Internal entry points. Public entry points should just delegate to these
|
||||||
int count) const {
|
|
||||||
|
void internal_check(ConflictSet::Impl *impl,
|
||||||
|
const ConflictSet::ReadRange *reads,
|
||||||
|
ConflictSet::Result *results, int count) {
|
||||||
impl->check(reads, results, count);
|
impl->check(reads, results, count);
|
||||||
}
|
}
|
||||||
|
void internal_addWrites(ConflictSet::Impl *impl,
|
||||||
void ConflictSet::addWrites(const WriteRange *writes, int count,
|
const ConflictSet::WriteRange *writes, int count,
|
||||||
int64_t writeVersion) {
|
int64_t writeVersion) {
|
||||||
mallocBytesDelta = 0;
|
mallocBytesDelta = 0;
|
||||||
impl->addWrites(writes, count, writeVersion);
|
impl->addWrites(writes, count, writeVersion);
|
||||||
impl->totalBytes += mallocBytesDelta;
|
impl->totalBytes += mallocBytesDelta;
|
||||||
@@ -668,7 +671,7 @@ void ConflictSet::addWrites(const WriteRange *writes, int count,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConflictSet::setOldestVersion(int64_t oldestVersion) {
|
void internal_setOldestVersion(ConflictSet::Impl *impl, int64_t oldestVersion) {
|
||||||
mallocBytesDelta = 0;
|
mallocBytesDelta = 0;
|
||||||
impl->setOldestVersion(oldestVersion);
|
impl->setOldestVersion(oldestVersion);
|
||||||
impl->totalBytes += mallocBytesDelta;
|
impl->totalBytes += mallocBytesDelta;
|
||||||
@@ -678,19 +681,43 @@ void ConflictSet::setOldestVersion(int64_t oldestVersion) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
ConflictSet::Impl *internal_create(int64_t oldestVersion) {
|
||||||
|
mallocBytesDelta = 0;
|
||||||
|
auto *result = new (safe_malloc(sizeof(ConflictSet::Impl)))
|
||||||
|
ConflictSet::Impl{oldestVersion};
|
||||||
|
result->totalBytes += mallocBytesDelta;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
int64_t ConflictSet::getBytes() const { return impl->totalBytes; }
|
void internal_destroy(ConflictSet::Impl *impl) {
|
||||||
|
impl->~Impl();
|
||||||
|
safe_free(impl, sizeof(ConflictSet::Impl));
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t internal_getBytes(ConflictSet::Impl *impl) { return impl->totalBytes; }
|
||||||
|
|
||||||
|
void ConflictSet::check(const ReadRange *reads, Result *results,
|
||||||
|
int count) const {
|
||||||
|
internal_check(impl, reads, results, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConflictSet::addWrites(const WriteRange *writes, int count,
|
||||||
|
int64_t writeVersion) {
|
||||||
|
internal_addWrites(impl, writes, count, writeVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConflictSet::setOldestVersion(int64_t oldestVersion) {
|
||||||
|
internal_setOldestVersion(impl, oldestVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t ConflictSet::getBytes() const { return internal_getBytes(impl); }
|
||||||
|
|
||||||
ConflictSet::ConflictSet(int64_t oldestVersion)
|
ConflictSet::ConflictSet(int64_t oldestVersion)
|
||||||
: impl((mallocBytesDelta = 0,
|
: impl(internal_create(oldestVersion)) {}
|
||||||
new(safe_malloc(sizeof(Impl))) Impl{oldestVersion})) {
|
|
||||||
impl->totalBytes += mallocBytesDelta;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConflictSet::~ConflictSet() {
|
ConflictSet::~ConflictSet() {
|
||||||
if (impl) {
|
if (impl) {
|
||||||
impl->~Impl();
|
internal_destroy(impl);
|
||||||
safe_free(impl, sizeof(Impl));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -711,50 +738,27 @@ extern "C" {
|
|||||||
__attribute__((__visibility__("default"))) void
|
__attribute__((__visibility__("default"))) void
|
||||||
ConflictSet_check(void *cs, const ConflictSet_ReadRange *reads,
|
ConflictSet_check(void *cs, const ConflictSet_ReadRange *reads,
|
||||||
ConflictSet_Result *results, int count) {
|
ConflictSet_Result *results, int count) {
|
||||||
((ConflictSet::Impl *)cs)->check(reads, results, count);
|
internal_check((ConflictSet::Impl *)cs, reads, results, count);
|
||||||
}
|
}
|
||||||
__attribute__((__visibility__("default"))) void
|
__attribute__((__visibility__("default"))) void
|
||||||
ConflictSet_addWrites(void *cs, const ConflictSet_WriteRange *writes, int count,
|
ConflictSet_addWrites(void *cs, const ConflictSet_WriteRange *writes, int count,
|
||||||
int64_t writeVersion) {
|
int64_t writeVersion) {
|
||||||
auto *impl = (ConflictSet::Impl *)cs;
|
internal_addWrites((ConflictSet::Impl *)cs, writes, count, writeVersion);
|
||||||
mallocBytesDelta = 0;
|
|
||||||
impl->addWrites(writes, count, writeVersion);
|
|
||||||
impl->totalBytes += mallocBytesDelta;
|
|
||||||
#if SHOW_MEMORY
|
|
||||||
if (impl->totalBytes != mallocBytes) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
__attribute__((__visibility__("default"))) void
|
__attribute__((__visibility__("default"))) void
|
||||||
ConflictSet_setOldestVersion(void *cs, int64_t oldestVersion) {
|
ConflictSet_setOldestVersion(void *cs, int64_t oldestVersion) {
|
||||||
auto *impl = (ConflictSet::Impl *)cs;
|
internal_setOldestVersion((ConflictSet::Impl *)cs, oldestVersion);
|
||||||
mallocBytesDelta = 0;
|
|
||||||
impl->setOldestVersion(oldestVersion);
|
|
||||||
impl->totalBytes += mallocBytesDelta;
|
|
||||||
#if SHOW_MEMORY
|
|
||||||
if (impl->totalBytes != mallocBytes) {
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
__attribute__((__visibility__("default"))) void *
|
__attribute__((__visibility__("default"))) void *
|
||||||
ConflictSet_create(int64_t oldestVersion) {
|
ConflictSet_create(int64_t oldestVersion) {
|
||||||
mallocBytesDelta = 0;
|
return internal_create(oldestVersion);
|
||||||
auto *result = new (safe_malloc(sizeof(ConflictSet::Impl)))
|
|
||||||
ConflictSet::Impl{oldestVersion};
|
|
||||||
result->totalBytes += mallocBytesDelta;
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
__attribute__((__visibility__("default"))) void ConflictSet_destroy(void *cs) {
|
__attribute__((__visibility__("default"))) void ConflictSet_destroy(void *cs) {
|
||||||
using Impl = ConflictSet::Impl;
|
internal_destroy((ConflictSet::Impl *)cs);
|
||||||
((Impl *)cs)->~Impl();
|
|
||||||
safe_free(cs, sizeof(Impl));
|
|
||||||
}
|
}
|
||||||
__attribute__((__visibility__("default"))) int64_t
|
__attribute__((__visibility__("default"))) int64_t
|
||||||
ConflictSet_getBytes(void *cs) {
|
ConflictSet_getBytes(void *cs) {
|
||||||
using Impl = ConflictSet::Impl;
|
return internal_getBytes((ConflictSet::Impl *)cs);
|
||||||
return ((Impl *)cs)->totalBytes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user