From e475b15361de369929bef432a130f0ced95ceeda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Tue, 5 Sep 2023 12:37:22 +0200 Subject: [PATCH 1/2] Update dune version --- bigstringaf.opam | 4 ++-- dune-project | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bigstringaf.opam b/bigstringaf.opam index 52264a1..81f4095 100644 --- a/bigstringaf.opam +++ b/bigstringaf.opam @@ -20,8 +20,8 @@ build: [ ] ] depends: [ - "dune" {>= "3.0"} - "dune-configurator" {>= "3.0"} + "dune" {>= "3.17"} + "dune-configurator" {>= "3.17"} "alcotest" {with-test} "ocaml" {>= "4.08.0"} ] diff --git a/dune-project b/dune-project index efb9888..c93322e 100644 --- a/dune-project +++ b/dune-project @@ -1,3 +1,3 @@ -(lang dune 3.0) +(lang dune 3.17) (name bigstringaf) (formatting (enabled_for dune)) From 045094d3edcc96c501d4220c4061e53e9613ffa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Thu, 13 Jul 2023 16:42:55 +0200 Subject: [PATCH 2/2] Wasm runtime file --- lib/dune | 5 ++++- lib/runtime.wat | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 lib/runtime.wat diff --git a/lib/dune b/lib/dune index 9e7ced6..33e95aa 100644 --- a/lib/dune +++ b/lib/dune @@ -8,7 +8,10 @@ (:standard (:include cflags.sexp)))) (js_of_ocaml - (javascript_files runtime.js))) + (javascript_files runtime.js)) + (wasm_of_ocaml + (javascript_files runtime.js) + (wasm_files runtime.wat))) (rule (targets cflags.sexp) diff --git a/lib/runtime.wat b/lib/runtime.wat new file mode 100644 index 0000000..2fdcf55 --- /dev/null +++ b/lib/runtime.wat @@ -0,0 +1,38 @@ +(module + (import "env" "caml_bigstring_blit_ba_to_ba" + (func $bigstringaf_blit_to_bigstring + (param (ref eq)) (param (ref eq)) (param (ref eq)) (param (ref eq)) + (param (ref eq)) (result (ref eq)))) + (import "env" "caml_bigstring_blit_bytes_to_ba" + (func $bigstringaf_blit_from_bytes + (param (ref eq)) (param (ref eq)) (param (ref eq)) (param (ref eq)) + (param (ref eq)) (result (ref eq)))) + (import "env" "caml_bigstring_blit_ba_to_bytes" + (func $bigstringaf_blit_to_bytes + (param (ref eq)) (param (ref eq)) (param (ref eq)) (param (ref eq)) + (param (ref eq)) (result (ref eq)))) + (import "env" "caml_bigstring_memcmp" + (func $bigstringaf_memcmp_bigstring + (param (ref eq)) (param (ref eq)) (param (ref eq)) (param (ref eq)) + (param (ref eq)) (result (ref eq)))) + (import "env" "caml_bigstring_memcmp_string" + (func $bigstringaf_memcmp_string + (param (ref eq)) (param (ref eq)) (param (ref eq)) (param (ref eq)) + (param (ref eq)) (result (ref eq)))) + (import "env" "caml_bigstring_memchr" + (func $caml_bigstring_memchr + (param (ref eq)) (param (ref eq)) (param (ref eq)) (param (ref eq)) + (result (ref eq)))) + + (export "bigstringaf_blit_to_bytes" (func $bigstringaf_blit_to_bytes)) + (export "bigstringaf_blit_to_bigstring" (func $bigstringaf_blit_to_bigstring)) + (export "bigstringaf_blit_from_bytes" (func $bigstringaf_blit_from_bytes)) + (export "bigstringaf_memcmp_bigstring" (func $bigstringaf_memcmp_bigstring)) + (export "bigstringaf_memcmp_string" (func $bigstringaf_memcmp_string)) + + (func (export "bigstringaf_memchr") + (param $ba (ref eq)) (param $off (ref eq)) (param $chr (ref eq)) + (param $len (ref eq)) (result (ref eq)) + (return_call $caml_bigstring_memchr + (local.get $ba) (local.get $chr) (local.get $off) (local.get $len))) +)