Skip to content

Commit ce1344c

Browse files
committed
Runtime/wasm: fix method lookup
1 parent 2e458f9 commit ce1344c

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
* Runtime: fix caml_string_concat when not using JS strings (#1874)
5757
* Runtime: consistent bigarray hashing across all architectures (#1977)
5858
* Runtime: fix caml_utf8_of_utf16 bug in high surrogate case (#2008)
59+
* Runtime/wasm: fix method lookup (#2034)
5960
* Tools: fix jsoo_mktop and jsoo_mkcmis (#1877)
6061
* Toplevel: fix for when use-js-strings is disabled (#1997)
6162

runtime/wasm/obj.wat

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -387,14 +387,18 @@
387387
(global.set $method_cache (local.get $a))))
388388
(local.set $ofs
389389
(array.get $int_array (global.get $method_cache) (local.get $cacheid)))
390-
(if (i32.eq (local.get $tag)
391-
(i31.get_s
392-
(ref.cast (ref i31)
393-
(array.get $block (local.get $meths) (local.get $ofs)))))
390+
(if (i32.lt_u (local.get $ofs) (array.len (local.get $meths)))
394391
(then
395-
(return
396-
(array.get $block
397-
(local.get $meths) (i32.sub (local.get $ofs) (i32.const 1))))))
392+
(if (i32.eq (local.get $tag)
393+
(i31.get_s
394+
(ref.cast (ref i31)
395+
(array.get $block (local.get $meths)
396+
(local.get $ofs)))))
397+
(then
398+
(return
399+
(array.get $block
400+
(local.get $meths)
401+
(i32.sub (local.get $ofs) (i32.const 1))))))))
398402
(local.set $li (i32.const 3))
399403
(local.set $hi
400404
(i32.add

0 commit comments

Comments
 (0)