mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-08 20:56:13 +00:00
[gc] Subtyping fix (#4075)
This commit is contained in:
parent
1971cac6c3
commit
159f5890a6
|
@ -1145,6 +1145,14 @@ wasm_reftype_is_subtype_of(uint8 type1, const WASMRefType *ref_type1,
|
||||||
return true;
|
return true;
|
||||||
else {
|
else {
|
||||||
int32 heap_type = ref_type1->ref_ht_common.heap_type;
|
int32 heap_type = ref_type1->ref_ht_common.heap_type;
|
||||||
|
// We dont care whether type2 is nullable or not. So
|
||||||
|
// we normalize it into its related one-byte type.
|
||||||
|
if (type2 == REF_TYPE_HT_NULLABLE
|
||||||
|
|| type2 == REF_TYPE_HT_NON_NULLABLE) {
|
||||||
|
bh_assert(ref_type2);
|
||||||
|
type2 = (uint8)(ref_type2->ref_ht_common.heap_type
|
||||||
|
+ REF_TYPE_FUNCREF - HEAP_TYPE_FUNC);
|
||||||
|
}
|
||||||
if (heap_type == HEAP_TYPE_ANY) {
|
if (heap_type == HEAP_TYPE_ANY) {
|
||||||
/* (ref any) <: anyref */
|
/* (ref any) <: anyref */
|
||||||
return type2 == REF_TYPE_ANYREF ? true : false;
|
return type2 == REF_TYPE_ANYREF ? true : false;
|
||||||
|
@ -1188,19 +1196,15 @@ wasm_reftype_is_subtype_of(uint8 type1, const WASMRefType *ref_type1,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (heap_type == HEAP_TYPE_NONE) {
|
else if (heap_type == HEAP_TYPE_NONE) {
|
||||||
/* (ref none) */
|
return wasm_is_reftype_supers_of_none(type2, NULL, types,
|
||||||
/* TODO */
|
type_count);
|
||||||
bh_assert(0);
|
|
||||||
}
|
}
|
||||||
else if (heap_type == HEAP_TYPE_NOEXTERN) {
|
else if (heap_type == HEAP_TYPE_NOEXTERN) {
|
||||||
/* (ref noextern) */
|
return wasm_is_reftype_supers_of_noextern(type2);
|
||||||
/* TODO */
|
|
||||||
bh_assert(0);
|
|
||||||
}
|
}
|
||||||
else if (heap_type == HEAP_TYPE_NOFUNC) {
|
else if (heap_type == HEAP_TYPE_NOFUNC) {
|
||||||
/* (ref nofunc) */
|
return wasm_is_reftype_supers_of_nofunc(type2, NULL, types,
|
||||||
/* TODO */
|
type_count);
|
||||||
bh_assert(0);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bh_assert(0);
|
bh_assert(0);
|
||||||
|
|
|
@ -246,7 +246,7 @@ type2str(uint8 type)
|
||||||
"", /* reserved */
|
"", /* reserved */
|
||||||
"arrayref",
|
"arrayref",
|
||||||
"structref",
|
"structref",
|
||||||
"i32ref",
|
"i31ref",
|
||||||
"eqref",
|
"eqref",
|
||||||
"anyref",
|
"anyref",
|
||||||
"externref",
|
"externref",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user