Skip to content

Commit fc27a39

Browse files
committed
OxCaml runtime: local variant of some primitives
1 parent 7c2acea commit fc27a39

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

runtime/js/array.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
///////////// Array
1919

2020
//Provides: caml_array_sub mutable
21+
//Alias: caml_array_sub_local
2122
function caml_array_sub(a, i, len) {
2223
var a2 = new Array(len + 1);
2324
a2[0] = 0;
@@ -42,6 +43,7 @@ function caml_uniform_array_sub(a, i, len) {
4243
}
4344

4445
//Provides: caml_array_append mutable
46+
//Alias: caml_array_append_local
4547
function caml_array_append(a1, a2) {
4648
var l1 = a1.length,
4749
l2 = a2.length;
@@ -70,6 +72,7 @@ function caml_uniform_array_append(a1, a2) {
7072
}
7173

7274
//Provides: caml_array_concat mutable
75+
//Alias: caml_array_concat_local
7376
function caml_array_concat(l) {
7477
var a = [0];
7578
while (l !== 0) {
@@ -228,6 +231,7 @@ function caml_array_create_float(len) {
228231
}
229232
//Provides: caml_floatarray_create const (const)
230233
//Requires: caml_array_bound_error
234+
//Alias: caml_floatarray_create_local
231235
function caml_floatarray_create(len) {
232236
if (len >>> 0 >= ((0x7fffffff / 8) | 0)) caml_array_bound_error();
233237
var len = (len + 1) | 0;

runtime/js/mlBytes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ function caml_create_string(_len) {
390390

391391
//Provides: caml_create_bytes const
392392
//Requires: MlBytes,caml_invalid_argument
393+
//Alias: caml_create_local_bytes
393394
function caml_create_bytes(len) {
394395
if (len < 0) caml_invalid_argument("Bytes.create");
395396
return new MlBytes(len ? 2 : 9, "", len);

runtime/wasm/array.wat

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363
(func $caml_floatarray_create
6464
(export "caml_make_float_vect") (export "caml_floatarray_create")
65-
(export "caml_array_create_float")
65+
(export "caml_array_create_float") (export "caml_floatarray_create_local")
6666
(param $n (ref eq)) (result (ref eq))
6767
(local $sz i32)
6868
(local.set $sz (i31.get_s (ref.cast (ref i31) (local.get $n))))
@@ -110,7 +110,7 @@
110110
(struct.get $float 0 (ref.cast (ref $float) (local.get $v))))
111111
(ref.i31 (i32.const 0)))
112112

113-
(func (export "caml_array_sub")
113+
(func (export "caml_array_sub") (export "caml_array_sub_local")
114114
(param $a (ref eq)) (param $i (ref eq)) (param $vlen (ref eq))
115115
(result (ref eq))
116116
(local $a1 (ref $block)) (local $a2 (ref $block)) (local $len i32)
@@ -163,7 +163,7 @@
163163
(local.get $len))
164164
(local.get $a'))
165165

166-
(func (export "caml_array_append")
166+
(func (export "caml_array_append") (export "caml_array_append_local")
167167
(param $va1 (ref eq)) (param $va2 (ref eq)) (result (ref eq))
168168
(local $a1 (ref $block)) (local $a2 (ref $block)) (local $a (ref $block))
169169
(local $fa1 (ref $float_array)) (local $fa2 (ref $float_array))
@@ -235,7 +235,8 @@
235235
(return (local.get $fa))))
236236
(return_call $caml_floatarray_dup (local.get $fa1)))
237237

238-
(func (export "caml_array_concat") (param (ref eq)) (result (ref eq))
238+
(func (export "caml_array_concat") (export "caml_array_concat_local")
239+
(param (ref eq)) (result (ref eq))
239240
(local $i i32) (local $len i32)
240241
(local $l (ref eq)) (local $v (ref eq))
241242
(local $isfloat i32)

runtime/wasm/string.wat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121

122122
(@string $Bytes_create "Bytes.create")
123123

124-
(func (export "caml_create_bytes")
124+
(func (export "caml_create_bytes") (export "caml_create_local_bytes")
125125
(param $len (ref eq)) (result (ref eq))
126126
(local $l i32)
127127
(local.set $l (i31.get_s (ref.cast (ref i31) (local.get $len))))

0 commit comments

Comments
 (0)