feat(other): support multi value for wasm#431
Open
ys8888john wants to merge 1 commit intoDTVMStack:mainfrom
Open
feat(other): support multi value for wasm#431ys8888john wants to merge 1 commit intoDTVMStack:mainfrom
ys8888john wants to merge 1 commit intoDTVMStack:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in “multi-value” mode for the WASM pipeline (parser/validator/interpreter/JIT) guarded by ZEN_ENABLE_WASI_MULTI_VALUE, plus new WAST tests and CI coverage for interpreter/singlepass/multipass configurations.
Changes:
- Introduces
ZEN_ENABLE_WASI_MULTI_VALUECMake option and wires it through build + CI. - Extends
TypeEntry/blocktype decoding to support multi-value signatures and type-index blocktypes. - Adds a new
tests/wast/multi_valuecategory and WAST test modules.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/wast/multi_value/multi_value_test.cpp | Adds a C++ “multi-value” smoke test (currently located under WAST tests). |
| tests/wast/multi_value/multi_value.wast | Adds multi-value proposal WAST cases (blocks/if/branch/functions with multi results). |
| tests/wast/multi_value/basic_test_main.wast | Adds a basic _start module for harness sanity checks. |
| tests/wast/multi_value/basic_test.wast | Adds a basic exported function module for harness sanity checks. |
| src/utils/wasm.cpp | Updates block skipping to handle blocktype as LEB (value type or type index). |
| src/tests/CMakeLists.txt | Adjusts spec categories when multi-value is enabled; adds multi_value category. |
| src/singlepass/x64/operand.h | Exposes raw operand kind accessor. |
| src/singlepass/x64/codegen.h | Adds multi-value call/return plumbing and restructures code blocks. |
| src/singlepass/common/datalayout.h | Switches return-type access to TypeEntry::getReturnTypes(). |
| src/singlepass/common/codegen.h | Adds multi-value-aware ArgumentInfo and block metadata in one-pass IR. |
| src/runtime/runtime.cpp | Updates main function type checking to use getReturnTypes(). |
| src/runtime/module.h | Changes TypeEntry layout to optionally support many returns (inline + heap storage). |
| src/runtime/module.cpp | Updates type equality + frees dynamic return type arrays when enabled. |
| src/compiler/wasm_frontend/wasm_mir_compiler.h | Adds multi-value metadata for blocks/args in MIR builder interfaces. |
| src/compiler/wasm_frontend/wasm_mir_compiler.cpp | Implements multi-value-aware control blocks and placeholder multi-return call/return paths. |
| src/common/type.h | Defines getWASMTypeSize() for VOID/ERROR_TYPE as 0. |
| src/common/defines.h | Raises PresetMaxNumReturns when multi-value is enabled. |
| src/action/module_loader.cpp | Allocates/stores multi-return type vectors for type section decoding. |
| src/action/loader_common.h | Adds multi-value readBlockType() supporting type-index blocktypes. |
| src/action/interpreter.h | Extends interpreter control stack block info to track multi-value result cells. |
| src/action/interpreter.cpp | Adds support for type-index blocktypes for BLOCK/LOOP/IF. |
| src/action/instantiator.cpp | Copies return types from TypeEntry::getReturnTypes() into FunctionInstance. |
| src/action/function_loader.h | Adds helper to detect type-index control blocks. |
| src/action/function_loader.cpp | Updates validation stack logic to use getReturnTypes() and read multi-value blocktypes. |
| src/action/bytecode_visitor.h | Adds multi-value handling for blocks/branches/returns/calls in the visitor. |
| src/CMakeLists.txt | Defines ZEN_ENABLE_WASI_MULTI_VALUE for compilation when enabled. |
| CMakeLists.txt | Adds ZEN_ENABLE_WASI_MULTI_VALUE option. |
| .github/workflows/dtvm_wasm_test_x86.yml | Adds CI jobs to build/test multi-value for interpreter/singlepass/multipass. |
| .ci/run_test_suite.sh | Adds ENABLE_MULTI_VALUE to turn on ZEN_ENABLE_WASI_MULTI_VALUE in CI builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
⚡ Performance Regression Check Results✅ Performance Check Passed (interpreter)Performance Benchmark Results (threshold: 25%)
Summary: 194 benchmarks, 0 regressions ✅ Performance Check Passed (multipass)Performance Benchmark Results (threshold: 25%)
Summary: 194 benchmarks, 0 regressions |
44195ef to
2d9c546
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):
2. What is the scope of this PR (e.g. component or file name):
3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):
4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):
5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:
6. Release note