#include <wasm_sysio_injection.hpp>
Definition at line 24 of file wasm_sysio_injection.hpp.
◆ add_import()
static void sysio::chain::wasm_injections::injector_utils::add_import |
( |
Module & | module, |
|
|
const char * | func_name, |
|
|
int32_t & | index ) |
|
inlinestatic |
Definition at line 63 of file wasm_sysio_injection.hpp.
63 {
66 const uint32_t func_type_index =
type_slots[{ FromResultType<Result>::value, FromValueType<Params>::value... }];
67 int actual_index;
70 decltype(module.functions.imports) new_import = { {{func_type_index}, sysio_injected_module_name, std::move(func_name)} };
71
72 module.functions.imports.insert( module.functions.imports.begin()+(registered_injected.size()-1), new_import.begin(), new_import.end() );
74
75
76 for (
size_t i=0; i <
module.exports.size(); i++ ) {
78 module.exports[i].index++;
79 }
80 }
81
82
84 module.startFunctionIndex++;
85 }
86
87
88 for(TableSegment& ts :
module.tableSegments) {
89 for(auto& idx : ts.indices)
90 idx++;
91 }
92 }
93 else {
95 }
96 }
static std::map< std::vector< uint16_t >, uint32_t > type_slots
static void get_next_indices(Module &module, int &next_function_index, int &next_actual_index)
static std::map< uint32_t, uint32_t > injected_index_mapping
static std::map< std::string, uint32_t > registered_injected
static void add_type_slot(Module &mod)
◆ add_type_slot()
static void sysio::chain::wasm_injections::injector_utils::add_type_slot |
( |
Module & | mod | ) |
|
|
inlinestatic |
Definition at line 49 of file wasm_sysio_injection.hpp.
49 {
50 if (
type_slots.find({FromResultType<Result>::value, FromValueType<Params>::value...}) ==
type_slots.end() ) {
51 type_slots.emplace( std::vector<uint16_t>{FromResultType<Result>::value, FromValueType<Params>::value...}, mod.types.size() );
53 }
54 }
static IR_API const FunctionType * get(ResultType ret, const std::initializer_list< ValueType > ¶meters)
◆ build_type_slots()
static void sysio::chain::wasm_injections::injector_utils::build_type_slots |
( |
Module & | mod | ) |
|
|
inlinestatic |
Definition at line 38 of file wasm_sysio_injection.hpp.
38 {
39
40 for ( size_t i=0; i < mod.types.size(); i++ ) {
41 std::vector<uint16_t> type_slot_list = {
static_cast<uint16_t>(mod.types[i]->ret) };
42 for ( auto param : mod.types[i]->parameters )
43 type_slot_list.push_back(
static_cast<uint16_t>(param) );
45 }
46 }
◆ get_next_indices()
static void sysio::chain::wasm_injections::injector_utils::get_next_indices |
( |
Module & | module, |
|
|
int & | next_function_index, |
|
|
int & | next_actual_index ) |
|
inlinestatic |
Definition at line 57 of file wasm_sysio_injection.hpp.
57 {
58 next_function_index = module.functions.imports.size() + module.functions.defs.size() + registered_injected.size();
60 }
static uint32_t next_injected_index
◆ init()
static void sysio::chain::wasm_injections::injector_utils::init |
( |
Module & | mod | ) |
|
|
inlinestatic |
◆ injected_index_mapping
std::map< uint32_t, uint32_t > sysio::chain::wasm_injections::injector_utils::injected_index_mapping |
|
static |
◆ next_injected_index
uint32_t sysio::chain::wasm_injections::injector_utils::next_injected_index |
|
static |
◆ registered_injected
std::map< std::string, uint32_t > sysio::chain::wasm_injections::injector_utils::registered_injected |
|
static |
◆ type_slots
std::map< std::vector< uint16_t >, uint32_t > sysio::chain::wasm_injections::injector_utils::type_slots |
|
static |
The documentation for this struct was generated from the following files: