diff --git a/include/eosio/vm/types.hpp b/include/eosio/vm/types.hpp index fad99f9..d301424 100644 --- a/include/eosio/vm/types.hpp +++ b/include/eosio/vm/types.hpp @@ -337,8 +337,14 @@ namespace eosio { namespace vm { template static uint32_t get_imported_functions_size_impl(const Imports& imports) { uint32_t number_of_imports = 0; - for (uint32_t i = 0; i < imports.size(); i++) { - if (imports[i].kind == external_kind::Function) + const auto sz = imports.size(); + // we don't want to use `imports[i]` or `imports.at(i)` since these do an unnecessary check + // `EOS_VM_ASSERT(i < _size)`. The check is unnecessary since we iterate from `0` to `_size`. + // So get the pointer to the first element and dereference it directly. + // ------------------------------------------------------------------------------------------------ + const auto data = imports.data(); + for (uint32_t i = 0; i < sz; i++) { + if (data[i].kind == external_kind::Function) number_of_imports++; } return number_of_imports; diff --git a/include/eosio/vm/wasm_stack.hpp b/include/eosio/vm/wasm_stack.hpp index da16153..6ed5d0a 100644 --- a/include/eosio/vm/wasm_stack.hpp +++ b/include/eosio/vm/wasm_stack.hpp @@ -34,7 +34,7 @@ namespace eosio { namespace vm { if (_index >= _store.size()) _store.resize(_store.size()*2); } - _store[_index++] = std::forward(e); + _store[_index++] = std::move(e); } ElemT pop() { return _store[--_index]; }