Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::vm::bitcode_writer::br_table_parser Struct Reference

#include <bitcode_writer.hpp>

Collaboration diagram for sysio::vm::bitcode_writer::br_table_parser:

Public Member Functions

 br_table_parser (bitcode_writer &base, uint32_t table_size)
 
uint32_temit_case (uint32_t depth_change)
 
uint32_temit_default (uint32_t depth_change)
 
 br_table_parser (const br_table_parser &)=delete
 
br_table_parseroperator= (const br_table_parser &)=delete
 
 br_table_parser (bitcode_writer &base, uint32_t table_size)
 
uint32_temit_case (uint32_t depth_change)
 
uint32_temit_default (uint32_t depth_change)
 
 br_table_parser (const br_table_parser &)=delete
 
br_table_parseroperator= (const br_table_parser &)=delete
 

Public Attributes

br_table_t::elem_t * _br_tab
 
bitcode_writer_this
 
std::size_t _i
 

Detailed Description

Definition at line 58 of file bitcode_writer.hpp.

Constructor & Destructor Documentation

◆ br_table_parser() [1/4]

sysio::vm::bitcode_writer::br_table_parser::br_table_parser ( bitcode_writer & base,
uint32_t table_size )
inline

Definition at line 59 of file bitcode_writer.hpp.

59 :
60 _this{ &base },
61 _i{ 0 } {
62 br_table_t& bt = _this->append_instr(br_table_t{});
63 bt.offset = static_cast<uint32_t>(((table_size * sizeof(br_table_t::elem_t))/sizeof(opcode))+2);
64
65 // point the branch table data to after the br_table instruction
66 _br_tab = bt.table = reinterpret_cast<br_table_t::elem_t*>(&_this->fb[_this->op_index]);
67
68 _this->op_index += bt.offset;
69
70 // canary to throw if we have overbounded our allocated memory
71 _this->fb[_this->op_index] = error_t{};
72 bt.size = table_size;
73 }
variant< > opcode
Definition opcodes.hpp:79
unsigned int uint32_t
Definition stdint.h:126
void bt(const Operand &op, const Reg &reg)
Here is the call graph for this function:

◆ br_table_parser() [2/4]

sysio::vm::bitcode_writer::br_table_parser::br_table_parser ( const br_table_parser & )
delete

◆ br_table_parser() [3/4]

sysio::vm::bitcode_writer::br_table_parser::br_table_parser ( bitcode_writer & base,
uint32_t table_size )
inline

Definition at line 59 of file bitcode_writer.hpp.

59 :
60 _this{ &base },
61 _i{ 0 } {
62 br_table_t& bt = _this->append_instr(br_table_t{});
63 bt.offset = static_cast<uint32_t>(((table_size * sizeof(br_table_t::elem_t))/sizeof(opcode))+2);
64
65 // point the branch table data to after the br_table instruction
66 _br_tab = bt.table = reinterpret_cast<br_table_t::elem_t*>(&_this->fb[_this->op_index]);
67
68 _this->op_index += bt.offset;
69
70 // canary to throw if we have overbounded our allocated memory
71 _this->fb[_this->op_index] = error_t{};
72 bt.size = table_size;
73 }
Here is the call graph for this function:

◆ br_table_parser() [4/4]

sysio::vm::bitcode_writer::br_table_parser::br_table_parser ( const br_table_parser & )
delete

Member Function Documentation

◆ emit_case() [1/2]

uint32_t * sysio::vm::bitcode_writer::br_table_parser::emit_case ( uint32_t depth_change)
inline

Definition at line 74 of file bitcode_writer.hpp.

74 {
75 auto& elem = _br_tab[_i++];
76 elem.stack_pop = depth_change;
77 return &elem.pc;
78 }
Here is the caller graph for this function:

◆ emit_case() [2/2]

uint32_t * sysio::vm::bitcode_writer::br_table_parser::emit_case ( uint32_t depth_change)
inline

Definition at line 74 of file bitcode_writer.hpp.

74 {
75 auto& elem = _br_tab[_i++];
76 elem.stack_pop = depth_change;
77 return &elem.pc;
78 }

◆ emit_default() [1/2]

uint32_t * sysio::vm::bitcode_writer::br_table_parser::emit_default ( uint32_t depth_change)
inline

Definition at line 80 of file bitcode_writer.hpp.

80 {
81 auto result = emit_case(depth_change);
82 SYS_VM_ASSERT(_this->fb[_this->op_index].is_a<error_t>(), wasm_parse_exception, "overwrote br_table data");
83 return result;
84 }
uint32_t * emit_case(uint32_t depth_change)
#define SYS_VM_ASSERT(expr, exc_type, msg)
Definition exceptions.hpp:8
Here is the call graph for this function:

◆ emit_default() [2/2]

uint32_t * sysio::vm::bitcode_writer::br_table_parser::emit_default ( uint32_t depth_change)
inline

Definition at line 80 of file bitcode_writer.hpp.

80 {
81 auto result = emit_case(depth_change);
82 SYS_VM_ASSERT(_this->fb[_this->op_index].is_a<error_t>(), wasm_parse_exception, "overwrote br_table data");
83 return result;
84 }
Here is the call graph for this function:

◆ operator=() [1/2]

br_table_parser & sysio::vm::bitcode_writer::br_table_parser::operator= ( const br_table_parser & )
delete

◆ operator=() [2/2]

br_table_parser & sysio::vm::bitcode_writer::br_table_parser::operator= ( const br_table_parser & )
delete

Member Data Documentation

◆ _br_tab

br_table_t::elem_t * sysio::vm::bitcode_writer::br_table_parser::_br_tab

Definition at line 85 of file bitcode_writer.hpp.

◆ _i

std::size_t sysio::vm::bitcode_writer::br_table_parser::_i

Definition at line 87 of file bitcode_writer.hpp.

◆ _this

bitcode_writer * sysio::vm::bitcode_writer::br_table_parser::_this

Definition at line 86 of file bitcode_writer.hpp.


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