-
Notifications
You must be signed in to change notification settings - Fork 40
Upgrade to WAMR 2.4.1 and WASI SDK to v27 #516
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
Upgrade to WAMR 2.4.1 and WASI SDK to v27 #516
Conversation
Not sure why we didn't support this a long time ago. But varargs with printf format should work for exceptions. Signed-off-by: Mic Bowman <[email protected]>
Signed-off-by: Mic Bowman <[email protected]>
Signed-off-by: Mic Bowman <[email protected]>
Includes clang v20. Signed-off-by: Mic Bowman <[email protected]>
There appears to be some "incompatibilities" between the way parson formats floats and the way WAMR handles indirect function calls (parson uses a function pointer to allow specification of an alternative way to format numbers). There did not appear an easy way to keep parson (mostly) unmodified as has been for past modifications. So... this update makes some more significant changes. Signed-off-by: Mic Bowman <[email protected]>
Move the various memory configurations into a single cmake configuration file in build/cmake/Memory.cmake. SGX, state, and wawaka all derive their configurations from that single file. The file also contains documentation for how the different variables interrelate. For example, the sgx reserved memory configuration depends on the heap and maximum contract size in wawaka. Incorporating the configuration into state & wawaka will happen in the next several commits. Also dropped the number of enclaves created in an eservice down to 2 to ease the impact of the additional enclave memory requirements placed on reserved memory. Signed-off-by: Mic Bowman <[email protected]>
Make the state cache size and data node size configurable based on the memory allocated to contracts. Signed-off-by: Mic Bowman <[email protected]>
- Refactored `CMakeLists.txt` to support WAMR integration and updated memory configuration. - Added `wamr` directory with patching scripts and custom build configurations. Copied the linux-sgx platform cmake build script from wamr, modified to apply a set of patches which include zero-ing SGX extended memory on deallocation. - Introduced `contract_abort_wrapper` and improved exception handling in `WasmExtensions.cpp`. Removed operations that are now supported directly by WAMR libc. - Replaced `RegisterNativeFunctions` with `InitializeNativeSymbols` for runtime initialization. This incorporates native function initialization into the single runtime initialization. - Update `WawakaInterpreter` for wamr 2.4.1. Class variables now conform to standard usage. Improved initialization and cleanup (e.g. to release static heap memory). In general, improved checks on memory usage. - Removed redundant `__wasm_call_ctors` calls in `Dispatch.cpp`. - Updated `contract-build.cmake` to export additional symbols for WAMR compatibility. Specifically, exporting malloc and free symbols enables wamr to adapt memory usage more easily. Signed-off-by: Mic Bowman <[email protected]>
WAMR 2.4.1 changes the way memory sharing occurs between instances of the interpreter running in different threads. The current integration does not address this issue so reducing the number of threads to 1 until the threading issue can be resolved. Signed-off-by: Mic Bowman <[email protected]>
Signed-off-by: Mic Bowman <[email protected]>
ensure that variables are initialized. remove unused variables. provide additional information for state exeception Signed-off-by: Mic Bowman <[email protected]>
move kvstore clean up into its own function. this replaces the exception with a more thorough cleanup to ensure that the memory is released. make a few variables in the state extensions constant that should have been constant from the start Signed-off-by: Mic Bowman <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Mic Bowman <[email protected]>
Co-authored-by: Copilot <[email protected]> Signed-off-by: Mic Bowman <[email protected]>
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.
Pull Request Overview
This PR upgrades WAMR (WebAssembly Micro Runtime) from version 1.3 to 2.4.1 and updates WASI SDK from version 24 to 27. The upgrade required significant changes to module initialization, function invocation, memory management, and introduced a new state finalizer mechanism to address memory leaks in exception handling.
Key changes include:
- Complete refactoring of WAMR integration with new memory management and initialization patterns
- Addition of StateFinalizer class for proper state cleanup to prevent memory leaks
- Migration from hardcoded memory values to configurable memory allocation system
Reviewed Changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| interpreters/wasm-micro-runtime | Updates WAMR submodule to version 2.4.1 |
| eservice/lib/libpdo_enclave/contract_request.cpp | Adds StateFinalizer class and updates state management |
| docker/pdo_base.dockerfile | Updates WASI SDK version from 24 to 27 |
| contracts/wawaka/contract-build.cmake | Adds new export symbols for WAMR compatibility |
| contracts/wawaka/common/Util.cpp | Adds missing operator delete overload |
| contracts/wawaka/common/Dispatch.cpp | Removes manual constructor calls |
| common/interpreter/wawaka_wasm/ | Multiple files refactored for WAMR 2.4.1 compatibility |
| build/cmake/ | New memory configuration system replacing hardcoded values |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Upgrade WAMR and WASI dependencies. The transition to WAMR 2.4.1 required several changes to module initialization and function invocation. The biggest barrier to the update, however, was figuring out the memory requirements since the memory layout of the interpreter changed significantly since version 1.3.