Skip to content
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

wasm3: add patch for better start function support #349

Merged
merged 1 commit into from
May 27, 2020
Merged
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
20 changes: 20 additions & 0 deletions cmake/wasm3_03_startfunc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
diff --git a/source/m3_env.c b/source/m3_env.c
index 9292006..73628f4 100644
--- a/source/m3_env.c
+++ b/source/m3_env.c
@@ -638,7 +638,14 @@ M3Result InitStartFunc (IM3Module io_module)
_ (Compile_Function (function));
}

-_ (m3_Call(function));
+ IM3FuncType ftype = function->funcType;
+ if (ftype->numArgs != 0 || ftype->returnType != c_m3Type_none)
+ _throw (m3Err_argumentCountMismatch);
+
+ IM3Module module = function->module;
+ IM3Runtime runtime = module->runtime;
+
+_ ((M3Result) Call (function->compiled, runtime->stack, runtime->memory.mallocated, d_m3OpDefaultArgs));
}

_catch: return result;