|
155 | 155 |
|
156 | 156 | (global $bigarray_ops (export "bigarray_ops") (ref $custom_operations)
|
157 | 157 | (struct.new $custom_operations
|
158 |
| - (array.new_fixed $string 9 ;; "_bigarr02" |
159 |
| - (i32.const 95) (i32.const 98) (i32.const 105) (i32.const 103) |
160 |
| - (i32.const 97) (i32.const 114) (i32.const 114) (i32.const 48) |
161 |
| - (i32.const 50)) |
| 158 | + (@string "_bigarr02") |
162 | 159 | (ref.func $caml_ba_compare)
|
163 | 160 | (ref.null $compare)
|
164 | 161 | (ref.func $bigarray_hash)
|
|
596 | 593 | (i32.mul (i32.add (i32.const 4) (local.get $num_dims)) (i32.const 4))
|
597 | 594 | (i32.mul (i32.add (i32.const 4) (local.get $num_dims)) (i32.const 8))))
|
598 | 595 |
|
599 |
| - (data $intern_overflow |
| 596 | + (@string $intern_overflow |
600 | 597 | "input_value: cannot read bigarray with 64-bit OCaml ints")
|
601 | 598 |
|
602 | 599 | (func $bigarray_deserialize
|
|
680 | 677 | (br $done))
|
681 | 678 | ;; int
|
682 | 679 | (if (call $caml_deserialize_uint_1 (local.get $s))
|
683 |
| - (then |
684 |
| - (call $caml_failwith |
685 |
| - (array.new_data $string $intern_overflow |
686 |
| - (i32.const 0) (i32.const 56)))))) |
| 680 | + (then (call $caml_failwith (global.get $intern_overflow))))) |
687 | 681 | ;; int32
|
688 | 682 | (loop $loop
|
689 | 683 | (if (i32.lt_u (local.get $i) (local.get $len))
|
|
792 | 786 |
|
793 | 787 | (global $CAML_BA_MAX_NUM_DIMS i32 (i32.const 16))
|
794 | 788 |
|
795 |
| - (data $ba_create_bad_dims "Bigarray.create: bad number of dimensions") |
796 |
| - (data $ba_create_negative_dim "Bigarray.create: negative dimension") |
| 789 | + (@string $ba_create_bad_dims "Bigarray.create: bad number of dimensions") |
| 790 | + (@string $ba_create_negative_dim "Bigarray.create: negative dimension") |
797 | 791 |
|
798 | 792 | (func (export "caml_ba_create")
|
799 | 793 | (param $vkind (ref eq)) (param $layout (ref eq)) (param $d (ref eq))
|
|
805 | 799 | (local.set $vdim (ref.cast (ref $block) (local.get $d)))
|
806 | 800 | (local.set $num_dims (i32.sub (array.len (local.get $vdim)) (i32.const 1)))
|
807 | 801 | (if (i32.gt_u (local.get $num_dims) (global.get $CAML_BA_MAX_NUM_DIMS))
|
808 |
| - (then |
809 |
| - (call $caml_invalid_argument |
810 |
| - (array.new_data $string $ba_create_bad_dims |
811 |
| - (i32.const 0) (i32.const 41))))) |
| 802 | + (then (call $caml_invalid_argument (global.get $ba_create_bad_dims)))) |
812 | 803 | (local.set $dim
|
813 | 804 | (array.new $int_array (i32.const 0) (local.get $num_dims)))
|
814 | 805 | (local.set $i (i32.const 0))
|
|
823 | 814 | (if (i32.lt_s (local.get $n) (i32.const 0))
|
824 | 815 | (then
|
825 | 816 | (call $caml_invalid_argument
|
826 |
| - (array.new_data $string $ba_create_negative_dim |
827 |
| - (i32.const 0) (i32.const 35))))) |
| 817 | + (global.get $ba_create_negative_dim)))) |
828 | 818 | (array.set $int_array
|
829 | 819 | (local.get $dim) (local.get $i) (local.get $n))
|
830 | 820 | (local.set $i (i32.add (local.get $i) (i32.const 1)))
|
|
838 | 828 | (local.get $kind)
|
839 | 829 | (i31.get_s (ref.cast (ref i31) (local.get $layout)))))
|
840 | 830 |
|
841 |
| - (data $ta_unsupported_kind "Typed_array.to_genarray: unsupported kind") |
842 |
| - (data $ta_too_large "Typed_array.to_genarray: too large") |
| 831 | + (@string $ta_unsupported_kind "Typed_array.to_genarray: unsupported kind") |
| 832 | + (@string $ta_too_large "Typed_array.to_genarray: too large") |
843 | 833 |
|
844 | 834 | (func (export "caml_ba_from_typed_array") (param (ref eq)) (result (ref eq))
|
845 | 835 | (local $data (ref extern))
|
|
850 | 840 | (ref.as_non_null (extern.convert_any (call $unwrap (local.get 0))))))
|
851 | 841 | (local.set $kind (call $ta_kind (local.get $data)))
|
852 | 842 | (if (i32.lt_s (local.get $kind) (i32.const 0))
|
853 |
| - (then |
854 |
| - (call $caml_invalid_argument |
855 |
| - (array.new_data $string $ta_unsupported_kind |
856 |
| - (i32.const 0) (i32.const 41))))) |
| 843 | + (then (call $caml_invalid_argument (global.get $ta_unsupported_kind)))) |
857 | 844 | (if (i32.eq (local.get $kind) (i32.const 14)) ;; Uint8ClampedArray
|
858 | 845 | (then (local.set $kind (i32.const 3))))
|
859 | 846 | (local.set $len (call $ta_length (local.get $data)))
|
860 | 847 | (if (i32.lt_s (local.get $len) (i32.const 0))
|
861 |
| - (then |
862 |
| - (call $caml_invalid_argument |
863 |
| - (array.new_data $string $ta_too_large |
864 |
| - (i32.const 0) (i32.const 34))))) |
| 848 | + (then (call $caml_invalid_argument (global.get $ta_too_large)))) |
865 | 849 | (struct.new $bigarray
|
866 | 850 | (global.get $bigarray_ops)
|
867 | 851 | (local.get $data)
|
|
1050 | 1034 | (struct.get $float 0 (ref.cast (ref $float) (local.get $v))))
|
1051 | 1035 | (return))
|
1052 | 1036 |
|
1053 |
| - (data $Bigarray_dim "Bigarray.dim") |
| 1037 | + (@string $Bigarray_dim "Bigarray.dim") |
1054 | 1038 |
|
1055 | 1039 | (func $caml_ba_dim (export "caml_ba_dim")
|
1056 | 1040 | (param (ref eq)) (param (ref eq)) (result (ref eq))
|
|
1061 | 1045 | (ref.cast (ref $bigarray) (local.get 0))))
|
1062 | 1046 | (local.set $i (i31.get_s (ref.cast (ref i31) (local.get 1))))
|
1063 | 1047 | (if (i32.ge_u (local.get $i) (array.len (local.get $dim)))
|
1064 |
| - (then (call $caml_invalid_argument |
1065 |
| - (array.new_data $string $Bigarray_dim |
1066 |
| - (i32.const 0) (i32.const 12))))) |
| 1048 | + (then (call $caml_invalid_argument (global.get $Bigarray_dim)))) |
1067 | 1049 | (ref.i31 (array.get $int_array (local.get $dim) (local.get $i))))
|
1068 | 1050 |
|
1069 | 1051 | (func (export "caml_ba_dim_1") (param (ref eq)) (result (ref eq))
|
|
1409 | 1391 | (local.get $v))
|
1410 | 1392 | (ref.i31 (i32.const 0)))
|
1411 | 1393 |
|
1412 |
| - (data $too_many_indices "Bigarray.slice: too many indices") |
| 1394 | + (@string $too_many_indices "Bigarray.slice: too many indices") |
1413 | 1395 |
|
1414 | 1396 | (func (export "caml_ba_slice")
|
1415 | 1397 | (param $vb (ref eq)) (param $vind (ref eq)) (result (ref eq))
|
|
1425 | 1407 | (local.set $num_dims (struct.get $bigarray $ba_num_dims (local.get $b)))
|
1426 | 1408 | (if (i32.gt_u (local.get $num_inds)
|
1427 | 1409 | (struct.get $bigarray $ba_num_dims (local.get $b)))
|
1428 |
| - (then |
1429 |
| - (call $caml_invalid_argument |
1430 |
| - (array.new_data $string $too_many_indices |
1431 |
| - (i32.const 0) (i32.const 32))))) |
| 1410 | + (then (call $caml_invalid_argument (global.get $too_many_indices)))) |
1432 | 1411 | (local.set $sub_dim
|
1433 | 1412 | (array.new $int_array (i32.const 0)
|
1434 | 1413 | (i32.sub (local.get $num_dims) (local.get $num_inds))))
|
|
1492 | 1471 | (struct.get $bigarray $ba_kind (local.get $b))
|
1493 | 1472 | (struct.get $bigarray $ba_layout (local.get $b))))
|
1494 | 1473 |
|
1495 |
| - (data $bad_subarray "Bigarray.sub: bad sub-array") |
| 1474 | + (@string $bad_subarray "Bigarray.sub: bad sub-array") |
1496 | 1475 |
|
1497 | 1476 | (func (export "caml_ba_sub")
|
1498 | 1477 | (param $vba (ref eq)) (param $vofs (ref eq)) (param $vlen (ref eq))
|
|
1542 | 1521 | (i32.gt_s (i32.add (local.get $ofs) (local.get $len))
|
1543 | 1522 | (array.get $int_array (local.get $dim)
|
1544 | 1523 | (local.get $changed_dim))))
|
1545 |
| - (then |
1546 |
| - (call $caml_invalid_argument |
1547 |
| - (array.new_data $string $bad_subarray |
1548 |
| - (i32.const 0) (i32.const 27))))) |
| 1524 | + (then (call $caml_invalid_argument (global.get $bad_subarray)))) |
1549 | 1525 | (local.set $new_dim
|
1550 | 1526 | (array.new $int_array (i32.const 0) (local.get $num_dims)))
|
1551 | 1527 | (array.copy $int_array $int_array
|
|
1658 | 1634 | (struct.get $float 0 (ref.cast (ref $float) (local.get $v))))
|
1659 | 1635 | (return (ref.i31 (i32.const 0))))
|
1660 | 1636 |
|
1661 |
| - (data $dim_mismatch "Bigarray.blit: dimension mismatch") |
| 1637 | + (@string $dim_mismatch "Bigarray.blit: dimension mismatch") |
1662 | 1638 |
|
1663 | 1639 | (func (export "caml_ba_blit")
|
1664 | 1640 | (param $vsrc (ref eq)) (param $vdst (ref eq)) (result (ref eq))
|
|
1672 | 1648 | (local.set $len (struct.get $bigarray $ba_num_dims (local.get $dst)))
|
1673 | 1649 | (if (i32.ne (local.get $len)
|
1674 | 1650 | (struct.get $bigarray $ba_num_dims (local.get $src)))
|
1675 |
| - (then |
1676 |
| - (call $caml_invalid_argument |
1677 |
| - (array.new_data $string $dim_mismatch |
1678 |
| - (i32.const 0) (i32.const 33))))) |
| 1651 | + (then (call $caml_invalid_argument (global.get $dim_mismatch)))) |
1679 | 1652 | (local.set $sdim (struct.get $bigarray $ba_dim (local.get $src)))
|
1680 | 1653 | (local.set $ddim (struct.get $bigarray $ba_dim (local.get $dst)))
|
1681 | 1654 | (loop $loop
|
|
1685 | 1658 | (array.get $int_array (local.get $sdim) (local.get $i))
|
1686 | 1659 | (array.get $int_array (local.get $ddim) (local.get $i)))
|
1687 | 1660 | (then
|
1688 |
| - (call $caml_invalid_argument |
1689 |
| - (array.new_data $string $dim_mismatch |
1690 |
| - (i32.const 0) (i32.const 33))))) |
| 1661 | + (call $caml_invalid_argument (global.get $dim_mismatch)))) |
1691 | 1662 | (local.set $i (i32.add (local.get $i) (i32.const 1)))
|
1692 | 1663 | (br $loop))))
|
1693 | 1664 | (call $ta_blit
|
1694 | 1665 | (struct.get $bigarray $ba_data (local.get $src))
|
1695 | 1666 | (struct.get $bigarray $ba_data (local.get $dst)))
|
1696 | 1667 | (ref.i31 (i32.const 0)))
|
1697 | 1668 |
|
1698 |
| - (data $bad_number_dim "Bigarray.reshape: bad number of dimensions") |
1699 |
| - (data $negative_dim "Bigarray.reshape: negative dimension") |
1700 |
| - (data $size_mismatch "Bigarray.reshape: size mismatch") |
| 1669 | + (@string $bad_number_dim "Bigarray.reshape: bad number of dimensions") |
| 1670 | + (@string $negative_dim "Bigarray.reshape: negative dimension") |
| 1671 | + (@string $size_mismatch "Bigarray.reshape: size mismatch") |
1701 | 1672 |
|
1702 | 1673 | (func (export "caml_ba_reshape")
|
1703 | 1674 | (param $vb (ref eq)) (param $vd (ref eq)) (result (ref eq))
|
|
1709 | 1680 | (local.set $num_dims (i32.sub (array.len (local.get $vdim)) (i32.const 1)))
|
1710 | 1681 | (local.set $b (ref.cast (ref $bigarray) (local.get $vb)))
|
1711 | 1682 | (if (i32.gt_u (local.get $num_dims) (global.get $CAML_BA_MAX_NUM_DIMS))
|
1712 |
| - (then |
1713 |
| - (call $caml_invalid_argument |
1714 |
| - (array.new_data $string $bad_number_dim |
1715 |
| - (i32.const 0) (i32.const 42))))) |
| 1683 | + (then (call $caml_invalid_argument (global.get $bad_number_dim)))) |
1716 | 1684 | (local.set $num_elts (i64.const 1))
|
1717 | 1685 | (local.set $dim (array.new $int_array (i32.const 0) (local.get $num_dims)))
|
1718 | 1686 | (loop $loop
|
|
1725 | 1693 | (i32.add (local.get $i) (i32.const 1))))))
|
1726 | 1694 | (if (i32.lt_s (local.get $d) (i32.const 0))
|
1727 | 1695 | (then
|
1728 |
| - (call $caml_invalid_argument |
1729 |
| - (array.new_data $string $negative_dim |
1730 |
| - (i32.const 0) (i32.const 36))))) |
| 1696 | + (call $caml_invalid_argument (global.get $negative_dim)))) |
1731 | 1697 | (array.set $int_array (local.get $dim) (local.get $i)
|
1732 | 1698 | (local.get $d))
|
1733 | 1699 | (local.set $num_elts
|
|
1741 | 1707 | (if (i32.ne (i32.wrap_i64 (local.get $num_elts))
|
1742 | 1708 | (call $caml_ba_get_size
|
1743 | 1709 | (struct.get $bigarray $ba_dim (local.get $b))))
|
1744 |
| - (then |
1745 |
| - (call $caml_invalid_argument |
1746 |
| - (array.new_data $string $size_mismatch |
1747 |
| - (i32.const 0) (i32.const 31))))) |
| 1710 | + (then (call $caml_invalid_argument (global.get $size_mismatch)))) |
1748 | 1711 | (struct.new $bigarray
|
1749 | 1712 | (global.get $bigarray_ops)
|
1750 | 1713 | (struct.get $bigarray $ba_data (local.get $b))
|
|
0 commit comments