Require musttail and preserve_none for interleaved

This commit is contained in:
2024-11-11 21:40:05 -08:00
parent b0750772ec
commit 607a4ef6e2

View File

@@ -3183,6 +3183,12 @@ Node *firstGeqPhysical(Node *n, const TrivialSpan key) {
#define PRESERVE_NONE #define PRESERVE_NONE
#endif #endif
#if __has_attribute(musttail) && __has_attribute(preserve_none)
constexpr bool kEnableInterleaved = true;
#else
constexpr bool kEnableInterleaved = false;
#endif
namespace check { namespace check {
typedef PRESERVE_NONE void (*Continuation)(struct Job *, struct Context *); typedef PRESERVE_NONE void (*Continuation)(struct Job *, struct Context *);
@@ -4969,7 +4975,7 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
check::Context context; check::Context context;
context.readContext.impl = this; context.readContext.impl = this;
#if __has_attribute(musttail) if constexpr (kEnableInterleaved) {
if (count == 1) { if (count == 1) {
useSequential(reads, result, count, context); useSequential(reads, result, count, context);
} else { } else {
@@ -4995,8 +5001,8 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
inProgress[0].prev = inProgress + started - 1; inProgress[0].prev = inProgress + started - 1;
inProgress[started - 1].next = inProgress; inProgress[started - 1].next = inProgress;
// Kick off the sequence of tail calls that finally returns once all jobs // Kick off the sequence of tail calls that finally returns once all
// are done // jobs are done
inProgress->continuation(inProgress, &context); inProgress->continuation(inProgress, &context);
#ifndef NDEBUG #ifndef NDEBUG
@@ -5009,10 +5015,9 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
assert(context.readContext == context2.readContext); assert(context.readContext == context2.readContext);
#endif #endif
} }
} else {
#else
useSequential(reads, result, count, context); useSequential(reads, result, count, context);
#endif }
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
assert(reads[i].readVersion >= 0); assert(reads[i].readVersion >= 0);
@@ -5186,11 +5191,6 @@ struct __attribute__((visibility("hidden"))) ConflictSet::Impl {
assert(allPointWrites || sorted); assert(allPointWrites || sorted);
#endif #endif
#if __has_attribute(musttail)
constexpr bool kEnableInterleaved = true;
#else
constexpr bool kEnableInterleaved = false;
#endif
if (kEnableInterleaved && count > 1) { if (kEnableInterleaved && count > 1) {
interleavedWrites(writes, count, InternalVersionT(writeVersion)); interleavedWrites(writes, count, InternalVersionT(writeVersion));
} else { } else {