Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::vm Namespace Reference

Namespaces

namespace  detail
 

Classes

struct  activation_frame
 
struct  argument_proxy
 
struct  argument_proxy< span< T >, LegacyAlign >
 
struct  argument_proxy< T *, LegacyAlign >
 
class  backend
 
struct  base_visitor
 
class  binary_parser
 
class  bitcode_writer
 
class  bounded_allocator
 
class  contiguous_allocator
 
struct  data_segment
 
struct  debug_visitor
 
struct  debug_visitor2
 
struct  default_options
 
struct  elem_segment
 
struct  exception
 
class  execution_context
 
class  execution_context_base
 
struct  execution_interface
 
struct  export_entry
 
union  expr_value
 
class  fixed_stack_allocator
 
struct  frame_info_holder
 
struct  frame_info_holder< true >
 
struct  freestanding
 
struct  func_type
 
struct  function_body
 
struct  global_type
 
struct  global_variable
 
class  growable_allocator
 
struct  guarded_ptr
 
struct  host_func_pair_hash
 
struct  host_function
 
struct  import_entry
 
union  import_type
 
struct  indirect_name_assoc
 
struct  init_expr
 
struct  interpret_visitor
 
struct  interpreter
 
struct  invoke_on_all_t
 
class  jit_allocator
 
class  jit_execution_context
 
struct  jit_visitor
 
struct  local_entry
 
class  machine_code_writer
 
class  managed_vector
 
struct  maybe_void_t
 
class  memory_dump
 
struct  memory_dump_visitor
 
struct  memory_type
 
struct  module
 
struct  name_assoc
 
struct  name_section
 
union  native_value
 
struct  no_match_t
 
struct  null_backend
 
struct  null_debug_info
 
class  null_execution_context
 
struct  null_host_functions
 
class  null_watchdog
 
class  null_writer
 
struct  opcode_utils
 
class  operand_stack_elem
 
struct  options
 
struct  overloaded
 
struct  profile_data
 
class  profile_instr_map
 
struct  profile_manager
 
struct  registered_host_functions
 
struct  resizable_limits
 
struct  running_context
 
struct  scope_guard
 
class  scoped_profile
 
class  span
 
class  stack
 
class  stack_allocator
 
struct  sysio_options
 
struct  table_type
 
struct  tag
 
struct  type_converter
 
class  validator
 
class  variant
 
class  varint
 
class  varuint
 
class  wasm_allocator
 
class  watchdog
 Triggers a callback after a given time elapses. More...
 

Typedefs

template<auto FN>
using return_type_t = decltype(return_type(AUTO_PARAM_WORKAROUND(FN)))
 
template<auto FN>
using class_from_member_t = decltype(class_from_member(AUTO_PARAM_WORKAROUND(FN)))
 
template<auto FN>
using flatten_parameters_t = decltype(flatten_parameters(AUTO_PARAM_WORKAROUND(FN)))
 
template<auto FN>
using decayed_flatten_parameters_t = decltype(decayed_flatten_parameters(AUTO_PARAM_WORKAROUND(FN)))
 
template<std::size_t N, auto FN>
using parameter_at_t = decltype(parameter_at<N>(AUTO_PARAM_WORKAROUND(FN)))
 
template<std::size_t N, auto FN>
using parameters_from_t = decltype(parameters_from<N>(AUTO_PARAM_WORKAROUND(FN)))
 
typedef std::nullptr_t standalone_function_t
 
using host_func_pair = std::pair<std::string, std::string>
 
using opcode
 
typedef uint8_t value_type
 
typedef uint8_t block_type
 
typedef uint8_t elem_type
 
template<typename T >
using guarded_vector = managed_vector<T, growable_allocator>
 
using wasm_code = std::vector<uint8_t>
 
using wasm_code_ptr = guarded_ptr<uint8_t>
 
typedef std::uint32_t wasm_ptr_t
 
typedef std::uint32_t wasm_size_t
 
template<typename Tuple >
using generate_all_subtuples_t = decltype(detail::generate_all_subtuples(std::declval<Tuple>()))
 
template<typename Tuple >
using tuple_sort_t = decltype(detail::tuple_sort<std::tuple_size_v<Tuple>-1, 0, Tuple, std::tuple<>>())
 
template<size_t N, typename Tuple >
using tuple_trim_t = typename detail::tuple_trim<N, 0, Tuple>::type
 
template<typename T >
using unmanaged_vector = std::vector<T>
 
using operand_stack = stack<operand_stack_elem, constants::initial_stack_size>
 
using call_stack = stack<activation_frame, constants::max_call_depth + 1, bounded_allocator>
 

Enumerations

enum  constants {
  magic = 0x6D736100 , version = 0x1 , magic_size = sizeof(uint32_t) , version_size = sizeof(uint32_t) ,
  id_size = sizeof(uint8_t) , varuint32_size = 5 , max_call_depth = 250 , initial_stack_size = 8*1024 ,
  initial_module_size = 1 * 1024 * 1024 , max_memory = 4ull << 31 , max_useable_memory = (1ull << 32) , page_size = 64ull * 1024 ,
  max_pages = (max_useable_memory/page_size) , magic = 0x6D736100 , version = 0x1 , magic_size = sizeof(uint32_t) ,
  version_size = sizeof(uint32_t) , id_size = sizeof(uint8_t) , varuint32_size = 5 , max_call_depth = 250 ,
  initial_stack_size = 8*1024 , initial_module_size = 1 * 1024 * 1024 , max_memory = 4ull << 31 , max_useable_memory = (1ull << 32) ,
  page_size = 64ull * 1024 , max_pages = (max_useable_memory/page_size)
}
 
enum  opcodes
 
enum  imm_types {
  none , block_imm , varuint32_imm , br_table_imm ,
  none , block_imm , varuint32_imm , br_table_imm
}
 
enum class  max_func_local_bytes_flags_t {
  params = 1 , locals = 2 , stack = 4 , params = 1 ,
  locals = 2 , stack = 4
}
 
enum  section_id {
  custom_section = 0 , type_section = 1 , import_section = 2 , function_section = 3 ,
  table_section = 4 , memory_section = 5 , global_section = 6 , export_section = 7 ,
  start_section = 8 , element_section = 9 , code_section = 10 , data_section = 11 ,
  num_of_elems , custom_section = 0 , type_section = 1 , import_section = 2 ,
  function_section = 3 , table_section = 4 , memory_section = 5 , global_section = 6 ,
  export_section = 7 , start_section = 8 , element_section = 9 , code_section = 10 ,
  data_section = 11 , num_of_elems
}
 
enum  types {
  i32 = 0x7f , i64 = 0x7e , f32 = 0x7d , f64 = 0x7c ,
  anyfunc = 0x70 , func = 0x60 , pseudo = 0x40 , ret_void ,
  i32 = 0x7f , i64 = 0x7e , f32 = 0x7d , f64 = 0x7c ,
  anyfunc = 0x70 , func = 0x60 , pseudo = 0x40 , ret_void
}
 
enum  external_kind {
  Function = 0 , Table = 1 , Memory = 2 , Global = 3 ,
  Function = 0 , Table = 1 , Memory = 2 , Global = 3
}
 
enum  constants {
  magic = 0x6D736100 , version = 0x1 , magic_size = sizeof(uint32_t) , version_size = sizeof(uint32_t) ,
  id_size = sizeof(uint8_t) , varuint32_size = 5 , max_call_depth = 250 , initial_stack_size = 8*1024 ,
  initial_module_size = 1 * 1024 * 1024 , max_memory = 4ull << 31 , max_useable_memory = (1ull << 32) , page_size = 64ull * 1024 ,
  max_pages = (max_useable_memory/page_size) , magic = 0x6D736100 , version = 0x1 , magic_size = sizeof(uint32_t) ,
  version_size = sizeof(uint32_t) , id_size = sizeof(uint8_t) , varuint32_size = 5 , max_call_depth = 250 ,
  initial_stack_size = 8*1024 , initial_module_size = 1 * 1024 * 1024 , max_memory = 4ull << 31 , max_useable_memory = (1ull << 32) ,
  page_size = 64ull * 1024 , max_pages = (max_useable_memory/page_size)
}
 
enum  opcodes
 
enum  imm_types {
  none , block_imm , varuint32_imm , br_table_imm ,
  none , block_imm , varuint32_imm , br_table_imm
}
 
enum class  max_func_local_bytes_flags_t {
  params = 1 , locals = 2 , stack = 4 , params = 1 ,
  locals = 2 , stack = 4
}
 
enum  section_id {
  custom_section = 0 , type_section = 1 , import_section = 2 , function_section = 3 ,
  table_section = 4 , memory_section = 5 , global_section = 6 , export_section = 7 ,
  start_section = 8 , element_section = 9 , code_section = 10 , data_section = 11 ,
  num_of_elems , custom_section = 0 , type_section = 1 , import_section = 2 ,
  function_section = 3 , table_section = 4 , memory_section = 5 , global_section = 6 ,
  export_section = 7 , start_section = 8 , element_section = 9 , code_section = 10 ,
  data_section = 11 , num_of_elems
}
 
enum  types {
  i32 = 0x7f , i64 = 0x7e , f32 = 0x7d , f64 = 0x7c ,
  anyfunc = 0x70 , func = 0x60 , pseudo = 0x40 , ret_void ,
  i32 = 0x7f , i64 = 0x7e , f32 = 0x7d , f64 = 0x7c ,
  anyfunc = 0x70 , func = 0x60 , pseudo = 0x40 , ret_void
}
 
enum  external_kind {
  Function = 0 , Table = 1 , Memory = 2 , Global = 3 ,
  Function = 0 , Table = 1 , Memory = 2 , Global = 3
}
 

Functions

template<typename F >
constexpr bool is_callable (F &&fn)
 
template<typename R , typename... Args>
constexpr bool is_function (R(*)(Args...))
 
template<typename F >
constexpr bool is_function (F &&)
 
template<typename R , typename Cls , typename... Args>
constexpr bool is_member_function (R(Cls::*)(Args...))
 
template<typename R , typename Cls , typename... Args>
constexpr bool is_member_function (R(Cls::*)(Args...)&)
 
template<typename R , typename Cls , typename... Args>
constexpr bool is_member_function (R(Cls::*)(Args...)&&)
 
template<typename R , typename Cls , typename... Args>
constexpr bool is_member_function (R(Cls::*)(Args...) const &)
 
template<typename R , typename Cls , typename... Args>
constexpr bool is_member_function (R(Cls::*)(Args...) const &&)
 
template<typename F >
constexpr bool is_member_function (F &&)
 
template<typename F >
constexpr bool is_class (F &&)
 
template<typename F >
constexpr auto return_type (F &&fn) -> std::tuple_element_t< 0, detail::get_types_t< false, F > >
 
template<typename F >
constexpr auto class_from_member (F &&fn) -> std::tuple_element_t< 1, detail::get_types_t< false, F > >
 
template<typename F >
constexpr auto flatten_parameters (F &&fn) -> std::tuple_element_t< 2, detail::get_types_t< false, F > >
 
template<typename F >
constexpr auto decayed_flatten_parameters (F &&fn) -> std::tuple_element_t< 2, detail::get_types_t< true, F > >
 
template<std::size_t N, typename F >
constexpr auto parameter_at (F &&fn) -> std::tuple_element_t< N, decltype(flatten_parameters(std::declval< F >()))>
 
template<std::size_t N, typename F >
constexpr auto parameters_from (F &&fn) -> detail::parameters_from_impl_t< N, F >
 
template<bool Once, typename T , typename F , typename... Args>
void invoke_on (F &&func, const Args &... args)
 
template<auto F, typename Preconditions , typename Type_Converter , typename Host , typename... Args>
decltype(auto) invoke_impl (Type_Converter &tc, Host *host, Args &&... args)
 
template<auto F, typename Preconditions , typename Host , typename Args , typename Type_Converter , std::size_t... Is>
decltype(auto) invoke_with_host_impl (Type_Converter &tc, Host *host, Args &&args, std::index_sequence< Is... >)
 
template<auto F, typename Preconditions , typename Args , typename Type_Converter , typename Host , std::size_t... Is>
decltype(auto) invoke_with_host (Type_Converter &tc, Host *host, std::index_sequence< Is... >)
 
template<typename Type_Converter , typename T >
void maybe_push_result (Type_Converter &tc, T &&res, std::size_t trim_amt)
 
template<typename Cls , auto F, typename Preconditions , typename R , typename Args , typename Type_Converter , size_t... Is>
auto create_function (std::index_sequence< Is... >)
 
template<typename T >
auto to_wasm_type ()
 
template<>
constexpr auto to_wasm_type< i32_const_t > ()
 
template<>
constexpr auto to_wasm_type< i64_const_t > ()
 
template<>
constexpr auto to_wasm_type< f32_const_t > ()
 
template<>
constexpr auto to_wasm_type< f64_const_t > ()
 
bool operator== (const host_function &lhs, const func_type &rhs)
 
bool operator== (const func_type &lhs, const host_function &rhs)
 
template<typename TC , typename Args , std::size_t... Is>
void get_args (value_type *&out, std::index_sequence< Is... >)
 
template<typename Type_Converter , typename T >
void get_args (value_type *&out)
 
template<size_t N>
size_t constexpr bytes_needed ()
 
constexpr max_func_local_bytes_flags_t operator| (max_func_local_bytes_flags_t lhs, max_func_local_bytes_flags_t rhs)
 
constexpr max_func_local_bytes_flags_t operator& (max_func_local_bytes_flags_t lhs, max_func_local_bytes_flags_t rhs)
 
void profile_handler (int sig, siginfo_t *info, void *)
 
void register_profile_signal_handler_impl ()
 
void register_profile_signal_handler ()
 
void set_profile_interval_us (uint32_t value)
 
void signal_handler (int sig, siginfo_t *info, void *uap)
 
template<typename F >
void longjmp_on_exception (F &&f)
 
template<typename E >
void throw_ (const char *msg)
 
void setup_signal_handler_impl ()
 
void setup_signal_handler ()
 
template<typename F , typename E >
auto invoke_with_signal_handler (F &&f, E &&e)
 
bool operator== (const func_type &lhs, const func_type &rhs)
 
std::vector< uint8_tread_wasm (const std::string &fname)
 
template<typename StackElem >
void print_result (const std::optional< StackElem > &result)
 
template<class... Ts>
 overloaded (Ts...) -> overloaded< Ts... >
 
template<typename... T>
void ignore_unused_variable_warning (T &...)
 
template<class Visitor , typename Variant >
constexpr auto visit (Visitor &&vis, Variant &&var)
 
template<typename T >
std::string vector_to_string (T &&vec)
 
template<>
constexpr auto to_wasm_type< i32_const_t > ()
 
template<>
constexpr auto to_wasm_type< i64_const_t > ()
 
template<>
constexpr auto to_wasm_type< f32_const_t > ()
 
template<>
constexpr auto to_wasm_type< f64_const_t > ()
 
template<typename T , std::size_t Extent>
bool operator== (const span< T, Extent > &lhs, const span< T, Extent > &rhs)
 

Variables

constexpr bool should_align_memory_ops = false
 
constexpr bool use_softfloat = false
 
constexpr bool eos_vm_debug = false
 
constexpr bool eos_vm_amd64 = false
 
template<typename TC , typename T >
constexpr auto to_wasm_type_v = to_wasm_type<decltype(detail::resolve_result(std::declval<TC&>(), std::declval<T>()))>()
 
template<typename TC >
constexpr auto to_wasm_type_v< TC, void > = types::ret_void
 
template<typename Type_Converter , typename Ret , typename Args , std::size_t... Is>
host_function function_types_provider (std::index_sequence< Is... >)
 
uint32_t profile_interval_us = 10000
 
template<int Sig>
__attribute__((visibility("default"))) inline thread_local std __attribute__((visibility("default"))) inline thread_local std struct sigaction prev_signal_handler
 
maybe_void_t maybe_void
 

Typedef Documentation

◆ block_type

Definition at line 25 of file types.hpp.

◆ call_stack

typedef stack< activation_frame, constants::max_call_depth+1, bounded_allocator > sysio::vm::call_stack = stack<activation_frame, constants::max_call_depth + 1, bounded_allocator>

Definition at line 74 of file wasm_stack.hpp.

◆ class_from_member_t

Definition at line 203 of file function_traits.hpp.

◆ decayed_flatten_parameters_t

Definition at line 215 of file function_traits.hpp.

◆ elem_type

Definition at line 26 of file types.hpp.

◆ flatten_parameters_t

Definition at line 209 of file function_traits.hpp.

◆ generate_all_subtuples_t

template<typename Tuple >
using sysio::vm::generate_all_subtuples_t = decltype(detail::generate_all_subtuples(std::declval<Tuple>()))

Definition at line 248 of file utils.hpp.

◆ guarded_vector

Definition at line 29 of file types.hpp.

◆ host_func_pair

typedef std::pair< std::string, std::string > sysio::vm::host_func_pair = std::pair<std::string, std::string>

Definition at line 409 of file host_function.hpp.

◆ opcode

Initial value:
variant<
>

Definition at line 79 of file opcodes.hpp.

◆ operand_stack

typedef stack< operand_stack_elem, constants::initial_stack_size > sysio::vm::operand_stack = stack<operand_stack_elem, constants::initial_stack_size>

Definition at line 73 of file wasm_stack.hpp.

◆ parameter_at_t

template<std::size_t N, auto FN>
using sysio::vm::parameter_at_t = decltype(parameter_at<N>(AUTO_PARAM_WORKAROUND(FN)))

Definition at line 222 of file function_traits.hpp.

◆ parameters_from_t

template<std::size_t N, auto FN>
using sysio::vm::parameters_from_t = decltype(parameters_from<N>(AUTO_PARAM_WORKAROUND(FN)))

Definition at line 228 of file function_traits.hpp.

◆ return_type_t

template<auto FN>
using sysio::vm::return_type_t = decltype(return_type(AUTO_PARAM_WORKAROUND(FN)))

Definition at line 197 of file function_traits.hpp.

◆ standalone_function_t

typedef std::nullptr_t sysio::vm::standalone_function_t

Definition at line 26 of file host_function.hpp.

◆ tuple_sort_t

template<typename Tuple >
using sysio::vm::tuple_sort_t = decltype(detail::tuple_sort<std::tuple_size_v<Tuple>-1, 0, Tuple, std::tuple<>>())

Definition at line 252 of file utils.hpp.

◆ tuple_trim_t

template<size_t N, typename Tuple >
using sysio::vm::tuple_trim_t = typename detail::tuple_trim<N, 0, Tuple>::type

Definition at line 255 of file utils.hpp.

◆ unmanaged_vector

template<typename T >
using sysio::vm::unmanaged_vector = std::vector<T>

Definition at line 108 of file vector.hpp.

◆ value_type

Definition at line 24 of file types.hpp.

◆ wasm_code

typedef std::vector< uint8_t > sysio::vm::wasm_code = std::vector<uint8_t>

Definition at line 147 of file types.hpp.

◆ wasm_code_ptr

Definition at line 148 of file types.hpp.

◆ wasm_ptr_t

typedef std::uint32_t sysio::vm::wasm_ptr_t

Definition at line 149 of file types.hpp.

◆ wasm_size_t

typedef std::uint32_t sysio::vm::wasm_size_t

Definition at line 150 of file types.hpp.

Enumeration Type Documentation

◆ constants [1/2]

Enumerator
magic 
version 
magic_size 
version_size 
id_size 
varuint32_size 
max_call_depth 
initial_stack_size 
initial_module_size 
max_memory 
max_useable_memory 
page_size 
max_pages 
magic 
version 
magic_size 
version_size 
id_size 
varuint32_size 
max_call_depth 
initial_stack_size 
initial_module_size 
max_memory 
max_useable_memory 
page_size 
max_pages 

Definition at line 5 of file constants.hpp.

