Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::avm2::simulation::InternalCallStackManager Class Reference

#include <internal_call_stack_manager.hpp>

Inheritance diagram for bb::avm2::simulation::InternalCallStackManager:
bb::avm2::simulation::InternalCallStackManagerInterface

Public Member Functions

 InternalCallStackManager (uint32_t context_id, EventEmitterInterface< InternalCallStackEvent > &emitter)
 
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. It pushes the caller_pc & return_pc to the stack. It also emits an internal call stack event.
 
PC pop () override
 Pop the top call from the internal call stack. This is called when an internal return is executed. It pops the top call from the stack and returns the stored return_pc. It also emits an internal call stack event.
 
InternalCallId get_next_call_id () const override
 Get the next call id.
 
InternalCallId get_call_id () const override
 Get the current call id.
 
InternalCallId get_return_call_id () const override
 Get the return call id.
 
std::vector< PCget_current_call_stack () const override
 Get the current call stack.
 
- Public Member Functions inherited from bb::avm2::simulation::InternalCallStackManagerInterface
virtual ~InternalCallStackManagerInterface ()=default
 

Private Attributes

InternalCallId next_call_id = 2
 
InternalCallId call_id = 1
 
InternalCallId return_call_id = 0
 
uint32_t context_id
 
std::vector< InternalCallPtrinternal_call_stack
 
EventEmitterInterface< InternalCallStackEvent > & internal_call_stack_events
 

Detailed Description

Definition at line 21 of file internal_call_stack_manager.hpp.

Constructor & Destructor Documentation

◆ InternalCallStackManager()

bb::avm2::simulation::InternalCallStackManager::InternalCallStackManager ( uint32_t  context_id,
EventEmitterInterface< InternalCallStackEvent > &  emitter 
)
inline

Definition at line 23 of file internal_call_stack_manager.hpp.

Member Function Documentation

◆ get_call_id()

InternalCallId bb::avm2::simulation::InternalCallStackManager::get_call_id ( ) const
overridevirtual

Get the current call id.

Returns
The current call id.

Implements bb::avm2::simulation::InternalCallStackManagerInterface.

Definition at line 77 of file internal_call_stack_manager.cpp.

◆ get_current_call_stack()

std::vector< PC > bb::avm2::simulation::InternalCallStackManager::get_current_call_stack ( ) const
overridevirtual

Get the current call stack.

Returns
The current call stack as a vector of caller PCs (not return PCs).

Implements bb::avm2::simulation::InternalCallStackManagerInterface.

Definition at line 97 of file internal_call_stack_manager.cpp.

◆ get_next_call_id()

InternalCallId bb::avm2::simulation::InternalCallStackManager::get_next_call_id ( ) const
overridevirtual

Get the next call id.

Returns
The next call id.

Implements bb::avm2::simulation::InternalCallStackManagerInterface.

Definition at line 67 of file internal_call_stack_manager.cpp.

◆ get_return_call_id()

InternalCallId bb::avm2::simulation::InternalCallStackManager::get_return_call_id ( ) const
overridevirtual

Get the return call id.

Returns
The return call id.

Implements bb::avm2::simulation::InternalCallStackManagerInterface.

Definition at line 87 of file internal_call_stack_manager.cpp.

◆ pop()

PC bb::avm2::simulation::InternalCallStackManager::pop ( )
overridevirtual

Pop the top call from the internal call stack. This is called when an internal return is executed. It pops the top call from the stack and returns the stored return_pc. It also emits an internal call stack event.

Returns
The program counter the caller will continue execution from.
Exceptions
InternalCallStackExceptionif the internal call stack is empty.

Implements bb::avm2::simulation::InternalCallStackManagerInterface.

Definition at line 44 of file internal_call_stack_manager.cpp.

◆ push()

void bb::avm2::simulation::InternalCallStackManager::push ( PC  caller_pc,
PC  return_pc 
)
overridevirtual

Push a new call onto the internal call stack. This is called when an internal call is executed. It pushes the caller_pc & return_pc to the stack. It also emits an internal call stack event.

Parameters
caller_pcThe program counter where the caller is.
return_pcThe program counter which will be returned to after the internal call is executed.

Implements bb::avm2::simulation::InternalCallStackManagerInterface.

Definition at line 16 of file internal_call_stack_manager.cpp.

Member Data Documentation

◆ call_id

InternalCallId bb::avm2::simulation::InternalCallStackManager::call_id = 1
private

Definition at line 37 of file internal_call_stack_manager.hpp.

◆ context_id

uint32_t bb::avm2::simulation::InternalCallStackManager::context_id
private

Definition at line 40 of file internal_call_stack_manager.hpp.

◆ internal_call_stack

std::vector<InternalCallPtr> bb::avm2::simulation::InternalCallStackManager::internal_call_stack
private

Definition at line 43 of file internal_call_stack_manager.hpp.

◆ internal_call_stack_events

EventEmitterInterface<InternalCallStackEvent>& bb::avm2::simulation::InternalCallStackManager::internal_call_stack_events
private

Definition at line 44 of file internal_call_stack_manager.hpp.

◆ next_call_id

InternalCallId bb::avm2::simulation::InternalCallStackManager::next_call_id = 2
private

Definition at line 36 of file internal_call_stack_manager.hpp.

◆ return_call_id

InternalCallId bb::avm2::simulation::InternalCallStackManager::return_call_id = 0
private

Definition at line 38 of file internal_call_stack_manager.hpp.


The documentation for this class was generated from the following files: