Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
internal_call_stack_manager.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <vector>
5
10
11namespace bb::avm2::simulation {
12
18
19// This contains the context_id due to circuit requirements similar to memory (i.e. it is used in the event emitter)
20// There might be a way to avoid this by emitting in the context / execution itself.
22 public:
27
28 void push(PC caller_pc, PC return_pc) override;
29 PC pop() override;
30 InternalCallId get_next_call_id() const override;
31 InternalCallId get_call_id() const override;
32 InternalCallId get_return_call_id() const override;
33 std::vector<PC> get_current_call_stack() const override;
34
35 private:
36 InternalCallId next_call_id = 2; // does not start at 0
37 InternalCallId call_id = 1; // does not start at 0
38 InternalCallId return_call_id = 0; // this is the return id of the current call
39
40 uint32_t context_id;
41
42 // NOTE: Using vector because we need iterators.
45};
46
61
62} // namespace bb::avm2::simulation
InternalCallId get_call_id() const override
Get the current call id.
void push(PC caller_pc, PC return_pc) override
Push a new call onto the internal call stack. This is called when an internal call is executed....
InternalCallId get_next_call_id() const override
Get the next call id.
EventEmitterInterface< InternalCallStackEvent > & internal_call_stack_events
InternalCallStackManager(uint32_t context_id, EventEmitterInterface< InternalCallStackEvent > &emitter)
InternalCallId get_return_call_id() const override
Get the return call id.
PC pop() override
Pop the top call from the internal call stack. This is called when an internal return is executed....
std::vector< PC > get_current_call_stack() const override
Get the current call stack.
InternalCallStackManagerProvider(EventEmitterInterface< InternalCallStackEvent > &event_emitter)
EventEmitterInterface< InternalCallStackEvent > & events
std::unique_ptr< InternalCallStackManagerInterface > make_internal_call_stack_manager(uint32_t context_id) override
EventEmitter< DataCopyEvent > event_emitter
uint32_t PC
uint32_t InternalCallId
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
uint32_t context_id