5 {
6 magic = 0x6D736100,
7 version = 0x1,
8 magic_size = sizeof(uint32_t),
9 version_size = sizeof(uint32_t),
10 id_size = sizeof(uint8_t),
11 varuint32_size = 5,
12 max_call_depth = 250,
13 initial_stack_size = 8*1024,
14 initial_module_size = 1 * 1024 * 1024,
15 max_memory = 4ull << 31,
16 max_useable_memory = (1ull << 32), //4GiB
17 page_size = 64ull * 1024, //64kb
19 };
@ max_useable_memory
Definition constants.hpp:16
unsigned int uint32_t
Definition stdint.h:126
unsigned char uint8_t
Definition stdint.h:124

◆ constants [2/2]

Enumerator
magic 
version 
magic_size 
version_size 
id_size 
varuint32_size 
max_call_depth 
initial_stack_size 
initial_module_size 
max_memory 
max_useable_memory 
page_size 
max_pages 
magic 
version 
magic_size 
version_size 
id_size 
varuint32_size 
max_call_depth 
initial_stack_size 
initial_module_size 
max_memory 
max_useable_memory 
page_size 
max_pages 

Definition at line 5 of file constants.hpp.

5 {
6 magic = 0x6D736100,
7 version = 0x1,
8 magic_size = sizeof(uint32_t),
9 version_size = sizeof(uint32_t),
10 id_size = sizeof(uint8_t),
11 varuint32_size = 5,
12 max_call_depth = 250,
13 initial_stack_size = 8*1024,
14 initial_module_size = 1 * 1024 * 1024,
15 max_memory = 4ull << 31,
16 max_useable_memory = (1ull << 32), //4GiB
17 page_size = 64ull * 1024, //64kb
19 };

◆ external_kind [1/2]

Enumerator
Function 
Table 
Memory 
Global 
Function 
Table 
Memory 
Global 

Definition at line 22 of file types.hpp.

22{ Function = 0, Table = 1, Memory = 2, Global = 3 };
@ Function
Definition types.hpp:22

◆ external_kind [2/2]

Enumerator
Function 
Table 
Memory 
Global 
Function 
Table 
Memory 
Global 

Definition at line 22 of file types.hpp.

22{ Function = 0, Table = 1, Memory = 2, Global = 3 };

◆ imm_types [1/2]

Enumerator
none 
block_imm 
varuint32_imm 
br_table_imm 
none 
block_imm 
varuint32_imm 
br_table_imm 

Definition at line 52 of file opcodes.hpp.

52 {
53 none,
57 };
@ br_table_imm
Definition opcodes.hpp:56
@ varuint32_imm
Definition opcodes.hpp:55

◆ imm_types [2/2]

Enumerator
none 
block_imm 
varuint32_imm 
br_table_imm 
none 
block_imm 
varuint32_imm 
br_table_imm 

Definition at line 52 of file opcodes.hpp.

52 {
53 none,
57 };

◆ max_func_local_bytes_flags_t [1/2]

Enumerator
params 
locals 
stack 
params 
locals 
stack 

Definition at line 7 of file options.hpp.

◆ max_func_local_bytes_flags_t [2/2]

Enumerator
params 
locals 
stack 
params 
locals 
stack 

Definition at line 7 of file options.hpp.

7 {
8 params = 1,
9 locals = 2,
10 stack = 4
11};

◆ opcodes [1/2]

Definition at line 8 of file opcodes.hpp.

8 {
27 };
#define SYS_VM_F64_CONSTANT_OPS(opcode_macro)
#define SYS_VM_RETURN_OP(opcode_macro)
#define SYS_VM_EXIT_OP(opcode_macro)
#define SYS_VM_COMPARISON_OPS(opcode_macro)
#define SYS_VM_MEMORY_OPS(opcode_macro)
#define SYS_VM_I64_CONSTANT_OPS(opcode_macro)
#define SYS_VM_I32_CONSTANT_OPS(opcode_macro)
#define SYS_VM_CALL_OPS(opcode_macro)
#define SYS_VM_NUMERIC_OPS(opcode_macro)
#define SYS_VM_CONVERSION_OPS(opcode_macro)
#define SYS_VM_VARIABLE_ACCESS_OPS(opcode_macro)
#define SYS_VM_EMPTY_OPS(opcode_macro)
#define SYS_VM_CALL_IMM_OPS(opcode_macro)
#define SYS_VM_CONTROL_FLOW_OPS(opcode_macro)
#define SYS_VM_ERROR_OPS(opcode_macro)
#define SYS_VM_CREATE_ENUM(name, code)
#define SYS_VM_PARAMETRIC_OPS(opcode_macro)
#define SYS_VM_F32_CONSTANT_OPS(opcode_macro)
#define SYS_VM_BR_TABLE_OP(opcode_macro)

◆ opcodes [2/2]

◆ section_id [1/2]

Enumerator
custom_section 
type_section 
import_section 
function_section 
table_section 
memory_section 
global_section 
export_section 
start_section 
element_section 
code_section 
data_section 
num_of_elems 
custom_section 
type_section 
import_section 
function_section 
table_section 
memory_section 
global_section 
export_section 
start_section 
element_section 
code_section 
data_section 
num_of_elems 

Definition at line 4 of file sections.hpp.

4 {
6 type_section = 1,
13 start_section = 8,
15 code_section = 10,
16 data_section = 11,
18 };
@ table_section
Definition sections.hpp:9
@ element_section
Definition sections.hpp:14
@ memory_section
Definition sections.hpp:10
@ global_section
Definition sections.hpp:11
@ function_section
Definition sections.hpp:8
@ type_section
Definition sections.hpp:6
@ start_section
Definition sections.hpp:13
@ export_section
Definition sections.hpp:12
@ import_section
Definition sections.hpp:7
@ custom_section
Definition sections.hpp:5

◆ section_id [2/2]

Enumerator
custom_section 
type_section 
import_section 
function_section 
table_section 
memory_section 
global_section 
export_section 
start_section 
element_section 
code_section 
data_section 
num_of_elems 
custom_section 
type_section 
import_section 
function_section 
table_section 
memory_section 
global_section 
export_section 
start_section 
element_section 
code_section 
data_section 
num_of_elems 

Definition at line 4 of file sections.hpp.

4 {
6 type_section = 1,
13 start_section = 8,
15 code_section = 10,
16 data_section = 11,
18 };

◆ types [1/2]

Enumerator
i32 
i64 
f32 
f64 
anyfunc 
func 
pseudo 
ret_void 
i32 
i64 
f32 
f64 
anyfunc 
func 
pseudo 
ret_void 

Definition at line 20 of file types.hpp.

20{ i32 = 0x7f, i64 = 0x7e, f32 = 0x7d, f64 = 0x7c, anyfunc = 0x70, func = 0x60, pseudo = 0x40, ret_void };
@ ret_void
Definition types.hpp:20
@ anyfunc
Definition types.hpp:20

