Change WASM_ANYREF to WASM_EXTERNREF (#3426)

wasm-c-api wasm.h had changed WASM_ANYREF to WASM_EXTERNREF,
we had better change it in WAMR also:
2ce1367c9d/include/wasm.h (L185)
This commit is contained in:
Wenyong Huang
2024-05-14 11:08:16 +08:00
committed by GitHub
parent 004d07bb86
commit 773efc006d
12 changed files with 42 additions and 42 deletions

View File

@ -93,7 +93,7 @@ wasm_get_externref(wasm_exec_env_t exec_env, wasm_module_inst_t inst,
return false;
}
if (WASM_ANYREF != results[0].kind) {
if (WASM_EXTERNREF != results[0].kind) {
return false;
}
@ -108,7 +108,7 @@ wasm_cmp_externref(wasm_exec_env_t exec_env, wasm_module_inst_t inst,
wasm_val_t results[1] = { 0 };
wasm_val_t arguments[2] = {
{ .kind = WASM_I32, .of.i32 = index },
{ .kind = WASM_ANYREF, .of.foreign = externref },
{ .kind = WASM_EXTERNREF, .of.foreign = externref },
};
if (!exec_env || !wasm_cmp_externref_ptr || !ret_result) {

View File

@ -22,7 +22,7 @@ void wasm_val_print(wasm_val_t val) {
case WASM_F64: {
printf("%g", val.of.f64);
} break;
case WASM_ANYREF:
case WASM_EXTERNREF:
case WASM_FUNCREF: {
if (val.of.ref == NULL) {
printf("null");

View File

@ -193,7 +193,7 @@ int main(int argc, const char* argv[]) {
// Create external callback function.
printf("Creating callback...\n");
own wasm_functype_t* callback_type = wasm_functype_new_1_1(
wasm_valtype_new(WASM_ANYREF), wasm_valtype_new(WASM_ANYREF));
wasm_valtype_new(WASM_EXTERNREF), wasm_valtype_new(WASM_EXTERNREF));
own wasm_func_t* callback_func =
wasm_func_new(store, callback_type, callback);
@ -245,7 +245,7 @@ int main(int argc, const char* argv[]) {
wasm_ref_delete(host2_cp);
own wasm_val_t val;
val.kind = WASM_ANYREF;
val.kind = WASM_EXTERNREF;
val.of.ref = wasm_ref_copy(host1);
wasm_ref_t *ref_cp = wasm_ref_copy(val.of.ref);
check(ref_cp, host1);
@ -264,12 +264,12 @@ int main(int argc, const char* argv[]) {
check(call_v_r(global_get), NULL);
wasm_global_get(global, &val);
assert(val.kind == WASM_ANYREF);
assert(val.kind == WASM_EXTERNREF);
assert(val.of.ref == NULL);
val.of.ref = host2;
wasm_global_set(global, &val);
wasm_global_get(global, &val);
assert(val.kind == WASM_ANYREF);
assert(val.kind == WASM_EXTERNREF);
assert(val.of.ref == host2);
printf("Accessing table...\n");

View File

@ -30,7 +30,7 @@ void print_valtype(const wasm_valtype_t* type) {
case WASM_F32: printf("f32"); break;
case WASM_F64: printf("f64"); break;
case WASM_V128: printf("v128"); break;
case WASM_ANYREF: printf("anyref"); break;
case WASM_EXTERNREF: printf("externref"); break;
case WASM_FUNCREF: printf("funcref"); break;
}
}