| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Sorry, something went wrong.
- Enable LLVM in WasmEdge Bazel build (WASMEDGE_USE_LLVM=On) - Implement precompiled bytecode support in wasmedge.cc - Return 'wasmedge' as precompiled section name - Load precompiled AOT bytecode when available, fallback to regular WASM This enables AOT (Ahead-of-Time) compilation for proxy-wasm modules using WasmEdge, providing better performance compared to interpreter mode. Fixes WasmEdge/WasmEdge#3207 Signed-off-by: Khushi Singh <khushisingh82072@gmail.com>
|
|
||
| std::string_view getEngineName() override { return "wasmedge"; } | ||
| std::string_view getPrecompiledSectionName() override { return ""; } | ||
| std::string_view getPrecompiledSectionName() override { return "wasmedge"; } |
There was a problem hiding this comment.
Does WasmEdge embed files inside the .wasm module?
Do you have an example invocation on how to build a precompiled Wasm module using WasmEdge?
Sorry, something went wrong.
There was a problem hiding this comment.
Answering myself, they do indeed embed it inside a custom section (aka Universal Wasm).
Sorry, something went wrong.
There was a problem hiding this comment.
Hi @PiotrSikora,
For using the precompiled Wasm module, we prefer to compile it with the WasmEdge compiler into a shared object and then use it.
We also allow users to run an embedded custom section for the precompiled Wasm file, aka Universal Wasm, but users can use force-interpreter to avoid executing the embedded section. It depends on how the users want to handle such cases.
Sorry, something went wrong.
| } | ||
|
|
||
| // Load regular WASM bytecode | ||
| res = WasmEdge_LoaderParseFromBuffer( |
There was a problem hiding this comment.
Does WasmEdge really use the same exact function, without any extra configuration, for both: Wasm bytecode and precompiled modules?
This would allow anybody to "sneak" precompiled data as Wasm bytecode, leading to a potential RCE... or am I misreading it?
Sorry, something went wrong.
| name = "wasmedge_lib", | ||
| cache_entries = { | ||
| "WASMEDGE_USE_LLVM": "Off", | ||
| "WASMEDGE_USE_LLVM": "On", |
Sorry, something went wrong.
There was a problem hiding this comment.
Hey @kalamkaar9404, thanks for your contribution! Could you change a few things:
Sorry, something went wrong.
- Add test in runtime_test.cc that uses WasmEdge AOT compiler API - Test compiles a wasm module to AOT and verifies it can be loaded - Conditionally compiled only when PROXY_WASM_HOST_ENGINE_WASMEDGE is defined - Apply clang-format to all changed files Signed-off-by: Khushi Singh <khushisingh82072@gmail.com>
Change allow_precompiled parameter from false to true to properly test AOT precompiled module loading functionality. Signed-off-by: Khushi Singh <khushisingh82072@gmail.com>
| WasmEdge_ConfigureContext *conf_cxt = WasmEdge_ConfigureCreate(); | ||
| WasmEdge_CompilerContext *compiler_cxt = WasmEdge_CompilerCreate(conf_cxt); | ||
| WasmEdge_Result res = | ||
| WasmEdge_CompilerCompile(compiler_cxt, input_file.c_str(), aot_file.c_str()); | ||
| ASSERT_TRUE(WasmEdge_ResultOK(res)) | ||
| << "AOT compilation failed: " << WasmEdge_ResultGetMessage(res); | ||
| WasmEdge_CompilerDelete(compiler_cxt); | ||
| WasmEdge_ConfigureDelete(conf_cxt); | ||
|
|
There was a problem hiding this comment.
Thanks for adding this test, but I think this code should be added in src/wasmedge/wasmedge.cc instead and exposed via engine-agnostic interface (include/proxy-wasm/wasm.h), so that this test could be executed against other engines as well.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
This PR enables AOT (Ahead-of-Time) compilation support for WasmEdge in the proxy-wasm integration, providing better performance compared to interpreter mode.
Changes
Implementation Details
Fixes WasmEdge/WasmEdge#3207