-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Host API implementation and runtime updates #81
base: master
Are you sure you want to change the base?
Conversation
… to launch core_version runtime method. Added memory related classes.
# Conflicts: # core/src/runtime/service.cpp
core/src/host/api.h
Outdated
} | ||
} | ||
std::shared_ptr<plc::core::runtime::Memory> m_memory; | ||
std::map<soralog::Level, int> m_wasm_log_level_map; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_wasm_log_level_map looks like something constant (the map is initialized with const values in constructor in api.cpp file) - it's only searched and retrieved values.
So it could be at least const (or even maybe constexpr).
Well, it could be thought about using unordered_map as it would speed up the looking log level in ext_logging_max_level_version_1 method and possibility of element collision is none. Ordering seems also to not matter.
} | ||
|
||
wasm::Literals ExternalInterface::callImport(wasm::Function* import, wasm::LiteralList& arguments) { | ||
if (import->module == env) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can import
be nullptr?
Closes #79
4 host API methods were implemented which are called by the
Core_version
runtime call:ext_logging_max_level_version_1
ext_logging_log_version_1
ext_allocator_malloc_version_1
ext_allocator_free_version_1
I've also added memory management (based on Kagome code) - this was needed by both
ext_allocator...
methods. Currently it is possible to runCore_version
and get the resulting Version struct - however it is missing decoding of the APIs as this requires implementing blake2 algorithms which is out of this task scope. It should be straightforward now to implement other host and runtime methods.