Skip to content

Commit

Permalink
Wasm runtime file
Browse files Browse the repository at this point in the history
  • Loading branch information
vouillon committed Dec 19, 2024
1 parent 23401ac commit 4294aed
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
(:standard
(:include cflags.sexp))))
(js_of_ocaml
(javascript_files runtime.js)))
(javascript_files runtime.js)
(wasm_files runtime.wat)))

(rule
(targets cflags.sexp)
Expand Down
38 changes: 38 additions & 0 deletions lib/runtime.wat
Original file line number Diff line number Diff line change
@@ -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)))
)

0 comments on commit 4294aed

Please sign in to comment.