|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <program_block.hpp>
Public Member Functions | |
| ProgramBlock ()=default | |
| void | process_instruction_block (InstructionBlock &instruction_block) |
| process the instruction block | |
| void | process_instruction (FuzzInstruction instruction) |
| process the instruction | |
| void | finalize_with_return (uint8_t return_size, MemoryTagWrapper return_value_tag, uint16_t return_value_offset_index) |
finalize the program block with a return instruction Tries to find memory address with the given return_value_tag, if there are no such address (zero variables of such tag are stored), it sets the return address to 0. Sets the terminator type to RETURN. | |
| void | finalize_with_revert (uint8_t revert_size, MemoryTagWrapper revert_value_tag, uint16_t revert_value_offset_index) |
| finalize the program block with a revert instruction Similar to finalize_with_return but uses REVERT opcode instead. Sets the terminator type to REVERT. | |
| void | finalize_with_jump (ProgramBlock *target_block, bool copy_memory_manager=true) |
| finalize the block with a jump Sets the terminator type to JUMP, adds the target block to the successors and the current block to the predecessors. | |
| void | finalize_with_jump_if (ProgramBlock *target_then_block, ProgramBlock *target_else_block, uint16_t condition_offset, bool copy_memory_manager=true) |
| finalize the block with a jump if Sets the terminator type to JUMP_IF, adds the target blocks to the successors and the current block to the predecessors. Sets the condition offset index. | |
| void | insert_internal_call (ProgramBlock *target_block) |
| insert INTERNALCALL instruction with 0 offset | |
| std::optional< uint16_t > | get_terminating_condition_value () |
| void | process_write_terminating_condition_value () |
| std::vector< bb::avm2::simulation::Instruction > | get_instructions () |
| bool | is_memory_address_set (uint16_t address) |
| void | patch_internal_calls () |
in insert_internal_call we insert INTERNALCALL instruction with 0 offset, because we don't know the resulting block offsets this method patches the INTERNALCALL instructions with the actual offset | |
Public Attributes | |
| std::vector< ProgramBlock * > | successors |
| std::vector< ProgramBlock * > | predecessors |
| ProgramBlock * | caller = nullptr |
| the block that called this block by INTERNALCALL This field is copied to predecessors on every CFG instructions | |
| TerminatorType | terminator_type = TerminatorType::NONE |
| int | offset = -1 |
Private Attributes | |
| MemoryManager | memory_manager |
| std::vector< bb::avm2::simulation::Instruction > | instructions |
| uint16_t | condition_offset_index = 0 |
| the offset index of the condition variable (for JUMP_IF) | |
| std::map< size_t, ProgramBlock * > | internal_call_instruction_indicies_to_patch |
Definition at line 41 of file program_block.hpp.
|
default |
| void ProgramBlock::finalize_with_jump | ( | ProgramBlock * | target_block, |
| bool | copy_memory_manager = true |
||
| ) |
finalize the block with a jump Sets the terminator type to JUMP, adds the target block to the successors and the current block to the predecessors.
Definition at line 1570 of file program_block.cpp.
| void ProgramBlock::finalize_with_jump_if | ( | ProgramBlock * | target_then_block, |
| ProgramBlock * | target_else_block, | ||
| uint16_t | condition_offset, | ||
| bool | copy_memory_manager = true |
||
| ) |
finalize the block with a jump if Sets the terminator type to JUMP_IF, adds the target blocks to the successors and the current block to the predecessors. Sets the condition offset index.
Definition at line 1581 of file program_block.cpp.
| void ProgramBlock::finalize_with_return | ( | uint8_t | return_size, |
| MemoryTagWrapper | return_value_tag, | ||
| uint16_t | return_value_offset_index | ||
| ) |
finalize the program block with a return instruction Tries to find memory address with the given return_value_tag, if there are no such address (zero variables of such tag are stored), it sets the return address to 0. Sets the terminator type to RETURN.
Definition at line 1506 of file program_block.cpp.
| void ProgramBlock::finalize_with_revert | ( | uint8_t | revert_size, |
| MemoryTagWrapper | revert_value_tag, | ||
| uint16_t | revert_value_offset_index | ||
| ) |
finalize the program block with a revert instruction Similar to finalize_with_return but uses REVERT opcode instead. Sets the terminator type to REVERT.
Definition at line 1542 of file program_block.cpp.
| std::vector< bb::avm2::simulation::Instruction > ProgramBlock::get_instructions | ( | ) |
Definition at line 1756 of file program_block.cpp.
| std::optional< uint16_t > ProgramBlock::get_terminating_condition_value | ( | ) |
Definition at line 1626 of file program_block.cpp.
| void ProgramBlock::insert_internal_call | ( | ProgramBlock * | target_block | ) |
insert INTERNALCALL instruction with 0 offset
Definition at line 1600 of file program_block.cpp.
| bool ProgramBlock::is_memory_address_set | ( | uint16_t | address | ) |
Definition at line 1644 of file program_block.cpp.
| void ProgramBlock::patch_internal_calls | ( | ) |
in insert_internal_call we insert INTERNALCALL instruction with 0 offset, because we don't know the resulting block offsets this method patches the INTERNALCALL instructions with the actual offset
Definition at line 1611 of file program_block.cpp.
|
private |
preprocess the memory addresses Sets M[0] = base_offset for Relative/IndirectRelative modes Sets M[pointer_address] = pointer_value for Indirect/IndirectRelative modes
Definition at line 12 of file program_block.cpp.
|
private |
Definition at line 538 of file program_block.cpp.
|
private |
Definition at line 53 of file program_block.cpp.
|
private |
Definition at line 735 of file program_block.cpp.
|
private |
Definition at line 215 of file program_block.cpp.
|
private |
Definition at line 1174 of file program_block.cpp.
|
private |
Definition at line 1101 of file program_block.cpp.
|
private |
Definition at line 904 of file program_block.cpp.
|
private |
Definition at line 881 of file program_block.cpp.
|
private |
Definition at line 1478 of file program_block.cpp.
|
private |
Definition at line 613 of file program_block.cpp.
|
private |
Definition at line 123 of file program_block.cpp.
|
private |
Definition at line 1295 of file program_block.cpp.
|
private |
Definition at line 1052 of file program_block.cpp.
|
private |
Definition at line 1006 of file program_block.cpp.
|
private |
Definition at line 1153 of file program_block.cpp.
|
private |
Definition at line 663 of file program_block.cpp.
|
private |
Definition at line 146 of file program_block.cpp.
|
private |
Definition at line 638 of file program_block.cpp.
|
private |
Definition at line 492 of file program_block.cpp.
|
private |
Definition at line 1252 of file program_block.cpp.
|
private |
Definition at line 981 of file program_block.cpp.
| void ProgramBlock::process_instruction | ( | FuzzInstruction | instruction | ) |
process the instruction
| instruction | the instruction to process Updates stored_variables if the instruction writes to memory Updates instructions with the instruction If arguments of the instruction are not in stored_variables, the instruction is skipped |
Definition at line 1661 of file program_block.cpp.
| void ProgramBlock::process_instruction_block | ( | InstructionBlock & | instruction_block | ) |
process the instruction block
| instruction_block | the instruction block to process |
Definition at line 1649 of file program_block.cpp.
|
private |
Definition at line 1365 of file program_block.cpp.
|
private |
Definition at line 1422 of file program_block.cpp.
|
private |
Definition at line 687 of file program_block.cpp.
|
private |
Definition at line 169 of file program_block.cpp.
|
private |
Definition at line 711 of file program_block.cpp.
|
private |
Definition at line 192 of file program_block.cpp.
|
private |
Definition at line 471 of file program_block.cpp.
|
private |
Definition at line 451 of file program_block.cpp.
|
private |
Definition at line 588 of file program_block.cpp.
|
private |
Definition at line 100 of file program_block.cpp.
|
private |
Definition at line 810 of file program_block.cpp.
|
private |
Definition at line 517 of file program_block.cpp.
|
private |
Definition at line 1075 of file program_block.cpp.
|
private |
Definition at line 1022 of file program_block.cpp.
|
private |
Definition at line 760 of file program_block.cpp.
|
private |
Definition at line 239 of file program_block.cpp.
|
private |
Definition at line 1338 of file program_block.cpp.
|
private |
Definition at line 1228 of file program_block.cpp.
|
private |
Definition at line 1211 of file program_block.cpp.
|
private |
Definition at line 1125 of file program_block.cpp.
|
private |
Definition at line 411 of file program_block.cpp.
|
private |
Definition at line 354 of file program_block.cpp.
|
private |
Definition at line 373 of file program_block.cpp.
|
private |
Definition at line 392 of file program_block.cpp.
|
private |
Definition at line 335 of file program_block.cpp.
|
private |
Definition at line 432 of file program_block.cpp.
|
private |
Definition at line 1392 of file program_block.cpp.
|
private |
Definition at line 831 of file program_block.cpp.
|
private |
Definition at line 287 of file program_block.cpp.
|
private |
Definition at line 856 of file program_block.cpp.
|
private |
Definition at line 311 of file program_block.cpp.
|
private |
Definition at line 951 of file program_block.cpp.
|
private |
Definition at line 927 of file program_block.cpp.
|
private |
Definition at line 563 of file program_block.cpp.
|
private |
Definition at line 77 of file program_block.cpp.
|
private |
Definition at line 1278 of file program_block.cpp.
|
private |
Definition at line 1445 of file program_block.cpp.
| void ProgramBlock::process_write_terminating_condition_value | ( | ) |
Definition at line 1635 of file program_block.cpp.
|
private |
Definition at line 785 of file program_block.cpp.
|
private |
Definition at line 263 of file program_block.cpp.
|
private |
Definition at line 38 of file program_block.cpp.
| ProgramBlock* ProgramBlock::caller = nullptr |
the block that called this block by INTERNALCALL This field is copied to predecessors on every CFG instructions
Definition at line 127 of file program_block.hpp.
|
private |
the offset index of the condition variable (for JUMP_IF)
Definition at line 47 of file program_block.hpp.
|
private |
Definition at line 44 of file program_block.hpp.
|
private |
Definition at line 52 of file program_block.hpp.
|
private |
Definition at line 43 of file program_block.hpp.
| int ProgramBlock::offset = -1 |
Definition at line 129 of file program_block.hpp.
| std::vector<ProgramBlock*> ProgramBlock::predecessors |
Definition at line 123 of file program_block.hpp.
| std::vector<ProgramBlock*> ProgramBlock::successors |
Definition at line 122 of file program_block.hpp.
| TerminatorType ProgramBlock::terminator_type = TerminatorType::NONE |
Definition at line 128 of file program_block.hpp.