|
71 | 71 | (param (ref extern)) (param i32) (param i32) (result (ref extern)))) |
72 | 72 | (import "bindings" "ta_blit_from_string" |
73 | 73 | (func $ta_blit_from_string |
74 | | - (param (ref $string)) (param i32) (param (ref extern)) (param i32) |
| 74 | + (param (ref $bytes)) (param i32) (param (ref extern)) (param i32) |
75 | 75 | (param i32))) |
76 | 76 | (import "bindings" "ta_blit_to_string" |
77 | 77 | (func $ta_blit_to_string |
78 | | - (param (ref extern)) (param i32) (param (ref $string)) (param i32) |
| 78 | + (param (ref extern)) (param i32) (param (ref $bytes)) (param i32) |
79 | 79 | (param i32))) |
80 | 80 | (import "fail" "caml_bound_error" (func $caml_bound_error)) |
81 | 81 | (import "fail" "caml_raise_out_of_memory" (func $caml_raise_out_of_memory)) |
|
126 | 126 | (func $caml_deserialize_int_8 (param (ref eq)) (result i64))) |
127 | 127 |
|
128 | 128 | (type $block (array (mut (ref eq)))) |
129 | | - (type $string (array (mut i8))) |
| 129 | + (type $bytes (array (mut i8))) |
130 | 130 | (type $float (struct (field f64))) |
131 | 131 | (type $float_array (array (mut f64))) |
132 | 132 |
|
|
141 | 141 | (type $dup (func (param (ref eq)) (result (ref eq)))) |
142 | 142 | (type $custom_operations |
143 | 143 | (struct |
144 | | - (field $id (ref $string)) |
| 144 | + (field $id (ref $bytes)) |
145 | 145 | (field $compare (ref null $compare)) |
146 | 146 | (field $compare_ext (ref null $compare)) |
147 | 147 | (field $hash (ref null $hash)) |
|
153 | 153 |
|
154 | 154 | (global $bigarray_ops (export "bigarray_ops") (ref $custom_operations) |
155 | 155 | (struct.new $custom_operations |
156 | | - (array.new_fixed $string 9 ;; "_bigarr02" |
| 156 | + (array.new_fixed $bytes 9 ;; "_bigarr02" |
157 | 157 | (i32.const 95) (i32.const 98) (i32.const 105) (i32.const 103) |
158 | 158 | (i32.const 97) (i32.const 114) (i32.const 114) (i32.const 48) |
159 | 159 | (i32.const 50)) |
|
591 | 591 | (if (call $caml_deserialize_uint_1 (local.get $s)) |
592 | 592 | (then |
593 | 593 | (call $caml_failwith |
594 | | - (array.new_data $string $intern_overflow |
| 594 | + (array.new_data $bytes $intern_overflow |
595 | 595 | (i32.const 0) (i32.const 56)))))) |
596 | 596 | ;; int32 |
597 | 597 | (loop $loop |
|
716 | 716 | (if (i32.gt_u (local.get $num_dims) (global.get $CAML_BA_MAX_NUM_DIMS)) |
717 | 717 | (then |
718 | 718 | (call $caml_invalid_argument |
719 | | - (array.new_data $string $ba_create_bad_dims |
| 719 | + (array.new_data $bytes $ba_create_bad_dims |
720 | 720 | (i32.const 0) (i32.const 41))))) |
721 | 721 | (local.set $dim |
722 | 722 | (array.new $int_array (i32.const 0) (local.get $num_dims))) |
|
732 | 732 | (if (i32.lt_s (local.get $n) (i32.const 0)) |
733 | 733 | (then |
734 | 734 | (call $caml_invalid_argument |
735 | | - (array.new_data $string $ba_create_negative_dim |
| 735 | + (array.new_data $bytes $ba_create_negative_dim |
736 | 736 | (i32.const 0) (i32.const 35))))) |
737 | 737 | (array.set $int_array |
738 | 738 | (local.get $dim) (local.get $i) (local.get $n)) |
|
761 | 761 | (if (i32.lt_s (local.get $kind) (i32.const 0)) |
762 | 762 | (then |
763 | 763 | (call $caml_invalid_argument |
764 | | - (array.new_data $string $ta_unsupported_kind |
| 764 | + (array.new_data $bytes $ta_unsupported_kind |
765 | 765 | (i32.const 0) (i32.const 41))))) |
766 | 766 | (if (i32.eq (local.get $kind) (i32.const 13)) ;; Uint8ClampedArray |
767 | 767 | (then (local.set $kind (i32.const 3)))) |
768 | 768 | (local.set $len (call $ta_length (local.get $data))) |
769 | 769 | (if (i32.lt_s (local.get $len) (i32.const 0)) |
770 | 770 | (then |
771 | 771 | (call $caml_invalid_argument |
772 | | - (array.new_data $string $ta_too_large |
| 772 | + (array.new_data $bytes $ta_too_large |
773 | 773 | (i32.const 0) (i32.const 34))))) |
774 | 774 | (struct.new $bigarray |
775 | 775 | (global.get $bigarray_ops) |
|
956 | 956 | (local.set $i (i31.get_s (ref.cast (ref i31) (local.get 1)))) |
957 | 957 | (if (i32.ge_u (local.get $i) (array.len (local.get $dim))) |
958 | 958 | (then (call $caml_invalid_argument |
959 | | - (array.new_data $string $Bigarray_dim |
| 959 | + (array.new_data $bytes $Bigarray_dim |
960 | 960 | (i32.const 0) (i32.const 12))))) |
961 | 961 | (ref.i31 (array.get $int_array (local.get $dim) (local.get $i)))) |
962 | 962 |
|
|
1321 | 1321 | (struct.get $bigarray $ba_num_dims (local.get $b))) |
1322 | 1322 | (then |
1323 | 1323 | (call $caml_invalid_argument |
1324 | | - (array.new_data $string $too_many_indices |
| 1324 | + (array.new_data $bytes $too_many_indices |
1325 | 1325 | (i32.const 0) (i32.const 32))))) |
1326 | 1326 | (local.set $sub_dim |
1327 | 1327 | (array.new $int_array (i32.const 0) |
|
1438 | 1438 | (local.get $changed_dim)))) |
1439 | 1439 | (then |
1440 | 1440 | (call $caml_invalid_argument |
1441 | | - (array.new_data $string $bad_subarray |
| 1441 | + (array.new_data $bytes $bad_subarray |
1442 | 1442 | (i32.const 0) (i32.const 27))))) |
1443 | 1443 | (local.set $new_dim |
1444 | 1444 | (array.new $int_array (i32.const 0) (local.get $num_dims))) |
|
1562 | 1562 | (struct.get $bigarray $ba_num_dims (local.get $src))) |
1563 | 1563 | (then |
1564 | 1564 | (call $caml_invalid_argument |
1565 | | - (array.new_data $string $dim_mismatch |
| 1565 | + (array.new_data $bytes $dim_mismatch |
1566 | 1566 | (i32.const 0) (i32.const 33))))) |
1567 | 1567 | (local.set $sdim (struct.get $bigarray $ba_dim (local.get $src))) |
1568 | 1568 | (local.set $ddim (struct.get $bigarray $ba_dim (local.get $dst))) |
|
1574 | 1574 | (array.get $int_array (local.get $ddim) (local.get $i))) |
1575 | 1575 | (then |
1576 | 1576 | (call $caml_invalid_argument |
1577 | | - (array.new_data $string $dim_mismatch |
| 1577 | + (array.new_data $bytes $dim_mismatch |
1578 | 1578 | (i32.const 0) (i32.const 33))))) |
1579 | 1579 | (local.set $i (i32.add (local.get $i) (i32.const 1))) |
1580 | 1580 | (br $loop)))) |
|
1599 | 1599 | (if (i32.gt_u (local.get $num_dims) (global.get $CAML_BA_MAX_NUM_DIMS)) |
1600 | 1600 | (then |
1601 | 1601 | (call $caml_invalid_argument |
1602 | | - (array.new_data $string $bad_number_dim |
| 1602 | + (array.new_data $bytes $bad_number_dim |
1603 | 1603 | (i32.const 0) (i32.const 42))))) |
1604 | 1604 | (local.set $num_elts (i64.const 1)) |
1605 | 1605 | (local.set $dim (array.new $int_array (i32.const 0) (local.get $num_dims))) |
|
1614 | 1614 | (if (i32.lt_s (local.get $d) (i32.const 0)) |
1615 | 1615 | (then |
1616 | 1616 | (call $caml_invalid_argument |
1617 | | - (array.new_data $string $negative_dim |
| 1617 | + (array.new_data $bytes $negative_dim |
1618 | 1618 | (i32.const 0) (i32.const 36))))) |
1619 | 1619 | (array.set $int_array (local.get $dim) (local.get $i) |
1620 | 1620 | (local.get $d)) |
|
1631 | 1631 | (struct.get $bigarray $ba_dim (local.get $b)))) |
1632 | 1632 | (then |
1633 | 1633 | (call $caml_invalid_argument |
1634 | | - (array.new_data $string $size_mismatch |
| 1634 | + (array.new_data $bytes $size_mismatch |
1635 | 1635 | (i32.const 0) (i32.const 31))))) |
1636 | 1636 | (struct.new $bigarray |
1637 | 1637 | (global.get $bigarray_ops) |
|
2025 | 2025 | (param (ref eq)) (result (ref eq)) |
2026 | 2026 | ;; used to convert a typed array to a string |
2027 | 2027 | (local $a (ref extern)) (local $len i32) |
2028 | | - (local $s (ref $string)) |
| 2028 | + (local $s (ref $bytes)) |
2029 | 2029 | (local.set $a |
2030 | 2030 | (ref.as_non_null (extern.convert_any (call $unwrap (local.get 0))))) |
2031 | 2031 | (local.set $len (call $ta_length (local.get $a))) |
2032 | | - (local.set $s (array.new $string (i32.const 0) (local.get $len))) |
| 2032 | + (local.set $s (array.new $bytes (i32.const 0) (local.get $len))) |
2033 | 2033 | (call $ta_blit_to_string |
2034 | 2034 | (local.get $a) (i32.const 0) (local.get $s) (i32.const 0) |
2035 | 2035 | (local.get $len)) |
|
2040 | 2040 | (param (ref eq)) (result (ref eq)) |
2041 | 2041 | ;; Convert a string to a typed array |
2042 | 2042 | (local $ta (ref extern)) (local $len i32) |
2043 | | - (local $s (ref $string)) |
2044 | | - (local.set $s (ref.cast (ref $string) (local.get 0))) |
| 2043 | + (local $s (ref $bytes)) |
| 2044 | + (local.set $s (ref.cast (ref $bytes) (local.get 0))) |
2045 | 2045 | (local.set $len (array.len (local.get $s))) |
2046 | 2046 | (local.set $ta |
2047 | 2047 | (call $ta_create |
|
2083 | 2083 |
|
2084 | 2084 | (func (export "string_set") |
2085 | 2085 | (param $s externref) (param $i i32) (param $v i32) |
2086 | | - (array.set $string |
2087 | | - (ref.cast (ref null $string) (any.convert_extern (local.get $s))) |
| 2086 | + (array.set $bytes |
| 2087 | + (ref.cast (ref null $bytes) (any.convert_extern (local.get $s))) |
2088 | 2088 | (local.get $i) (local.get $v))) |
2089 | 2089 |
|
2090 | 2090 | (func (export "string_get") |
2091 | 2091 | (param $s externref) (param $i i32) (result i32) |
2092 | | - (array.get $string |
2093 | | - (ref.cast (ref null $string) (any.convert_extern (local.get $s))) |
| 2092 | + (array.get $bytes |
| 2093 | + (ref.cast (ref null $bytes) (any.convert_extern (local.get $s))) |
2094 | 2094 | (local.get $i))) |
2095 | 2095 | ) |
0 commit comments