Enable lock for Vector to protect wasm-c-api read/write/extend operations (#1010)

This commit is contained in:
liang.he
2022-03-23 11:42:57 +08:00
committed by GitHub
parent e7079eeb17
commit 86b79cfb93
8 changed files with 198 additions and 121 deletions

View File

@ -34,7 +34,7 @@ void check(bool success) {
void check_call(wasm_func_t* func, int i, wasm_val_t args[], int32_t expected) {
wasm_val_t r[] = {WASM_INIT_VAL};
wasm_val_vec_t args_ = {i, args, i, sizeof(wasm_val_t)};
wasm_val_vec_t args_ = {i, args, i, sizeof(wasm_val_t), NULL};
wasm_val_vec_t results = WASM_ARRAY_VEC(r);
if (wasm_func_call(func, &args_, &results) || r[0].of.i32 != expected) {
printf("> Error on result\n");
@ -57,7 +57,7 @@ void check_call2(wasm_func_t* func, int32_t arg1, int32_t arg2, int32_t expected
}
void check_ok(wasm_func_t* func, int i, wasm_val_t args[]) {
wasm_val_vec_t args_ = {i, args, i, sizeof(wasm_val_t)};
wasm_val_vec_t args_ = {i, args, i, sizeof(wasm_val_t), NULL};
wasm_val_vec_t results = WASM_EMPTY_VEC;
if (wasm_func_call(func, &args_, &results)) {
printf("> Error on result, expected empty\n");
@ -72,7 +72,7 @@ void check_ok2(wasm_func_t* func, int32_t arg1, int32_t arg2) {
void check_trap(wasm_func_t* func, int i, wasm_val_t args[]) {
wasm_val_t r[] = {WASM_INIT_VAL};
wasm_val_vec_t args_ = {i, args, i, sizeof(wasm_val_t)};
wasm_val_vec_t args_ = {i, args, i, sizeof(wasm_val_t), NULL};
wasm_val_vec_t results = WASM_ARRAY_VEC(r);
own wasm_trap_t* trap = wasm_func_call(func, &args_, &results);
if (! trap) {