Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo > Class Template Reference
module mod

#include <backend.hpp>

Public Member Functions

 backend (wasm_code &&code, host_t &host, wasm_allocator *alloc, const Options &options=Options{})
 
 backend (wasm_code &&code, wasm_allocator *alloc, const Options &options=Options{})
 
 backend (wasm_code &code, host_t &host, wasm_allocator *alloc, const Options &options=Options{})
 
 backend (wasm_code &code, wasm_allocator *alloc, const Options &options=Options{})
 
 backend (wasm_code_ptr &ptr, size_t sz, host_t &host, wasm_allocator *alloc, const Options &options=Options{})
 
 backend (wasm_code_ptr &ptr, size_t sz, wasm_allocator *alloc, const Options &options=Options{})
 
template<typename... Args>
auto operator() (host_t &host, const std::string_view &mod, const std::string_view &func, Args... args)
 
template<typename... Args>
bool operator() (const std::string_view &mod, const std::string_view &func, Args... args)
 
backendinitialize (host_t *host, const Options &new_options)
 
backendinitialize (host_t *host=nullptr)
 
backendinitialize (host_t &host)
 
template<typename... Args>
bool call_indirect (host_t *host, uint32_t func_index, Args... args)
 
template<typename... Args>
bool call (host_t *host, uint32_t func_index, Args... args)
 
template<typename... Args>
bool call (host_t &host, const std::string_view &mod, const std::string_view &func, Args... args)
 
template<typename... Args>
bool call (const std::string_view &mod, const std::string_view &func, Args... args)
 
template<typename... Args>
auto call_with_return (host_t &host, const std::string_view &mod, const std::string_view &func, Args... args)
 
template<typename... Args>
auto call_with_return (const std::string_view &mod, const std::string_view &func, Args... args)
 
template<typename Watchdog , typename F >
void timed_run (Watchdog &&wd, F &&f)
 
template<typename Watchdog >
void execute_all (Watchdog &&wd, host_t &host)
 
template<typename Watchdog >
void execute_all (Watchdog &&wd)
 
void set_wasm_allocator (wasm_allocator *alloc)
 
wasm_allocatorget_wasm_allocator ()
 
moduleget_module ()
 
void exit (const std::error_code &ec)
 
auto & get_context ()
 
const DebugInfo & get_debug () const
 
 backend (wasm_code &&code, host_t &host, wasm_allocator *alloc, const Options &options=Options{})
 
 backend (wasm_code &&code, wasm_allocator *alloc, const Options &options=Options{})
 
 backend (wasm_code &code, host_t &host, wasm_allocator *alloc, const Options &options=Options{})
 
 backend (wasm_code &code, wasm_allocator *alloc, const Options &options=Options{})
 
 backend (wasm_code_ptr &ptr, size_t sz, host_t &host, wasm_allocator *alloc, const Options &options=Options{})
 
 backend (wasm_code_ptr &ptr, size_t sz, wasm_allocator *alloc, const Options &options=Options{})
 
template<typename... Args>
auto operator() (host_t &host, const std::string_view &mod, const std::string_view &func, Args... args)
 
template<typename... Args>
bool operator() (const std::string_view &mod, const std::string_view &func, Args... args)
 
backendinitialize (host_t *host, const Options &new_options)
 
backendinitialize (host_t *host=nullptr)
 
backendinitialize (host_t &host)
 
template<typename... Args>
bool call_indirect (host_t *host, uint32_t func_index, Args... args)
 
template<typename... Args>
bool call (host_t *host, uint32_t func_index, Args... args)
 
template<typename... Args>
bool call (host_t &host, const std::string_view &mod, const std::string_view &func, Args... args)
 
template<typename... Args>
bool call (const std::string_view &mod, const std::string_view &func, Args... args)
 
template<typename... Args>
auto call_with_return (host_t &host, const std::string_view &mod, const std::string_view &func, Args... args)
 
template<typename... Args>
auto call_with_return (const std::string_view &mod, const std::string_view &func, Args... args)
 
template<typename Watchdog , typename F >
void timed_run (Watchdog &&wd, F &&f)
 
template<typename Watchdog >
void execute_all (Watchdog &&wd, host_t &host)
 
template<typename Watchdog >
void execute_all (Watchdog &&wd)
 
