Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include/proxy-wasm/wasm.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ class WasmBase : public std::enable_shared_from_this<WasmBase> {
std::unique_ptr<ShutdownHandle> shutdown_handle_;
std::unordered_set<ContextBase *> pending_done_; // Root contexts not done during shutdown.

WasmCallVoid<0> _start_; /* Emscripten v1.39.0+ */
WasmCallVoid<0> _initialize_; /* Emscripten v1.39.17+ */
WasmCallVoid<0> _start_; /* Emscripten v1.39.0+ */
WasmCallVoid<0> __wasm_call_ctors_;

WasmCallWord<1> malloc_;
Expand Down
4 changes: 3 additions & 1 deletion src/null/null_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
namespace proxy_wasm {

void NullPlugin::getFunction(std::string_view function_name, WasmCallVoid<0> *f) {
if (function_name == "_start") {
if (function_name == "_initialize") {
*f = nullptr;
} else if (function_name == "_start") {
*f = nullptr;
} else if (function_name == "__wasm_call_ctors") {
*f = nullptr;
Expand Down
6 changes: 4 additions & 2 deletions src/wasm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ void WasmBase::registerCallbacks() {

void WasmBase::getFunctions() {
#define _GET(_fn) wasm_vm_->getFunction(#_fn, &_fn##_);
_GET(_initialize);
_GET(_start);
_GET(__wasm_call_ctors);

Expand Down Expand Up @@ -324,8 +325,9 @@ ContextBase *WasmBase::getOrCreateRootContext(const std::shared_ptr<PluginBase>
}

void WasmBase::startVm(ContextBase *root_context) {
/* Call "_start" function, and fallback to "__wasm_call_ctors" if the former is not available. */
if (_start_) {
if (_initialize_) {
_initialize_(root_context);
} else if (_start_) {
_start_(root_context);
} else if (__wasm_call_ctors_) {
__wasm_call_ctors_(root_context);
Expand Down