Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions include/silk/util/bounded-queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,20 @@ class BoundedQueue

static_assert(sizeof(Slot) == CACHELINE_SIZE);

// Match offsets and stride used by src/gdb/fiber.py::_walk_bounded_queue
static_assert(offsetof(Slot, sequence) == 0);
static_assert(offsetof(Slot, value) == 8);

//
// State.
//

uint64_t mask;
std::unique_ptr<Slot[]> slots;

// src/gdb/fiber.py::_walk_bounded_queue reads enqueuePos at offset 64 and
// dequeuePos at offset 128 (mask=8 bytes, slots=8 bytes, then 2 x cacheline).
// Reordering or inserting fields here requires updating that script.
alignas(CACHELINE_SIZE) std::atomic<uint64_t> enqueuePos{};
alignas(CACHELINE_SIZE) std::atomic<uint64_t> dequeuePos{};
};
Expand Down
4 changes: 4 additions & 0 deletions include/silk/util/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class QueueBase

static_assert(sizeof(QueueNode) == CACHELINE_SIZE);

// Match offsets used by src/gdb/fiber.py::_walk_queue
static_assert(offsetof(QueueNode, next) == 8);
static_assert(offsetof(QueueNode, value) == 16);

static void initialize() noexcept;
static void destroy() noexcept;

Expand Down
Loading