@@ -107,6 +107,23 @@ type exportable =
107
107
| Global
108
108
| Tag
109
109
110
+ let heaptype_eq t1 t2 =
111
+ Stdlib. phys_equal t1 t2
112
+ ||
113
+ match t1, t2 with
114
+ | Type i1 , Type i2 -> i1 = i2
115
+ | _ -> false
116
+
117
+ let reftype_eq { nullable = n1 ; typ = t1 } { nullable = n2 ; typ = t2 } =
118
+ Bool. (n1 = n2) && heaptype_eq t1 t2
119
+
120
+ let valtype_eq t1 t2 =
121
+ Stdlib. phys_equal t1 t2
122
+ ||
123
+ match t1, t2 with
124
+ | Ref t1 , Ref t2 -> reftype_eq t1 t2
125
+ | _ -> false
126
+
110
127
let rec output_uint ch i =
111
128
if i < 128
112
129
then output_byte ch i
@@ -489,23 +506,6 @@ module Read = struct
489
506
(* We have large structs, that tend to hash to the same value *)
490
507
Hashtbl. hash_param 15 100 t
491
508
492
- let heaptype_eq t1 t2 =
493
- Stdlib. phys_equal t1 t2
494
- ||
495
- match t1, t2 with
496
- | Type i1 , Type i2 -> i1 = i2
497
- | _ -> false
498
-
499
- let reftype_eq { nullable = n1 ; typ = t1 } { nullable = n2 ; typ = t2 } =
500
- Bool. (n1 = n2) && heaptype_eq t1 t2
501
-
502
- let valtype_eq t1 t2 =
503
- Stdlib. phys_equal t1 t2
504
- ||
505
- match t1, t2 with
506
- | Ref t1 , Ref t2 -> reftype_eq t1 t2
507
- | _ -> false
508
-
509
509
let storagetype_eq t1 t2 =
510
510
match t1, t2 with
511
511
| Val v1 , Val v2 -> valtype_eq v1 v2
@@ -1583,11 +1583,11 @@ let check_export_import_types ~subtyping_info ~files i (desc : importdesc) i' im
1583
1583
match desc, import.desc with
1584
1584
| Func t , Func t' -> subtype subtyping_info t t'
1585
1585
| Table { limits; typ } , Table { limits = limits' ; typ = typ' } ->
1586
- check_limits limits limits' && Poly. ( typ = typ')
1586
+ check_limits limits limits' && reftype_eq typ typ'
1587
1587
| Mem limits , Mem limits' -> check_limits limits limits'
1588
1588
| Global { mut; typ } , Global { mut = mut' ; typ = typ' } ->
1589
1589
Bool. (mut = mut')
1590
- && if mut then Poly. ( typ = typ') else val_subtype subtyping_info typ typ'
1590
+ && if mut then valtype_eq typ typ' else val_subtype subtyping_info typ typ'
1591
1591
| Tag t , Tag t' -> t = t'
1592
1592
| _ -> false
1593
1593
in
0 commit comments