-
Notifications
You must be signed in to change notification settings - Fork 847
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1949: test+doc(c-api) Fix vecs that must be boxed vecs + don't transmute uninitialized boxed vecs r=Hywan a=Hywan # Description This PR improve test coverage of the C API. ~It's a work in progress. I've paused this work because we need to focus on something else, but one of the two test cases that have been added reveals an important bug.~ The `wasm_frame_vec_t`, `wasm_functype_vec_t`, `wasm_globaltype_vec_t`, `wasm_memorytype_vec_t` and `wasm_tabletype_vec_t` are incorrectly defined. Indeed, in `wasm.h` they are all defined with `WASM_DECLARE_TYPE` (except for `wasm_frame_vec_t`, but it's exactly the same), which declares the vectors as `WAM_DECLARE_VEC(name, *)`. This `*` is important. It means that we _must not_ declare thoses types with our own `wasm_declare_vec!` macro, but rather with `wasm_declare_boxed_vec!`. ~Fixing this bug impact many places in the code. I didn't have time for the moment, but it's probably not a big deal!~ This PR fixes those bugs with e10ad51, 75ceb0d, a3c7a2d, a0c34fe. Bonus for `wasm_frame_t` that was also incorrectly implemented, the fix lands in 4abf6f8 and is possible thanks to 43026e6, with a side effect of simplifying the code in 940dea7. While continuing to improve the test coverage, another bug has been found. In case of a boxed vector, `wasm_$name_vec_delete` was crashing if the given vector was uninitialized. Basically the following code was crashing: ``` wasm_exporttype_vec_t vector; wasm_exporttype_vec_new_uninitialized(&vector, 3); wasm_exporttype_vec_delete(&vector); ``` This is now fixed in 8aa0822, and tested in 96169de. The PR adds 34 test cases, and has found+fixes 6 bugs. # Review - [x] Add a short description of the the change to the CHANGELOG.md file Co-authored-by: Ivan Enderlin <ivan@mnt.io>
- Loading branch information
Showing
7 changed files
with
182 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.