◆ types [2/2]

Enumerator
i32 
i64 
f32 
f64 
anyfunc 
func 
pseudo 
ret_void 
i32 
i64 
f32 
f64 
anyfunc 
func 
pseudo 
ret_void 

Definition at line 20 of file types.hpp.

20{ i32 = 0x7f, i64 = 0x7e, f32 = 0x7d, f64 = 0x7c, anyfunc = 0x70, func = 0x60, pseudo = 0x40, ret_void };

Function Documentation

◆ bytes_needed()

template<size_t N>
size_t constexpr sysio::vm::bytes_needed ( )
inlineconstexpr

Definition at line 14 of file leb128.hpp.

14 {
15 if constexpr (N == 1 || N == 7)
16 return 1;
17 else if constexpr (N == 32)
18 return 5;
19 else
20 return 10;
21 }
const int N
Definition quantize.cpp:54
Here is the caller graph for this function:

◆ class_from_member()

template<typename F >
auto sysio::vm::class_from_member ( F && fn) -> std::tuple_element_t< 1, detail::get_types_t< false, F > >
constexpr

◆ create_function()

template<typename Cls , auto F, typename Preconditions , typename R , typename Args , typename Type_Converter , size_t... Is>
auto sysio::vm::create_function ( std::index_sequence< Is... > )

Definition at line 335 of file host_function.hpp.

335 {
336 return std::function<void(Cls*, Type_Converter& )>{ [](Cls* self, Type_Converter& tc) {
337 maybe_push_result(tc, (invoke_with_host<F, Preconditions, Args>(tc, self, std::index_sequence<Is...>{}), maybe_void),
338 detail::total_operands_v<Args, Type_Converter>);
339 }
340 };
341 }
void maybe_push_result(Type_Converter &tc, T &&res, std::size_t trim_amt)
@ self
the connection is to itself
Definition protocol.hpp:48
Here is the call graph for this function:
Here is the caller graph for this function:

◆ decayed_flatten_parameters()

template<typename F >
auto sysio::vm::decayed_flatten_parameters ( F && fn) -> std::tuple_element_t< 2, detail::get_types_t< true, F > >
constexpr

◆ flatten_parameters()

template<typename F >
auto sysio::vm::flatten_parameters ( F && fn) -> std::tuple_element_t< 2, detail::get_types_t< false, F > >
constexpr

◆ get_args() [1/2]

template<typename Type_Converter , typename T >
void sysio::vm::get_args ( value_type *& out)

Definition at line 380 of file host_function.hpp.

380 {
381 if constexpr (detail::has_from_wasm_v<T, Type_Converter>) {
383 get_args<Type_Converter, args_tuple>(out, std::make_index_sequence<std::tuple_size_v<args_tuple>>());
384 } else {
385 *out++ = to_wasm_type_v<Type_Converter, T>;
386 }
387 }
strip_tag< flatten_parameters_t<&TC::template from_wasm< T > > > from_wasm_type_deducer_t
Here is the call graph for this function:

◆ get_args() [2/2]

template<typename TC , typename Args , std::size_t... Is>
void sysio::vm::get_args ( value_type *& out,
std::index_sequence< Is... >  )

Definition at line 375 of file host_function.hpp.

375 {
376 ((*out++ = to_wasm_type_v<TC, std::tuple_element_t<Is, Args>>), ...);
377 }
Here is the caller graph for this function:

◆ ignore_unused_variable_warning()

template<typename... T>
void sysio::vm::ignore_unused_variable_warning ( T & ...)

Definition at line 101 of file utils.hpp.

101{}
Here is the caller graph for this function:

◆ invoke_impl()

template<auto F, typename Preconditions , typename Type_Converter , typename Host , typename... Args>
decltype(auto) sysio::vm::invoke_impl ( Type_Converter & tc,
Host * host,
Args &&... args )

Definition at line 305 of file host_function.hpp.

305 {
306 if constexpr (std::is_same_v<Host, standalone_function_t>)
307 return std::invoke(F, static_cast<Args&&>(args)...);
308 else
309 return std::invoke(F, host, static_cast<Args&&>(args)...);
310 }
Here is the caller graph for this function:

◆ invoke_on()

template<bool Once, typename T , typename F , typename... Args>
void sysio::vm::invoke_on ( F && func,
const Args &... args )

Definition at line 283 of file host_function.hpp.