void set_wasm_allocator (wasm_allocator *alloc)
 
wasm_allocatorget_wasm_allocator ()
 
moduleget_module ()
 
void exit (const std::error_code &ec)
 
auto & get_context ()
 
const DebugInfo & get_debug () const
 

Detailed Description

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
class sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >

Definition at line 62 of file backend.hpp.

Constructor & Destructor Documentation

◆ backend() [1/12]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::backend ( wasm_code && code,
host_t & host,
wasm_allocator * alloc,
const Options & options = Options{} )
inline

Definition at line 76 of file backend.hpp.

76 {})
77 : memory_alloc(alloc), ctx(parser_t{ mod.allocator, options }.parse_module(code, mod, debug), detail::get_max_call_depth(options)) {
78 ctx.set_max_pages(detail::get_max_pages(options));
79 construct(&host);
80 }
bip::allocator< T, pinnable_mapped_file::segment_manager > allocator
Definition chainbase.hpp:56

◆ backend() [2/12]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::backend ( wasm_code && code,
wasm_allocator * alloc,
const Options & options = Options{} )
inline

Definition at line 81 of file backend.hpp.

81 {})
82 : memory_alloc(alloc), ctx(parser_t{ mod.allocator, options }.parse_module(code, mod, debug), detail::get_max_call_depth(options)) {
83 ctx.set_max_pages(detail::get_max_pages(options));
84 construct();
85 }

◆ backend() [3/12]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::backend ( wasm_code & code,
host_t & host,
wasm_allocator * alloc,
const Options & options = Options{} )
inline

Definition at line 86 of file backend.hpp.

86 {})
87 : memory_alloc(alloc), ctx(parser_t{ mod.allocator, options }.parse_module(code, mod, debug), detail::get_max_call_depth(options)) {
88 ctx.set_max_pages(detail::get_max_pages(options));
89 construct(&host);
90 }

◆ backend() [4/12]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::backend ( wasm_code & code,
wasm_allocator * alloc,
const Options & options = Options{} )
inline

Definition at line 91 of file backend.hpp.

91 {})
92 : memory_alloc(alloc), ctx(parser_t{ mod.allocator, options }.parse_module(code, mod, debug), detail::get_max_call_depth(options)) {
93 ctx.set_max_pages(detail::get_max_pages(options));
94 construct();
95 }

◆ backend() [5/12]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::backend ( wasm_code_ptr & ptr,
size_t sz,
host_t & host,
wasm_allocator * alloc,
const Options & options = Options{} )
inline

Definition at line 96 of file backend.hpp.

96 {})
97 : memory_alloc(alloc), ctx(parser_t{ mod.allocator, options }.parse_module2(ptr, sz, mod, debug), detail::get_max_call_depth(options)) {
98 ctx.set_max_pages(detail::get_max_pages(options));
99 construct(&host);
100 }

◆ backend() [6/12]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::backend ( wasm_code_ptr & ptr,
size_t sz,
wasm_allocator * alloc,
const Options & options = Options{} )
inline

Definition at line 101 of file backend.hpp.

101 {})
102 : memory_alloc(alloc), ctx(parser_t{ mod.allocator, options }.parse_module2(ptr, sz, mod, debug), detail::get_max_call_depth(options)) {
103 ctx.set_max_pages(detail::get_max_pages(options));
104 construct();
105 }

◆ backend() [7/12]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::backend ( wasm_code && code,
host_t & host,
wasm_allocator * alloc,
const Options & options = Options{} )
inline

Definition at line 76 of file backend.hpp.

76 {})
77 : memory_alloc(alloc), ctx(parser_t{ mod.allocator, options }.parse_module(code, mod, debug), detail::get_max_call_depth(options)) {
78 ctx.set_max_pages(detail::get_max_pages(options));
79 construct(&host);
80 }

◆ backend() [8/12]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::backend ( wasm_code && code,
wasm_allocator * alloc,
const Options & options = Options{} )
inline

Definition at line 81 of file backend.hpp.

81 {})
82 : memory_alloc(alloc), ctx(parser_t{ mod.allocator, options }.parse_module(code, mod, debug), detail::get_max_call_depth(options)) {
83 ctx.set_max_pages(detail::get_max_pages(options));
84 construct();
85 }

