|
379 | 379 | (ref.i31 (i32.const 0)))
|
380 | 380 |
|
381 | 381 | (global $method_cache (mut (ref $int_array))
|
382 |
| - (array.new $int_array (i32.const 0) (i32.const 8))) |
| 382 | + (array.new $int_array (i32.const 4) (i32.const 8))) |
383 | 383 |
|
384 | 384 | (func (export "caml_get_public_method")
|
385 |
| - (param $obj (ref eq)) (param (ref eq)) (param (ref eq)) (result (ref eq)) |
| 385 | + (param $obj (ref eq)) (param $vtag (ref eq)) (param (ref eq)) |
| 386 | + (result (ref eq)) |
386 | 387 | (local $meths (ref $block))
|
387 | 388 | (local $tag i32) (local $cacheid i32) (local $ofs i32)
|
388 | 389 | (local $li i32) (local $mi i32) (local $hi i32)
|
|
391 | 392 | (ref.cast (ref $block)
|
392 | 393 | (array.get $block
|
393 | 394 | (ref.cast (ref $block) (local.get $obj)) (i32.const 1))))
|
394 |
| - (local.set $tag (i31.get_s (ref.cast (ref i31) (local.get 1)))) |
395 | 395 | (local.set $cacheid (i31.get_u (ref.cast (ref i31) (local.get 2))))
|
396 | 396 | (local.set $len (array.len (global.get $method_cache)))
|
397 | 397 | (if (i32.ge_s (local.get $cacheid) (local.get $len))
|
398 | 398 | (then
|
399 | 399 | (loop $size
|
400 | 400 | (local.set $len (i32.shl (local.get $len) (i32.const 1)))
|
401 | 401 | (br_if $size (i32.ge_s (local.get $cacheid) (local.get $len))))
|
402 |
| - (local.set $a (array.new $int_array (i32.const 0) (local.get $len))) |
| 402 | + (local.set $a (array.new $int_array (i32.const 4) (local.get $len))) |
403 | 403 | (array.copy $int_array $int_array
|
404 | 404 | (local.get $a) (i32.const 0)
|
405 | 405 | (global.get $method_cache) (i32.const 0)
|
|
409 | 409 | (array.get $int_array (global.get $method_cache) (local.get $cacheid)))
|
410 | 410 | (if (i32.lt_u (local.get $ofs) (array.len (local.get $meths)))
|
411 | 411 | (then
|
412 |
| - (if (i32.eq (local.get $tag) |
413 |
| - (i31.get_s |
414 |
| - (ref.cast (ref i31) |
415 |
| - (array.get $block (local.get $meths) |
416 |
| - (local.get $ofs))))) |
| 412 | + (if (ref.eq (local.get $vtag) |
| 413 | + (array.get $block (local.get $meths) (local.get $ofs))) |
417 | 414 | (then
|
418 | 415 | (return
|
419 | 416 | (array.get $block
|
420 | 417 | (local.get $meths)
|
421 | 418 | (i32.sub (local.get $ofs) (i32.const 1))))))))
|
| 419 | + (local.set $tag (i31.get_s (ref.cast (ref i31) (local.get $vtag)))) |
422 | 420 | (local.set $li (i32.const 3))
|
423 | 421 | (local.set $hi
|
424 | 422 | (i32.add
|
|
450 | 448 | (array.set $int_array (global.get $method_cache) (local.get $cacheid)
|
451 | 449 | (i32.add (local.get $li) (i32.const 1)))
|
452 | 450 | (if (result (ref eq))
|
453 |
| - (i32.eq (local.get $tag) |
454 |
| - (i31.get_s |
455 |
| - (ref.cast (ref i31) |
456 |
| - (array.get $block (local.get $meths) |
457 |
| - (i32.add (local.get $li) (i32.const 1)))))) |
| 451 | + (ref.eq (local.get $vtag) |
| 452 | + (array.get $block (local.get $meths) |
| 453 | + (i32.add (local.get $li) (i32.const 1)))) |
458 | 454 | (then
|
459 | 455 | (array.get $block (local.get $meths) (local.get $li)))
|
460 | 456 | (else
|
|
0 commit comments