283 {
284 detail::invoke_on_impl<Once, 0, T>(static_cast<F&&>(func), args...);
285 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ invoke_with_host()

template<auto F, typename Preconditions , typename Args , typename Type_Converter , typename Host , std::size_t... Is>
decltype(auto) sysio::vm::invoke_with_host ( Type_Converter & tc,
Host * host,
std::index_sequence< Is... >  )

Definition at line 319 of file host_function.hpp.

319 {
320 constexpr std::size_t args_size = std::tuple_size_v<decltype(detail::get_values<Args, 0, 0>(tc))>;
321 return invoke_with_host_impl<F, Preconditions>(tc, host, detail::get_values<Args, 0, 0>(tc), std::make_index_sequence<args_size>{});
322 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ invoke_with_host_impl()

template<auto F, typename Preconditions , typename Host , typename Args , typename Type_Converter , std::size_t... Is>
decltype(auto) sysio::vm::invoke_with_host_impl ( Type_Converter & tc,
Host * host,
Args && args,
std::index_sequence< Is... >  )

Definition at line 313 of file host_function.hpp.

313 {
314 detail::preconditions_runner<0, Preconditions>(tc, args);
315 return invoke_impl<F, Preconditions>(tc, host, std::get<Is>(static_cast<Args&&>(args))...);
316 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ invoke_with_signal_handler()

template<typename F , typename E >
auto sysio::vm::invoke_with_signal_handler ( F && f,
E && e )

Call a function with a signal handler installed. If this thread is signalled during the execution of f, the function e will be called with the signal number as an argument. If f creates any automatic variables with non-trivial destructors, then it must mask the relevant signals during the lifetime of these objects or the behavior is undefined.

signals handled: SIGSEGV, SIGBUS, SIGFPE

Definition at line 123 of file signals.hpp.

123 {
125 sigjmp_buf dest;
126 sigjmp_buf* volatile old_signal_handler = nullptr;
127 int sig;
128 if((sig = sigsetjmp(dest, 1)) == 0) {
129 // Note: Cannot use RAII, as non-trivial destructors w/ longjmp
130 // have undefined behavior. [csetjmp.syn]
131 //
132 // Warning: The order of operations is critical here.
133 // We also have to register signal_dest before unblocking
134 // signals to make sure that only our signal handler is executed
135 // if the caller has previously blocked signals.
136 old_signal_handler = std::atomic_exchange(&signal_dest, &dest);
137 sigset_t unblock_mask, old_sigmask; // Might not be preserved across longjmp
138 sigemptyset(&unblock_mask);
139 sigaddset(&unblock_mask, SIGSEGV);
140 sigaddset(&unblock_mask, SIGBUS);
141 sigaddset(&unblock_mask, SIGFPE);
142 sigaddset(&unblock_mask, SIGPROF);
143 pthread_sigmask(SIG_UNBLOCK, &unblock_mask, &old_sigmask);
144 try {
145 f();
146 pthread_sigmask(SIG_SETMASK, &old_sigmask, nullptr);
147 std::atomic_store(&signal_dest, old_signal_handler);
148 } catch(...) {
149 pthread_sigmask(SIG_SETMASK, &old_sigmask, nullptr);
150 std::atomic_store(&signal_dest, old_signal_handler);
151 throw;
152 }
153 } else {
154 std::atomic_store(&signal_dest, old_signal_handler);
155 if (sig == -1) {
156 std::exception_ptr exception = std::move(saved_exception);
157 saved_exception = nullptr;
158 std::rethrow_exception(exception);
159 } else {
160 e(sig);
161 }
162 }
163 }
void setup_signal_handler()
Definition signals.hpp:105
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_callable()

template<typename F >
bool sysio::vm::is_callable ( F && fn)
constexpr

Definition at line 79 of file function_traits.hpp.

79{ return SYS_VM_HAS_MEMBER(fn, operator()); }
#define SYS_VM_HAS_MEMBER(ARG, NAME)

◆ is_class()

template<typename F >
bool sysio::vm::is_class ( F && )
constexpr

Definition at line 191 of file function_traits.hpp.

191{ return std::is_class_v<F>; }

◆ is_function() [1/2]

template<typename F >
bool sysio::vm::is_function ( F && )
constexpr

Definition at line 161 of file function_traits.hpp.

161{ return false; }

◆ is_function() [2/2]

template<typename R , typename... Args>
bool sysio::vm::is_function ( R(*  )(Args...))
constexpr

Definition at line 158 of file function_traits.hpp.

158{ return true; }

◆ is_member_function() [1/6]

template<typename F >
bool sysio::vm::is_member_function ( F && )
constexpr

Definition at line 182 of file function_traits.hpp.

182{ return false; }

◆ is_member_function() [2/6]

template<typename R , typename Cls , typename... Args>
bool sysio::vm::is_member_function ( R(Cls::*  )(Args...) const &&)
constexpr

Definition at line 179 of file function_traits.hpp.

179{ return true; }

◆ is_member_function() [3/6]

template<typename R , typename Cls , typename... Args>
bool sysio::vm::is_member_function ( R(Cls::*  )(Args...) const &)
constexpr

Definition at line 176 of file function_traits.hpp.

176{ return true; }

◆ is_member_function() [4/6]

template<typename R , typename Cls , typename... Args>
bool sysio::vm::is_member_function ( R(Cls::*  )(Args...)&&)
constexpr

Definition at line 173 of file function_traits.hpp.

173{ return true; }

◆ is_member_function() [5/6]

template<typename R , typename Cls , typename... Args>
bool sysio::vm::is_member_function ( R(Cls::*  )(Args...)&)
constexpr

Definition at line 170 of file function_traits.hpp.

170{ return true; }

◆ is_member_function() [6/6]

template<typename R , typename Cls , typename... Args>
bool sysio::vm::is_member_function ( R(Cls::*  )(Args...))
constexpr

Definition at line 164 of file function_traits.hpp.

164{ return true; }

◆ longjmp_on_exception()

template<typename F >
void sysio::vm::longjmp_on_exception ( F && f)
inline

Definition at line 62 of file signals.hpp.

62 {
63 static_assert(std::is_trivially_destructible_v<std::decay_t<F>>, "longjmp has undefined behavior when it bypasses destructors.");
64 bool caught_exception = false;
65 try {
66 f();
67 } catch(...) {
68 saved_exception = std::current_exception();
69 // Cannot safely longjmp from inside the catch,
70 // as that will leak the exception.
71 caught_exception = true;
72 }
73 if (caught_exception) {
74 sigset_t block_mask;
75 sigemptyset(&block_mask);
76 sigaddset(&block_mask, SIGPROF);
77 pthread_sigmask(SIG_BLOCK, &block_mask, nullptr);
78 sigjmp_buf* dest = std::atomic_load(&signal_dest);
79 siglongjmp(*dest, -1);
80 }
81 }

◆ maybe_push_result()

template<typename Type_Converter , typename T >
void sysio::vm::maybe_push_result ( Type_Converter & tc,
T && res,
std::size_t trim_amt )

Definition at line 325 of file host_function.hpp.

325 {
326 if constexpr (!std::is_same_v<std::decay_t<T>, maybe_void_t>) {
327 tc.get_interface().trim_operands(trim_amt);
328 tc.get_interface().push_operand(detail::resolve_result(tc, static_cast<T&&>(res)));
329 } else {
330 tc.get_interface().trim_operands(trim_amt);
331 }
332 }
#define T(meth, val, expected)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator&()

Definition at line 15 of file options.hpp.

15 {
16 return static_cast<max_func_local_bytes_flags_t>(static_cast<int>(lhs) & static_cast<int>(rhs));
17}
max_func_local_bytes_flags_t
Definition options.hpp:7

◆ operator==() [1/4]

bool sysio::vm::operator== ( const func_type & lhs,
const func_type & rhs )
inline

Definition at line 49 of file types.hpp.

49 {
50 return lhs.form == rhs.form &&
51 lhs.param_types.size() == rhs.param_types.size() &&
52 std::equal(lhs.param_types.raw(), lhs.param_types.raw() + lhs.param_types.size(), rhs.param_types.raw()) &&
53 lhs.return_count == rhs.return_count &&
54 (lhs.return_count || lhs.return_type == rhs.return_type);
55 }
uint8_t return_count
Definition types.hpp:45
value_type form
Definition types.hpp:43
guarded_vector< value_type > param_types
Definition types.hpp:44
value_type return_type
Definition types.hpp:46

◆ operator==() [2/4]

bool sysio::vm::operator== ( const func_type & lhs,
const host_function & rhs )
inline

Definition at line 370 of file host_function.hpp.

370 {
371 return rhs == lhs;
372 }

◆ operator==() [3/4]

bool sysio::vm::operator== ( const host_function & lhs,
const func_type & rhs )
inline

Definition at line 364 of file host_function.hpp.

364 {
365 return lhs.params.size() == rhs.param_types.size() &&
366 std::equal(lhs.params.begin(), lhs.params.end(), rhs.param_types.raw()) &&
367 lhs.ret.size() == rhs.return_count &&
368 (lhs.ret.size() == 0 || lhs.ret[0] == rhs.return_type);
369 }
std::vector< value_type > params
std::vector< value_type > ret

◆ operator==() [4/4]

template<typename T , std::size_t Extent>
bool sysio::vm::operator== ( const span< T, Extent > & lhs,
const span< T, Extent > & rhs )

Definition at line 67 of file span_tests.cpp.

67 {
68 return lhs.data() == rhs.data() && lhs.size() == rhs.size();
69}
constexpr std::size_t size() const noexcept
Definition span.hpp:73
constexpr T * data() const noexcept
Definition span.hpp:72
Here is the call graph for this function:

◆ operator|()

Definition at line 12 of file options.hpp.

12 {
13 return static_cast<max_func_local_bytes_flags_t>(static_cast<int>(lhs) | static_cast<int>(rhs));
14}

◆ overloaded()

template<class... Ts>
sysio::vm::overloaded ( Ts... ) -> overloaded< Ts... >

◆ parameter_at()

template<std::size_t N, typename F >
auto sysio::vm::parameter_at ( F && fn) -> std::tuple_element_t< N, decltype(flatten_parameters(std::declval< F >()))>
constexpr

◆ parameters_from()

template<std::size_t N, typename F >
auto sysio::vm::parameters_from ( F && fn) -> detail::parameters_from_impl_t< N, F >
constexpr

◆ print_result()

template<typename StackElem >
void sysio::vm::print_result ( const std::optional< StackElem > & result)
inline

Definition at line 53 of file utils.hpp.

53 {
54 if(result) {
55 std::cout << "result: ";
56 if (result->template is_a<i32_const_t>())
57 std::cout << "i32:" << result->to_ui32();
58 else if (result->template is_a<i64_const_t>())
59 std::cout << "i64:" << result->to_ui64();
60 else if (result->template is_a<f32_const_t>())
61 std::cout << "f32:" << result->to_f32();
62 else if (result->template is_a<f64_const_t>())
63 std::cout << "f64:" << result->to_f64();
64 std::cout << std::endl;
65 }
66 }

◆ profile_handler()

void sysio::vm::profile_handler ( int sig,
siginfo_t * info,
void *  )
inline

Definition at line 346 of file profile.hpp.

346 {
347 static_assert(std::atomic<profile_data*>::is_always_lock_free);
348 auto * ptr = std::atomic_load(&per_thread_profile_data);
349 if(ptr) {
350 int saved_errno = errno;
351 void* data[profile_data::max_frames*2]; // Includes both wasm and native frames
352 int count = ptr->get_backtrace_fn(ptr->exec_context, data, sizeof(data)/sizeof(data[0]), uc);
353 ptr->handle_tick(data, count);
354 errno = saved_errno;
355 }
356}
int * count
Here is the caller graph for this function:

◆ read_wasm()

std::vector< uint8_t > sysio::vm::read_wasm ( const std::string & fname)
inline

Definition at line 30 of file utils.hpp.

30 {
31 std::ifstream wasm_file(fname, std::ios::binary);
32 if (!wasm_file.is_open())
33 throw std::runtime_error("wasm file not found");
34 wasm_file.seekg(0, std::ios::end);
35 std::vector<uint8_t> wasm;
36 int len = wasm_file.tellg();
37 if (len < 0)
38 throw std::runtime_error("wasm file length is -1");
39 wasm.resize(len);
40 wasm_file.seekg(0, std::ios::beg);
41 wasm_file.read((char*)wasm.data(), wasm.size());
42 wasm_file.close();
43 return wasm;
44 }
size_t len

◆ register_profile_signal_handler()

void sysio::vm::register_profile_signal_handler ( )
inline

Definition at line 264 of file profile.hpp.

264 {
265 static int init_helper = (register_profile_signal_handler_impl(), 0);
267}
void ignore_unused_variable_warning(T &...)
Definition utils.hpp:101
void register_profile_signal_handler_impl()
Definition profile.hpp:256
Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_profile_signal_handler_impl()

void sysio::vm::register_profile_signal_handler_impl ( )
inline

Definition at line 256 of file profile.hpp.

256 {
257 struct sigaction sa;
258 sa.sa_sigaction = profile_handler;
259 sigemptyset(&sa.sa_mask);
260 sa.sa_flags = SA_SIGINFO | SA_RESTART;
261 sigaction(SIGPROF, &sa, nullptr);
262}
void profile_handler(int sig, siginfo_t *info, void *)
Definition profile.hpp:346
Here is the call graph for this function:
Here is the caller graph for this function:

◆ return_type()

template<typename F >
auto sysio::vm::return_type ( F && fn) -> std::tuple_element_t< 0, detail::get_types_t< false, F > >
constexpr

◆ set_profile_interval_us()

void sysio::vm::set_profile_interval_us ( uint32_t value)
inline

Definition at line 271 of file profile.hpp.

271 {
273}
uint32_t profile_interval_us
Definition profile.hpp:18
#define value
Definition pkcs11.h:157
Here is the caller graph for this function:

◆ setup_signal_handler()

void sysio::vm::setup_signal_handler ( )
inline

Definition at line 105 of file signals.hpp.

105 {
106 static int init_helper = (setup_signal_handler_impl(), 0);
108 static_assert(std::atomic<sigjmp_buf*>::is_always_lock_free, "Atomic pointers must be lock-free to be async signal safe.");
109 }
void setup_signal_handler_impl()
Definition signals.hpp:94
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_signal_handler_impl()

void sysio::vm::setup_signal_handler_impl ( )
inline

Definition at line 94 of file signals.hpp.

94 {
95 struct sigaction sa;
96 sa.sa_sigaction = &signal_handler;
97 sigemptyset(&sa.sa_mask);
98 sigaddset(&sa.sa_mask, SIGPROF);
99 sa.sa_flags = SA_NODEFER | SA_SIGINFO;
100 sigaction(SIGSEGV, &sa, &prev_signal_handler<SIGSEGV>);
101 sigaction(SIGBUS, &sa, &prev_signal_handler<SIGBUS>);
102 sigaction(SIGFPE, &sa, &prev_signal_handler<SIGFPE>);
103 }
void signal_handler(int sig, siginfo_t *info, void *uap)
Definition signals.hpp:26
Here is the call graph for this function:
Here is the caller graph for this function:

◆ signal_handler()

void sysio::vm::signal_handler ( int sig,
siginfo_t * info,
void * uap )
inline

Definition at line 26 of file signals.hpp.

26 {
27 sigjmp_buf* dest = std::atomic_load(&signal_dest);
28 if (dest) {
29 siglongjmp(*dest, sig);
30 } else {
31 struct sigaction* prev_action;
32 switch(sig) {
33 case SIGSEGV: prev_action = &prev_signal_handler<SIGSEGV>; break;
34 case SIGBUS: prev_action = &prev_signal_handler<SIGBUS>; break;
35 case SIGFPE: prev_action = &prev_signal_handler<SIGFPE>; break;
36 default: std::abort();
37 }
38 if (!prev_action) std::abort();
39 if (prev_action->sa_flags & SA_SIGINFO) {
40 // FIXME: We need to be at least as strict as the original
41 // flags and relax the mask as needed.
42 prev_action->sa_sigaction(sig, info, uap);
43 } else {
44 if(prev_action->sa_handler == SIG_DFL) {
45 // The default for all three signals is to terminate the process.
46 sigaction(sig, prev_action, nullptr);
47 raise(sig);
48 } else if(prev_action->sa_handler == SIG_IGN) {
49 // Do nothing
50 } else {
51 prev_action->sa_handler(sig);
52 }
53 }
54 }
55 }
Here is the caller graph for this function:

◆ throw_()

template<typename E >
void sysio::vm::throw_ ( const char * msg)
inline

Definition at line 84 of file signals.hpp.

84 {
85 saved_exception = std::make_exception_ptr(E{msg});
86 sigset_t block_mask;
87 sigemptyset(&block_mask);
88 sigaddset(&block_mask, SIGPROF);
89 pthread_sigmask(SIG_BLOCK, &block_mask, nullptr);
90 sigjmp_buf* dest = std::atomic_load(&signal_dest);
91 siglongjmp(*dest, -1);
92 }
Here is the caller graph for this function:

◆ to_wasm_type()

template<typename T >
auto sysio::vm::to_wasm_type ( )

◆ to_wasm_type< f32_const_t >() [1/2]

template<>
auto sysio::vm::to_wasm_type< f32_const_t > ( )
constexpr

Definition at line 350 of file host_function.hpp.

350{ return types::f32; }

◆ to_wasm_type< f32_const_t >() [2/2]

template<>
auto sysio::vm::to_wasm_type< f32_const_t > ( )
constexpr

Definition at line 350 of file host_function.hpp.

350{ return types::f32; }

◆ to_wasm_type< f64_const_t >() [1/2]

template<>
auto sysio::vm::to_wasm_type< f64_const_t > ( )
constexpr

Definition at line 352 of file host_function.hpp.

352{ return types::f64; }

◆ to_wasm_type< f64_const_t >() [2/2]

template<>
auto sysio::vm::to_wasm_type< f64_const_t > ( )
constexpr

Definition at line 352 of file host_function.hpp.

352{ return types::f64; }

◆ to_wasm_type< i32_const_t >() [1/2]

template<>
auto sysio::vm::to_wasm_type< i32_const_t > ( )
constexpr

Definition at line 346 of file host_function.hpp.

346{ return types::i32; }

◆ to_wasm_type< i32_const_t >() [2/2]

template<>
auto sysio::vm::to_wasm_type< i32_const_t > ( )
constexpr

Definition at line 346 of file host_function.hpp.

346{ return types::i32; }

◆ to_wasm_type< i64_const_t >() [1/2]

template<>
auto sysio::vm::to_wasm_type< i64_const_t > ( )
constexpr

Definition at line 348 of file host_function.hpp.

348{ return types::i64; }

◆ to_wasm_type< i64_const_t >() [2/2]

template<>
auto sysio::vm::to_wasm_type< i64_const_t > ( )
constexpr

Definition at line 348 of file host_function.hpp.

348{ return types::i64; }

◆ vector_to_string()

template<typename T >
std::string sysio::vm::vector_to_string ( T && vec)

Definition at line 111 of file vector.hpp.

111 {
112 std::string str;
113 str.reserve(vec.size());
114 for (int i=0; i < vec.size(); i++)
115 str[i] = vec[i];
116 return str;
117 }

◆ visit()

template<class Visitor , typename Variant >
auto sysio::vm::visit ( Visitor && vis,
Variant && var )
constexpr

Definition at line 156 of file variant.hpp.

156 {
157 using Ret = decltype(std::invoke(std::forward<Visitor>(vis), var.template get<0>()));
158 return detail::dispatcher<true, Ret>::template _switch<0>(std::forward<Visitor>(vis), std::forward<Variant>(var));
159 }
Here is the caller graph for this function:

Variable Documentation

◆ eos_vm_amd64

bool sysio::vm::eos_vm_amd64 = false
inlineconstexpr

Definition at line 28 of file config.hpp.

◆ eos_vm_debug

bool sysio::vm::eos_vm_debug = false
inlineconstexpr

Definition at line 22 of file config.hpp.

◆ function_types_provider

template<typename Type_Converter , typename Ret , typename Args , std::size_t... Is>
host_function sysio::vm::function_types_provider ( std::index_sequence< Is... > )

Definition at line 390 of file host_function.hpp.

390 {
391 host_function hf;
392 hf.params.resize(detail::total_operands_v<Args, Type_Converter>);
393#if (defined(__GNUC__) && !defined(__clang__))
394#pragma GCC diagnostic push
395#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
396 value_type* iter = hf.params.data();
397 (get_args<Type_Converter, std::tuple_element_t<Is, Args>>(iter), ...);
398# pragma GCC diagnostic pop
399#else
400 value_type* iter = hf.params.data();
401 (get_args<Type_Converter, std::tuple_element_t<Is, Args>>(iter), ...);
402#endif
403 if constexpr (to_wasm_type_v<Type_Converter, Ret> != types::ret_void) {
404 hf.ret = { to_wasm_type_v<Type_Converter, Ret> };
405 }
406 return hf;
407 }
uint8_t value_type
Definition types.hpp:24

◆ maybe_void

maybe_void_t sysio::vm::maybe_void
inline

Definition at line 82 of file utils.hpp.

◆ prev_signal_handler

template<int Sig>
__attribute__ ((visibility("default"))) inline thread_local std __attribute__ ((visibility("default"))) inline thread_local std struct sigaction sysio::vm::prev_signal_handler

Definition at line 24 of file signals.hpp.

◆ profile_interval_us

uint32_t sysio::vm::profile_interval_us = 10000
inline

Definition at line 18 of file profile.hpp.

◆ should_align_memory_ops

bool sysio::vm::should_align_memory_ops = false
inlineconstexpr

Definition at line 9 of file config.hpp.

◆ to_wasm_type_v

template<typename TC , typename T >
auto sysio::vm::to_wasm_type_v = to_wasm_type<decltype(detail::resolve_result(std::declval<TC&>(), std::declval<T>()))>()
constexpr

Definition at line 355 of file host_function.hpp.

◆ to_wasm_type_v< TC, void >

template<typename TC >
auto sysio::vm::to_wasm_type_v< TC, void > = types::ret_void
constexpr

Definition at line 357 of file host_function.hpp.

◆ use_softfloat

bool sysio::vm::use_softfloat = false
inlineconstexpr

Definition at line 16 of file config.hpp.