◆ backend() [9/12]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::backend ( wasm_code & code,
host_t & host,
wasm_allocator * alloc,
const Options & options = Options{} )
inline

Definition at line 86 of file backend.hpp.

86 {})
87 : memory_alloc(alloc), ctx(parser_t{ mod.allocator, options }.parse_module(code, mod, debug), detail::get_max_call_depth(options)) {
88 ctx.set_max_pages(detail::get_max_pages(options));
89 construct(&host);
90 }

◆ backend() [10/12]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::backend ( wasm_code & code,
wasm_allocator * alloc,
const Options & options = Options{} )
inline

Definition at line 91 of file backend.hpp.

91 {})
92 : memory_alloc(alloc), ctx(parser_t{ mod.allocator, options }.parse_module(code, mod, debug), detail::get_max_call_depth(options)) {
93 ctx.set_max_pages(detail::get_max_pages(options));
94 construct();
95 }

◆ backend() [11/12]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::backend ( wasm_code_ptr & ptr,
size_t sz,
host_t & host,
wasm_allocator * alloc,
const Options & options = Options{} )
inline

Definition at line 96 of file backend.hpp.

96 {})
97 : memory_alloc(alloc), ctx(parser_t{ mod.allocator, options }.parse_module2(ptr, sz, mod, debug), detail::get_max_call_depth(options)) {
98 ctx.set_max_pages(detail::get_max_pages(options));
99 construct(&host);
100 }

◆ backend() [12/12]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::backend ( wasm_code_ptr & ptr,
size_t sz,
wasm_allocator * alloc,
const Options & options = Options{} )
inline

Definition at line 101 of file backend.hpp.

101 {})
102 : memory_alloc(alloc), ctx(parser_t{ mod.allocator, options }.parse_module2(ptr, sz, mod, debug), detail::get_max_call_depth(options)) {
103 ctx.set_max_pages(detail::get_max_pages(options));
104 construct();
105 }

Member Function Documentation

◆ call() [1/6]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
bool sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::call ( const std::string_view & mod,
const std::string_view & func,
Args... args )
inline

Definition at line 168 of file backend.hpp.

168 {
169 if constexpr (eos_vm_debug) {
170 ctx.execute(nullptr, debug_visitor(ctx), func, args...);
171 } else {
172 ctx.execute(nullptr, interpret_visitor(ctx), func, args...);
173 }
174 return true;
175 }
constexpr bool eos_vm_debug
Definition config.hpp:22

◆ call() [2/6]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
bool sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::call ( const std::string_view & mod,
const std::string_view & func,
Args... args )
inline

Definition at line 168 of file backend.hpp.

168 {
169 if constexpr (eos_vm_debug) {
170 ctx.execute(nullptr, debug_visitor(ctx), func, args...);
171 } else {
172 ctx.execute(nullptr, interpret_visitor(ctx), func, args...);
173 }
174 return true;
175 }

◆ call() [3/6]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
bool sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::call ( host_t & host,
const std::string_view & mod,
const std::string_view & func,
Args... args )
inline

Definition at line 158 of file backend.hpp.

158 {
159 if constexpr (eos_vm_debug) {
160 ctx.execute(&host, debug_visitor(ctx), func, args...);
161 } else {
162 ctx.execute(&host, interpret_visitor(ctx), func, args...);
163 }
164 return true;
165 }

◆ call() [4/6]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
bool sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::call ( host_t & host,
const std::string_view & mod,
const std::string_view & func,
Args... args )
inline

Definition at line 158 of file backend.hpp.

158 {
159 if constexpr (eos_vm_debug) {
160 ctx.execute(&host, debug_visitor(ctx), func, args...);
161 } else {
162 ctx.execute(&host, interpret_visitor(ctx), func, args...);
163 }
164 return true;
165 }

◆ call() [5/6]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
bool sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::call ( host_t * host,
uint32_t func_index,
Args... args )
inline

Definition at line 148 of file backend.hpp.

148 {
149 if constexpr (eos_vm_debug) {
150 ctx.execute(host, debug_visitor(ctx), func_index, args...);
151 } else {
152 ctx.execute(host, interpret_visitor(ctx), func_index, args...);
153 }
154 return true;
155 }
Here is the caller graph for this function:

◆ call() [6/6]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
bool sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::call ( host_t * host,
uint32_t func_index,
Args... args )
inline

