17#ifdef CHECK_CIRCUIT_STACKTRACES
18#include <backward.hpp>
23#ifdef CHECK_CIRCUIT_STACKTRACES
24struct BbStackTrace : backward::StackTrace {
25 BbStackTrace() { load_here(32); }
29 void populate() { stack_traces.emplace_back(); }
30 void print(
size_t gate_idx)
const { backward::Printer{}.print(stack_traces.at(gate_idx)); }
32 bool operator==(
const StackTraces& other)
const
34 static_cast<void>(other);
80 virtual void resize(
size_t new_size) = 0;
98 virtual size_t size()
const = 0;
138 BB_ASSERT_EQ(
value, 0,
"Calling ZeroSelector::emplace_back with a non zero value.");
201 void set(
size_t idx,
int i)
override {
data[idx] = i; }
203 void resize(
size_t new_size)
override {
data.resize(new_size); }
210 size_t size()
const override {
return data.size(); }
229 using Wires = std::array<WireType, NUM_WIRES>;
239#ifdef CHECK_CIRCUIT_STACKTRACES
241 StackTraces stack_traces;
243#ifdef TRACY_HACK_GATES_AS_MEMORY
244 std::vector<size_t> allocated_gates;
248#ifdef TRACY_HACK_GATES_AS_MEMORY
252 allocated_gates.push_back(GLOBAL_GATE);
271 for (
auto& w :
wires) {
272 w.reserve(size_hint);
275 p.reserve(size_hint);
277#ifdef CHECK_CIRCUIT_STACKTRACES
278 stack_traces.stack_traces.reserve(size_hint);
284 return is_structured ?
fixed_size :
static_cast<uint32_t
>(
size());
287#ifdef TRACY_HACK_GATES_AS_MEMORY
291 for ([[maybe_unused]]
size_t gate : allocated_gates) {
292 if (!FREED_GATES.contains(gate)) {
294 FREED_GATES.insert(gate);
303 void populate_wires(
const uint32_t& idx_1,
const uint32_t& idx_2,
const uint32_t& idx_3,
const uint32_t& idx_4)
305#ifdef CHECK_CIRCUIT_STACKTRACES
306 this->stack_traces.populate();
309 this->wires[0].emplace_back(idx_1);
310 this->wires[1].emplace_back(idx_2);
311 this->wires[2].emplace_back(idx_3);
312 this->wires[3].emplace_back(idx_4);
#define BB_ASSERT_GT(left, right,...)
#define BB_ASSERT_EQ(actual, expected,...)
#define BB_ASSERT_LT(left, right,...)
#define ASSERT(expression,...)
Basic structure for storing gate data in a builder.
std::array< WireType, NUM_WIRES > Wires
ExecutionTraceBlock(ExecutionTraceBlock &&) noexcept=default
static constexpr size_t NUM_WIRES
bool operator==(const ExecutionTraceBlock &other) const =default
void reserve(size_t size_hint)
virtual ~ExecutionTraceBlock()=default
uint32_t trace_offset() const
ExecutionTraceBlock()=default
ExecutionTraceBlock & operator=(const ExecutionTraceBlock &)=default
void populate_wires(const uint32_t &idx_1, const uint32_t &idx_2, const uint32_t &idx_3, const uint32_t &idx_4)
virtual RefVector< Selector< FF > > get_selectors()=0
std::array< SlabVectorSelector< FF >, 6 > non_gate_selectors
SlabVector< uint32_t > WireType
ExecutionTraceBlock(const ExecutionTraceBlock &)=default
uint32_t get_fixed_size(bool is_structured=true) const
A template class for a reference vector. Behaves as if std::vector<T&> was possible.
Abstract interface for a generic selector.
virtual void resize(size_t new_size)=0
Resize the selector.
virtual size_t size() const =0
Get the number of elements.
virtual ~Selector()=default
virtual void emplace_back(int value)=0
Append an integer value to the selector.
virtual const FF & back() const =0
Get the last value in the selector.
Selector(Selector &&)=delete
virtual void set(size_t idx, int value)=0
Set the value at index using integer.
virtual bool empty() const =0
Check if the selector is empty.
virtual void push_back(const FF &value)=0
Push a field element to the selector.
Selector & operator=(const Selector &)=default
Selector & operator=(Selector &&)=delete
virtual void set(size_t idx, const FF &value)=0
Set the value at index using a field element.
virtual const FF & operator[](size_t index) const =0
Get value at specified index.
void emplace_back(const FF &value)
Append a field element to the selector.
virtual void set_back(int value)=0
Set the last value using integer.
Selector(const Selector &)=default
Selector backed by a slab allocator vector.
void push_back(const FF &value) override
Push a field element to the selector.
void set(size_t idx, const FF &value) override
Set the value at index using a field element.
void resize(size_t new_size) override
Resize the selector.
size_t size() const override
Get the number of elements.
void set_back(int value) override
Set the last value using integer.
bool operator==(const SlabVectorSelector &other) const
const FF & operator[](size_t i) const override
Get value at specified index.
void emplace_back(int i) override
Append an integer value to the selector.
const FF & back() const override
Get the last value in the selector.
void set(size_t idx, int i) override
Set the value at index using integer.
bool empty() const override
Check if the selector is empty.
Selector specialization that only allows zeros.
const FF & operator[](size_t index) const override
Get value at specified index.
void set(size_t idx, const FF &value) override
Set the value at index using a field element.
void emplace_back(int value) override
Append an integer value to the selector.
bool empty() const override
Check if the selector is empty.
bool operator==(const ZeroSelector &other) const
const FF & back() const override
Get the last value in the selector.
size_t size() const override
Get the number of elements.
void set(size_t idx, int value) override
Set the value at index using integer.
void push_back(const FF &value) override
Push a field element to the selector.
void set_back(int value) override
Set the last value using integer.
void resize(size_t new_size) override
Resize the selector.
#define TRACY_GATE_ALLOC(t)
#define TRACY_GATE_FREE(t)
bool operator==(ecdsa_signature const &lhs, ecdsa_signature const &rhs)
Entry point for Barretenberg command-line interface.
std::vector< T, bb::ContainerSlabAllocator< T > > SlabVector
A vector that uses the slab allocator.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
BB_INLINE constexpr bool is_zero() const noexcept