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:
https://github.com/WebAssembly/wasm-c-api/blob/2ce1367c9d1271c83fb63bef26d896a2f290cd23/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
+2 -2
View File
@@ -211,7 +211,7 @@ func (self *Instance) CallFuncV(funcName string,
case int32:
if (param_types[i] != C.WASM_I32 &&
param_types[i] != C.WASM_FUNCREF &&
param_types[i] != C.WASM_ANYREF) {
param_types[i] != C.WASM_EXTERNREF) {
str := "CallFunc error: invalid param type %d, " +
"expect i32 but got other"
return fmt.Errorf(str, param_types[i])
@@ -273,7 +273,7 @@ func (self *Instance) CallFuncV(funcName string,
fallthrough
case C.WASM_FUNCREF:
fallthrough
case C.WASM_ANYREF:
case C.WASM_EXTERNREF:
i32 := (int32)(argv[argc])
results[i] = i32
argc++
@@ -213,7 +213,7 @@ WASM_I32 = 0
WASM_I64 = 1
WASM_F32 = 2
WASM_F64 = 3
WASM_ANYREF = 128
WASM_EXTERNREF = 128
WASM_FUNCREF = 129
def wasm_valtype_new(arg0):
@@ -180,7 +180,7 @@ def __repr_wasm_valtype_t(self):
elif WASM_FUNCREF == val_kind:
return "funcref"
else:
return "anyref"
return "externref"
wasm_valtype_t.__eq__ = __compare_wasm_valtype_t
@@ -406,7 +406,7 @@ def __compare_wasm_val_t(self, other):
return self.of.f32 == other.of.f32
elif WASM_F64 == self.kind:
return self.of.f64 == other.of.f63
elif WASM_ANYREF == self.kind:
elif WASM_EXTERNREF == self.kind:
raise RuntimeError("FIXME")
else:
raise RuntimeError("not a valid val kind")
@@ -421,8 +421,8 @@ def __repr_wasm_val_t(self):
return f"f32 {self.of.f32}"
elif WASM_F64 == self.kind:
return f"f64 {self.of.f64}"
elif WASM_ANYREF == self.kind:
return f"anyref {self.of.ref}"
elif WASM_EXTERNREF == self.kind:
return f"externref {self.of.ref}"
else:
raise RuntimeError("not a valid val kind")
@@ -61,7 +61,7 @@ class BasicTestSuite(unittest.TestCase):
def test_wasm_valkind(self):
self.assertEqual(
[WASM_I32, WASM_I64, WASM_F32, WASM_F64, WASM_ANYREF, WASM_FUNCREF],
[WASM_I32, WASM_I64, WASM_F32, WASM_F64, WASM_EXTERNREF, WASM_FUNCREF],
[0, 1, 2, 3, 128, 129],
)