Definition at line 148 of file backend.hpp.

148 {
149 if constexpr (eos_vm_debug) {
150 ctx.execute(host, debug_visitor(ctx), func_index, args...);
151 } else {
152 ctx.execute(host, interpret_visitor(ctx), func_index, args...);
153 }
154 return true;
155 }

◆ call_indirect() [1/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
bool sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::call_indirect ( host_t * host,
uint32_t func_index,
Args... args )
inline

Definition at line 138 of file backend.hpp.

138 {
139 if constexpr (eos_vm_debug) {
140 ctx.execute_func_table(host, debug_visitor(ctx), func_index, args...);
141 } else {
142 ctx.execute_func_table(host, interpret_visitor(ctx), func_index, args...);
143 }
144 return true;
145 }

◆ call_indirect() [2/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
bool sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::call_indirect ( host_t * host,
uint32_t func_index,
Args... args )
inline

Definition at line 138 of file backend.hpp.

138 {
139 if constexpr (eos_vm_debug) {
140 ctx.execute_func_table(host, debug_visitor(ctx), func_index, args...);
141 } else {
142 ctx.execute_func_table(host, interpret_visitor(ctx), func_index, args...);
143 }
144 return true;
145 }

◆ call_with_return() [1/4]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
auto sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::call_with_return ( const std::string_view & mod,
const std::string_view & func,
Args... args )
inline

Definition at line 187 of file backend.hpp.

187 {
188 if constexpr (eos_vm_debug) {
189 return ctx.execute(nullptr, debug_visitor(ctx), func, args...);
190 } else {
191 return ctx.execute(nullptr, interpret_visitor(ctx), func, args...);
192 }
193 }

◆ call_with_return() [2/4]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
auto sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::call_with_return ( const std::string_view & mod,
const std::string_view & func,
Args... args )
inline

Definition at line 187 of file backend.hpp.

187 {
188 if constexpr (eos_vm_debug) {
189 return ctx.execute(nullptr, debug_visitor(ctx), func, args...);
190 } else {
191 return ctx.execute(nullptr, interpret_visitor(ctx), func, args...);
192 }
193 }

◆ call_with_return() [3/4]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
auto sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::call_with_return ( host_t & host,
const std::string_view & mod,
const std::string_view & func,
Args... args )
inline

Definition at line 178 of file backend.hpp.

178 {
179 if constexpr (eos_vm_debug) {
180 return ctx.execute(&host, debug_visitor(ctx), func, args...);
181 } else {
182 return ctx.execute(&host, interpret_visitor(ctx), func, args...);
183 }
184 }

◆ call_with_return() [4/4]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
auto sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::call_with_return ( host_t & host,
const std::string_view & mod,
const std::string_view & func,
Args... args )
inline

Definition at line 178 of file backend.hpp.

178 {
179 if constexpr (eos_vm_debug) {
180 return ctx.execute(&host, debug_visitor(ctx), func, args...);
181 } else {
182 return ctx.execute(&host, interpret_visitor(ctx), func, args...);
183 }
184 }

◆ execute_all() [1/4]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename Watchdog >
void sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::execute_all ( Watchdog && wd)
inline

Definition at line 231 of file backend.hpp.

231 {
232 timed_run(static_cast<Watchdog&&>(wd), [&]() {
233 for (int i = 0; i < mod.exports.size(); i++) {
234 if (mod.exports[i].kind == external_kind::Function) {
235 std::string s{ (const char*)mod.exports[i].field_str.raw(), mod.exports[i].field_str.size() };
236 ctx.execute(nullptr, interpret_visitor(ctx), s);
237 }
238 }
239 });
240 }
void timed_run(Watchdog &&wd, F &&f)
Definition backend.hpp:196
watchdog wd
char * s
Here is the call graph for this function:

◆ execute_all() [2/4]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename Watchdog >
void sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::execute_all ( Watchdog && wd)
inline

Definition at line 231 of file backend.hpp.

231 {
232 timed_run(static_cast<Watchdog&&>(wd), [&]() {
233 for (int i = 0; i < mod.exports.size(); i++) {
234 if (mod.exports[i].kind == external_kind::Function) {
235 std::string s{ (const char*)mod.exports[i].field_str.raw(), mod.exports[i].field_str.size() };
236 ctx.execute(nullptr, interpret_visitor(ctx), s);
237 }
238 }
239 });
240 }
Here is the call graph for this function:

◆ execute_all() [3/4]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename Watchdog >
void sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::execute_all ( Watchdog && wd,
host_t & host )
inline

Definition at line 219 of file backend.hpp.

219 {
220 timed_run(static_cast<Watchdog&&>(wd), [&]() {
221 for (int i = 0; i < mod.exports.size(); i++) {
222 if (mod.exports[i].kind == external_kind::Function) {
223 std::string s{ (const char*)mod.exports[i].field_str.raw(), mod.exports[i].field_str.size() };
224 ctx.execute(host, interpret_visitor(ctx), s);
225 }
226 }
227 });
228 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ execute_all() [4/4]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename Watchdog >
void sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::execute_all ( Watchdog && wd,
host_t & host )
inline

Definition at line 219 of file backend.hpp.

219 {
220 timed_run(static_cast<Watchdog&&>(wd), [&]() {
221 for (int i = 0; i < mod.exports.size(); i++) {
222 if (mod.exports[i].kind == external_kind::Function) {
223 std::string s{ (const char*)mod.exports[i].field_str.raw(), mod.exports[i].field_str.size() };
224 ctx.execute(host, interpret_visitor(ctx), s);
225 }
226 }
227 });
228 }
Here is the call graph for this function:

◆ exit() [1/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
void sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::exit ( const std::error_code & ec)
inline

Definition at line 249 of file backend.hpp.

249{ ctx.exit(ec); }

◆ exit() [2/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
void sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::exit ( const std::error_code & ec)
inline

Definition at line 249 of file backend.hpp.

249{ ctx.exit(ec); }

◆ get_context() [1/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
auto & sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::get_context ( )
inline

Definition at line 250 of file backend.hpp.

250{ return ctx; }
Here is the caller graph for this function:

◆ get_context() [2/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
auto & sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::get_context ( )
inline

Definition at line 250 of file backend.hpp.

250{ return ctx; }

◆ get_debug() [1/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
const DebugInfo & sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::get_debug ( ) const
inline

Definition at line 252 of file backend.hpp.

252{ return debug; }

◆ get_debug() [2/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
const DebugInfo & sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::get_debug ( ) const
inline

Definition at line 252 of file backend.hpp.

252{ return debug; }

◆ get_module() [1/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
module & sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::get_module ( )
inline

Definition at line 248 of file backend.hpp.

248{ return mod; }
Here is the caller graph for this function:

◆ get_module() [2/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
module & sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::get_module ( )
inline

Definition at line 248 of file backend.hpp.

248{ return mod; }

◆ get_wasm_allocator() [1/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
wasm_allocator * sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::get_wasm_allocator ( )
inline

Definition at line 247 of file backend.hpp.

247{ return memory_alloc; }

◆ get_wasm_allocator() [2/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
wasm_allocator * sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::get_wasm_allocator ( )
inline

Definition at line 247 of file backend.hpp.

247{ return memory_alloc; }

◆ initialize() [1/6]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
backend & sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::initialize ( host_t & host)
inline

Definition at line 133 of file backend.hpp.

133 {
134 return initialize(&host);
135 }
backend & initialize(host_t *host, const Options &new_options)
Definition backend.hpp:118
Here is the call graph for this function:

◆ initialize() [2/6]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
backend & sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::initialize ( host_t & host)
inline

Definition at line 133 of file backend.hpp.

133 {
134 return initialize(&host);
135 }
Here is the call graph for this function:

◆ initialize() [3/6]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
backend & sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::initialize ( host_t * host,
const Options & new_options )
inline

Definition at line 118 of file backend.hpp.

118 {
119 ctx.set_max_call_depth(detail::get_max_call_depth(new_options));
120 ctx.set_max_pages(detail::get_max_pages(new_options));
121 initialize(host);
122 return *this;
123 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialize() [4/6]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
backend & sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::initialize ( host_t * host,
const Options & new_options )
inline

Definition at line 118 of file backend.hpp.

118 {
119 ctx.set_max_call_depth(detail::get_max_call_depth(new_options));
120 ctx.set_max_pages(detail::get_max_pages(new_options));
121 initialize(host);
122 return *this;
123 }
Here is the call graph for this function:

◆ initialize() [5/6]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
backend & sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::initialize ( host_t * host = nullptr)
inline

Definition at line 125 of file backend.hpp.

125 {
126 if (memory_alloc) {
127 ctx.reset();
128 ctx.execute_start(host, interpret_visitor(ctx));
129 }
130 return *this;
131 }

◆ initialize() [6/6]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
backend & sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::initialize ( host_t * host = nullptr)
inline

Definition at line 125 of file backend.hpp.

125 {
126 if (memory_alloc) {
127 ctx.reset();
128 ctx.execute_start(host, interpret_visitor(ctx));
129 }
130 return *this;
131 }

◆ operator()() [1/4]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
bool sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::operator() ( const std::string_view & mod,
const std::string_view & func,
Args... args )
inline

Definition at line 113 of file backend.hpp.

113 {
114 return call(mod, func, args...);
115 }
bool call(host_t *host, uint32_t func_index, Args... args)
Definition backend.hpp:148
Here is the call graph for this function:

◆ operator()() [2/4]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
bool sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::operator() ( const std::string_view & mod,
const std::string_view & func,
Args... args )
inline

Definition at line 113 of file backend.hpp.

113 {
114 return call(mod, func, args...);
115 }
Here is the call graph for this function:

◆ operator()() [3/4]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
auto sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::operator() ( host_t & host,
const std::string_view & mod,
const std::string_view & func,
Args... args )
inline

Definition at line 108 of file backend.hpp.

108 {
109 return call(host, mod, func, args...);
110 }
Here is the call graph for this function:

◆ operator()() [4/4]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename... Args>
auto sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::operator() ( host_t & host,
const std::string_view & mod,
const std::string_view & func,
Args... args )
inline

Definition at line 108 of file backend.hpp.

108 {
109 return call(host, mod, func, args...);
110 }
Here is the call graph for this function:

◆ set_wasm_allocator() [1/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
void sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::set_wasm_allocator ( wasm_allocator * alloc)
inline

Definition at line 242 of file backend.hpp.

242 {
243 memory_alloc = alloc;
244 ctx.set_wasm_allocator(memory_alloc);
245 }
Here is the caller graph for this function:

◆ set_wasm_allocator() [2/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
void sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::set_wasm_allocator ( wasm_allocator * alloc)
inline

Definition at line 242 of file backend.hpp.

242 {
243 memory_alloc = alloc;
244 ctx.set_wasm_allocator(memory_alloc);
245 }

◆ timed_run() [1/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename Watchdog , typename F >
void sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::timed_run ( Watchdog && wd,
F && f )
inline

Definition at line 196 of file backend.hpp.

196 {
197 std::atomic<bool> _timed_out = false;
198 auto reenable_code = scope_guard{[&](){
199 if (_timed_out) {
200 mod.allocator.enable_code(Impl::is_jit);
201 }
202 }};
203 try {
204 auto wd_guard = wd.scoped_run([this,&_timed_out]() {
205 _timed_out = true;
206 mod.allocator.disable_code();
207 });
208 static_cast<F&&>(f)();
209 } catch(wasm_memory_exception&) {
210 if (_timed_out) {
211 throw timeout_exception{ "execution timed out" };
212 } else {
213 throw;
214 }
215 }
216 }
Here is the caller graph for this function:

◆ timed_run() [2/2]

template<typename HostFunctions = std::nullptr_t, typename Impl = interpreter, typename Options = default_options, typename DebugInfo = null_debug_info>
template<typename Watchdog , typename F >
void sysio::vm::backend< HostFunctions, Impl, Options, DebugInfo >::timed_run ( Watchdog && wd,
F && f )
inline

Definition at line 196 of file backend.hpp.

196 {
197 std::atomic<bool> _timed_out = false;
198 auto reenable_code = scope_guard{[&](){
199 if (_timed_out) {
200 mod.allocator.enable_code(Impl::is_jit);
201 }
202 }};
203 try {
204 auto wd_guard = wd.scoped_run([this,&_timed_out]() {
205 _timed_out = true;
206 mod.allocator.disable_code();
207 });
208 static_cast<F&&>(f)();
209 } catch(wasm_memory_exception&) {
210 if (_timed_out) {
211 throw timeout_exception{ "execution timed out" };
212 } else {
213 throw;
214 }
215 }
216 }

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