Skip to content

Commit 05d9dc3

Browse files
authored
Merge pull request #57 from ocaml-wasm/wasm
Wasm_of_ocaml runtime file
2 parents 39a242e + 045094d commit 05d9dc3

File tree

4 files changed

+45
-4
lines changed

4 files changed

+45
-4
lines changed

bigstringaf.opam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ build: [
2020
]
2121
]
2222
depends: [
23-
"dune" {>= "3.0"}
24-
"dune-configurator" {>= "3.0"}
23+
"dune" {>= "3.17"}
24+
"dune-configurator" {>= "3.17"}
2525
"alcotest" {with-test}
2626
"ocaml" {>= "4.08.0"}
2727
]

dune-project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
(lang dune 3.0)
1+
(lang dune 3.17)
22
(name bigstringaf)
33
(formatting (enabled_for dune))

lib/dune

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
(:standard
99
(:include cflags.sexp))))
1010
(js_of_ocaml
11-
(javascript_files runtime.js)))
11+
(javascript_files runtime.js))
12+
(wasm_of_ocaml
13+
(javascript_files runtime.js)
14+
(wasm_files runtime.wat)))
1215

1316
(rule
1417
(targets cflags.sexp)

lib/runtime.wat

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
(module
2+
(import "env" "caml_bigstring_blit_ba_to_ba"
3+
(func $bigstringaf_blit_to_bigstring
4+
(param (ref eq)) (param (ref eq)) (param (ref eq)) (param (ref eq))
5+
(param (ref eq)) (result (ref eq))))
6+
(import "env" "caml_bigstring_blit_bytes_to_ba"
7+
(func $bigstringaf_blit_from_bytes
8+
(param (ref eq)) (param (ref eq)) (param (ref eq)) (param (ref eq))
9+
(param (ref eq)) (result (ref eq))))
10+
(import "env" "caml_bigstring_blit_ba_to_bytes"
11+
(func $bigstringaf_blit_to_bytes
12+
(param (ref eq)) (param (ref eq)) (param (ref eq)) (param (ref eq))
13+
(param (ref eq)) (result (ref eq))))
14+
(import "env" "caml_bigstring_memcmp"
15+
(func $bigstringaf_memcmp_bigstring
16+
(param (ref eq)) (param (ref eq)) (param (ref eq)) (param (ref eq))
17+
(param (ref eq)) (result (ref eq))))
18+
(import "env" "caml_bigstring_memcmp_string"
19+
(func $bigstringaf_memcmp_string
20+
(param (ref eq)) (param (ref eq)) (param (ref eq)) (param (ref eq))
21+
(param (ref eq)) (result (ref eq))))
22+
(import "env" "caml_bigstring_memchr"
23+
(func $caml_bigstring_memchr
24+
(param (ref eq)) (param (ref eq)) (param (ref eq)) (param (ref eq))
25+
(result (ref eq))))
26+
27+
(export "bigstringaf_blit_to_bytes" (func $bigstringaf_blit_to_bytes))
28+
(export "bigstringaf_blit_to_bigstring" (func $bigstringaf_blit_to_bigstring))
29+
(export "bigstringaf_blit_from_bytes" (func $bigstringaf_blit_from_bytes))
30+
(export "bigstringaf_memcmp_bigstring" (func $bigstringaf_memcmp_bigstring))
31+
(export "bigstringaf_memcmp_string" (func $bigstringaf_memcmp_string))
32+
33+
(func (export "bigstringaf_memchr")
34+
(param $ba (ref eq)) (param $off (ref eq)) (param $chr (ref eq))
35+
(param $len (ref eq)) (result (ref eq))
36+
(return_call $caml_bigstring_memchr
37+
(local.get $ba) (local.get $chr) (local.get $off) (local.get $len)))
38+
)

0 commit comments

Comments
 (0)