Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge wasm_of_ocaml #1724

Open
wants to merge 555 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
555 commits
Select commit Hold shift + click to select a range
180c365
Merge pull request #61 from OlivierNicole/upd-number
vouillon Aug 1, 2024
992cdf4
Lib: use number_t in yet a few more places
vouillon Jul 24, 2023
212e4c5
Merge pull request #62 from OlivierNicole/upd-number
vouillon Aug 2, 2024
26b2820
fix bounds check
TheNumbat Aug 11, 2024
5b6215e
Merge pull request #63 from TheNumbat/main
vouillon Aug 20, 2024
5b98a6f
Merge pull request #58 from ocaml-wasm/named-value
vouillon Aug 20, 2024
09a8700
fix(url.ml): set_fragment need not any urlencode
erikmd Jul 27, 2023
1540ceb
fix(url.ml): Simplify get_fragment as well
erikmd Aug 2, 2023
5417acb
Merge pull request #64 from OlivierNicole/converge-jsoo-merge-01
vouillon Aug 22, 2024
390f9d7
Simplify the insertion of locations in wasm code
vouillon Aug 30, 2024
6b08f13
Add possibly missing debug information at beginning of functions
vouillon Aug 30, 2024
4d34679
Reenable optimization prevented by the insertion of locations
vouillon Aug 30, 2024
fb964b6
Merge pull request #59 from OlivierNicole/add-primitives
vouillon Aug 30, 2024
b38e20d
added 'ellipse' method to canvasRenderingContext2D (#1555)
FayCarsons Jan 18, 2024
e30e540
Fix hyperbolic tree example
vouillon Jun 7, 2024
5a0a119
Lib: Dialog element support (#1257)
sagotch Feb 29, 2024
4ce9356
Lib: fix paragraph construction and coercion
gpetiot Mar 1, 2024
e3f7aa1
Lib: Add Typed_array.Bytes module (#1609)
johnridesabike May 3, 2024
de31b5a
Add download attribute to anchor element
slegrand45 Sep 3, 2023
6dc6697
Compiler: dedicated type for "special" values (#1573)
hhugo Mar 1, 2024
c860567
Compiler: remove last argument of Pushtrap (#1575)
hhugo Mar 1, 2024
5db44d2
Compiler: track block mutability (#1603)
hhugo Apr 18, 2024
e2c98ec
Compiler: lower level switch
hhugo Jul 27, 2023
3146b32
Compiler: fix free variable for classes (#1524)
hhugo Nov 11, 2023
0ef5c70
Compiler: minify labels
hhugo Aug 3, 2023
6beaabe
Compiler: fix es6 scopes
hhugo Nov 13, 2023
7977f85
Compiler: improve complexity in parser production
hhugo Oct 14, 2023
2263216
Compiler: support for es6 import/export (#1529)
hhugo Nov 26, 2023
924ab20
Compiler: lazy cmdliner term
hhugo Oct 14, 2023
ad7a1c8
Compiler: js-parser: fix class member printing
hhugo Dec 11, 2023
df89877
Compiler: js-parser: preserve consise body
hhugo Dec 17, 2023
d2b703a
Compiler: js-parser: fix assignment target
hhugo Dec 7, 2023
ba117ee
Compiler: Make it possible to link runtime JavaScript file together w…
vouillon Sep 11, 2023
fa2742a
Compiler: small refactoring
hhugo Apr 27, 2024
4f541b9
Compiler: refactoring
hhugo Apr 29, 2024
3694f14
Compiler: remove deprecated cmdline runtime-only flag
hhugo Apr 20, 2024
efbe91a
Compiler: refactoring
hhugo Apr 29, 2024
0c71444
Compiler: new include-partial-runtime flag
hhugo May 3, 2024
b4be113
Tests: add test for compact option
hhugo Feb 21, 2024
7eee7ed
Compiler: use consise body in arrow when es6 is enabled
hhugo Mar 8, 2024
7721b16
Misc: disable some test on older ocaml
hhugo May 13, 2024
1c17c1e
Rename `cps_calls` into `trampolined_calls` for clarity
OlivierNicole Jul 4, 2024
56919bc
Merge pull request #65 from OlivierNicole/converge-jsoo-merge-02
vouillon Sep 5, 2024
08316ce
Misc: yojson is no longer optional
hhugo Jul 22, 2024
3d1241e
Compiler: speedup json parsing, relying on Yojson.Raw (#1640)
hhugo Aug 3, 2024
c211d81
Adapt Source_map after ocsigen/js_of_ocaml#1640
OlivierNicole Aug 20, 2024
6e90b4e
Move Sexp functions to wasm/ subdirectory
OlivierNicole Aug 1, 2024
929eed2
Compiler: fix toplevel
hhugo Jun 28, 2024
2326bd1
Merge pull request #68 from OlivierNicole/converge-jsoo-merge-04
vouillon Sep 11, 2024
ec0e24c
Merge pull request #69 from OlivierNicole/converge-jsoo-merge-05
vouillon Sep 11, 2024
5e51faa
Merge pull request #66 from ocaml-wasm/debug-fixes
vouillon Sep 11, 2024
238e5eb
Merge pull request #67 from OlivierNicole/converge-jsoo-merge-03
vouillon Sep 11, 2024
e15a9bc
Updated dune support
vouillon Jul 4, 2024
e6dbb0f
Always put Wasm code and source map into an asset directory
vouillon Jun 25, 2024
8d502f6
Merge pull request #45 from ocaml-wasm/target-dir
vouillon Sep 11, 2024
60a1203
Merge pull request #53 from ocaml-wasm/extern-conv
vouillon Sep 11, 2024
c758982
JS runtime: only link jslib_js_of_ocaml.js
vouillon Sep 11, 2024
a02584d
No longer ignore always annotation
vouillon Sep 11, 2024
c0f0c8f
Handle primitives that depend on the OCaml version
OlivierNicole Sep 12, 2024
d30fe1f
Move version-dependant files to subdirectory
vouillon Sep 13, 2024
5e9c0ea
Small fix
vouillon Sep 13, 2024
6d43b92
Format dune file
vouillon Sep 13, 2024
9744f89
Fix link of packed modules
vouillon Sep 13, 2024
f41575c
Marshal header size change in OCaml 5.1
vouillon Sep 13, 2024
aaf4198
Merge pull request #73 from OlivierNicole/missing-prim
vouillon Sep 13, 2024
9a01ecd
Merge pull request #75 from ocaml-wasm/packed-modules
vouillon Sep 13, 2024
73b3791
Wasm code linker
vouillon Jun 4, 2024
7d2d95c
Generate one single wasm file per cma archive
vouillon Jun 4, 2024
5a45804
Wasm output
vouillon Jun 4, 2024
965988a
Start function: directly generate wasm code
vouillon Jun 4, 2024
ca9dcba
Support linking wasmo files into one wasma file
vouillon Jun 5, 2024
db04a4a
Merge pull request #72 from ocaml-wasm/reduced-js-runtime
vouillon Sep 13, 2024
b2ab3a2
Merge pull request #43 from ocaml-wasm/separate-compilation-v2
vouillon Sep 13, 2024
dd01986
ocamlformat
vouillon Sep 13, 2024
3a3ca74
Update outdated info in readme
OlivierNicole Sep 13, 2024
c290fb1
Update README.md
OlivierNicole Sep 16, 2024
ab2525d
Fix warning
vouillon Sep 16, 2024
dc6ebd8
Merge pull request #77 from ocaml-wasm/OlivierNicole-patch-1
vouillon Sep 16, 2024
cfcef83
Revert "No longer ignore always annotation"
vouillon Sep 17, 2024
d3969be
Revert "JS runtime: only link jslib_js_of_ocaml.js"
vouillon Sep 17, 2024
272422e
Merge pull request #78 from ocaml-wasm/runtime-fix
vouillon Sep 17, 2024
d8a442c
README: Pin more than just dune
JasonGross Sep 18, 2024
e8f80e0
Update README.md
JasonGross Sep 18, 2024
e9befa0
Update README.md
JasonGross Sep 18, 2024
65a9948
Refactor distinction between integer types
vouillon Jun 11, 2024
2034c19
Distinguish float field accesses in the Code IR
OlivierNicole Aug 28, 2024
1a24255
WSOO side of "Distinguish float field accesses in the Code IR"
OlivierNicole Sep 3, 2024
989a1d6
Fix build
OlivierNicole Sep 19, 2024
d7de3b6
Fixes
vouillon Sep 20, 2024
19f23aa
Merge pull request #79 from JasonGross/patch-2
vouillon Sep 20, 2024
8a8664d
Merge pull request #70 from OlivierNicole/converge-jsoo-merge-06
vouillon Sep 20, 2024
d4853b3
Compiler: fix link of packed modules
hhugo Jul 24, 2024
4174f52
JavaScript linker: make it easier to add flags
vouillon Sep 20, 2024
a40f9a0
Compiler: Document non-trivial function Code.constant_equal, and fix …
OlivierNicole Aug 27, 2024
48b465f
WSOO side of ocsigen/js_of_ocaml#1659
OlivierNicole Sep 3, 2024
68bf91e
Fixes
vouillon Sep 20, 2024
26864d1
Fix constant_identical for Wasm target
OlivierNicole Sep 20, 2024
cfc3028
Merge pull request #71 from OlivierNicole/converge-jsoo-merge-07
vouillon Sep 20, 2024
13128c5
Fix performance issue when assigning short names to variables
vouillon Sep 23, 2024
91cfd1b
Merge pull request #82 from ocaml-wasm/naming-fix
vouillon Sep 23, 2024
c4fa5d4
opam: requires ocaml >= 4.14
vouillon Sep 23, 2024
87f2119
ocamlformat
vouillon Sep 23, 2024
99c46f0
Compiler: nativeInt is always 32bit
hhugo Sep 26, 2024
2ab1d30
Target-specific code (#1655)
OlivierNicole Sep 27, 2024
f27e20b
WSOO side of Target-specific code
OlivierNicole Sep 30, 2024
af34f71
Upgrade Dune lang version
OlivierNicole Oct 1, 2024
b078432
No longer ignore always annotation
vouillon Sep 11, 2024
2a7f413
JavaScript linker: add 'wasm' flag
vouillon Sep 17, 2024
fb225da
Fixup: Fix Source_map uses
OlivierNicole Sep 20, 2024
b16557e
Realign Driver.optimize
OlivierNicole Oct 2, 2024
509636e
Fix Parse_bytecode types
OlivierNicole Oct 2, 2024
d4c21f5
Merge pull request #85 from OlivierNicole/converge-jsoo-merge-08
vouillon Oct 2, 2024
3e3bf3e
Merge remote-tracking branch 'jsoo/master' into jsoo-merge
OlivierNicole Oct 2, 2024
a6eefa0
Add Int31.of_int32_truncate
OlivierNicole Oct 2, 2024
00c87cb
Add some Source_map functions
OlivierNicole Oct 2, 2024
b886536
Remove special Undefined
OlivierNicole Oct 2, 2024
d3faed0
CI fixes
OlivierNicole Oct 2, 2024
af6384d
Fix compilation of the Wasm runtime under Windows.
vouillon Oct 3, 2024
a54ca81
Fix parsing test
vouillon Oct 4, 2024
db1de96
Merge pull request #86 from ocaml-wasm/jsoo-merge
OlivierNicole Oct 4, 2024
a6c7e89
Bump ocaml/setup-ocaml from 2 to 3
dependabot[bot] Oct 4, 2024
7cd0e59
Merge pull request #94 from ocaml-wasm/dependabot/github_actions/ocam…
vouillon Oct 4, 2024
d49fe94
Runtime: fix primitive selection for OCaml 5.01
vouillon Oct 4, 2024
0b4b6d3
Disable js_of_ocaml tests
vouillon Oct 4, 2024
dd3c5c1
CI: test with OCaml 5.01
vouillon Oct 4, 2024
bcc399f
Merge branch 'master' of github.com:ocsigen/js_of_ocaml into targetint
vouillon Oct 4, 2024
90db9c5
Wasm runtime: JavaScript clean-up
vouillon Oct 4, 2024
78760fd
Wasm runtime: reformat the JavaScript code
vouillon Oct 4, 2024
67d2add
Disable BLAKE2b tests for now
vouillon Oct 4, 2024
eb1128b
CI: test with OCaml 5.02
vouillon Oct 4, 2024
86d3f4b
CI: test with MacOS
vouillon Oct 4, 2024
ef0be34
Merge pull request #95 from ocaml-wasm/ci-mac
vouillon Oct 7, 2024
734dceb
Merge pull request #96 from ocaml-wasm/targetint
vouillon Oct 7, 2024
62fc9ed
CI fix
vouillon Oct 8, 2024
090b7b2
Runtime: typos
vouillon Oct 8, 2024
364c37c
WAT output: no longer emit 'pop' instructions
vouillon Oct 8, 2024
5f736b1
Use Js_of_ocaml_compiler.Structure instead of Wa_structure
vouillon Oct 8, 2024
f4f188a
Remove code corresponding to an hypothetical core Wasm support
vouillon Oct 8, 2024
c3cf34b
Calculate fetchBase once at toplevel
rickyvetter Oct 8, 2024
5105f11
Merge pull request #100 from rickyvetter/patch-1
vouillon Oct 9, 2024
058036f
Merge pull request #99 from ocaml-wasm/clean-up
vouillon Oct 9, 2024
1bc3ab8
Use static Object.hasOwn
rickyvetter Oct 14, 2024
548a3b2
Merge pull request #106 from rickyvetter/patch-2
vouillon Oct 15, 2024
38abfd5
Move boxing/unboxing outside of some runtime primitives
vouillon Sep 25, 2024
6d62d29
Bigstring: add JavaScript functions to access 2 or 4 bytes at once
vouillon Sep 26, 2024
c3ba995
Optimized blitting between strings and bigstrings
vouillon Sep 26, 2024
4206f85
Add --linkall option for compatibility with Js_of_ocaml
vouillon Oct 21, 2024
a4e7b05
Source maps: fix documentation of command line arguments
vouillon Oct 21, 2024
c2a49a5
Merge pull request #84 from ocaml-wasm/bigstring-perfs
vouillon Oct 23, 2024
886b6b2
Test float record with dead field
vouillon Oct 23, 2024
0b432e7
Fix bad interaction of deadcode elimination and unboxed float records
vouillon Oct 23, 2024
7a1d85c
Tests: more test for float conv
hhugo Oct 10, 2024
aede507
Runtime: make float_of_string strict
hhugo Oct 10, 2024
48c22c6
Stricter float_of_string
vouillon Oct 24, 2024
15bea92
Merge pull request #108 from ocaml-wasm/dead-code-fix
vouillon Oct 24, 2024
102f8dd
Merge pull request #110 from ocaml-wasm/float_of_string
vouillon Oct 24, 2024
3698fe4
JavaScript if statement simplification: use appropriate locations
vouillon Oct 18, 2024
f1f0d24
Add location after return statement
vouillon Oct 18, 2024
d1ecd6b
Add location on new expression
vouillon Oct 18, 2024
eba73eb
Move source code location resolution from code output to code generation
vouillon Oct 22, 2024
fdbc151
Test: miscompilation of float array creation
vouillon Oct 24, 2024
65e727a
Fix creation of float arrays
vouillon Oct 24, 2024
badd68f
Merge remote-tracking branch 'jsoo/master' into jsoo
vouillon Oct 24, 2024
0310c5c
Add more tests of caml_make_array
vouillon Oct 24, 2024
fb4d189
Merge pull request #111 from ocaml-wasm/jsoo
vouillon Oct 24, 2024
c1390f7
Merge pull request #113 from ocaml-wasm/caml-make-array
vouillon Oct 24, 2024
9293f3f
Wasm linker fixes
vouillon Oct 24, 2024
ea93a52
Sourcemap improvements
vouillon Oct 24, 2024
3547c4c
Merge pull request #118 from ocaml-wasm/sm
vouillon Oct 29, 2024
b37c665
Compile a raise within a try as a branch to the exception handler
vouillon Oct 29, 2024
dea31d2
Delete asset directory if it already exists
vouillon Oct 29, 2024
f428e0e
Github action: automatically merge with js_of_ocaml
vouillon Oct 10, 2024
f33288a
Update README.md
vouillon Oct 29, 2024
ba44373
Source map: align with Js_of_ocaml
vouillon Oct 29, 2024
d6b458d
Run Bonsai test with profile release as well
vouillon Oct 30, 2024
5cf44d5
Make sure we open files in binary mode
vouillon Oct 31, 2024
93d7e83
Remove dead comments, use better exceptions
OlivierNicole Nov 4, 2024
eca029f
Source maps: possibility to reuse a temporary buffer when parsing
vouillon Nov 4, 2024
065f096
Bump actions/checkout from 3 to 4
dependabot[bot] Nov 4, 2024
85bfcb0
Merge pull request #124 from ocaml-wasm/dependabot/github_actions/act…
vouillon Nov 4, 2024
37dc530
Merge pull request #121 from OlivierNicole/cr-hhugo
vouillon Nov 4, 2024
5072ad2
Use dune tests
vouillon Jun 26, 2024
cfba5c3
Compiler tests: lighter conditions
vouillon Nov 2, 2024
a84940d
Quiet biome warning regarding "use strict".
vouillon Nov 4, 2024
04db0cc
Source maps: avoid some code duplication
vouillon Nov 4, 2024
bd6e015
Merge pull request #122 from ocaml-wasm/source-map-merge
vouillon Nov 5, 2024
1d6036f
Move compiler/lib/wasm to compiler/lib-wasm
vouillon Nov 4, 2024
a3498e0
Merge pull request #125 from ocaml-wasm/move-wasm-lib
vouillon Nov 5, 2024
9d89eff
Merge pull request #123 from ocaml-wasm/use-strict
vouillon Nov 5, 2024
6fe39a2
Merge pull request #120 from ocaml-wasm/tests
vouillon Nov 5, 2024
d323e66
Dune file formatting changes
vouillon Nov 4, 2024
9e5006f
Revised dune support
vouillon Oct 31, 2024
47f0707
Library tests: lighter conditions
vouillon Nov 4, 2024
b0c7c99
Update Yojson dependency
vouillon Nov 5, 2024
bd01184
Use a try_table like instruction internally
vouillon Jul 4, 2024
bdf5c00
CI: pin main branch of dune
vouillon Nov 5, 2024
ee35863
Update README.md
vouillon Nov 6, 2024
d7bf42c
Merge pull request #126 from ocaml-wasm/wasm-dune
vouillon Nov 6, 2024
a1d6554
Renamed Wa_ast into Wasm_ast
vouillon Nov 6, 2024
40f4d4e
Renamed more files
vouillon Nov 6, 2024
f51c956
Renamed more files
vouillon Nov 6, 2024
02b848f
Renamed remaining files
vouillon Nov 6, 2024
34bfa2a
Update .git-blame-ignore-revs
vouillon Nov 6, 2024
1a7305e
Merge pull request #127 from ocaml-wasm/renamings
vouillon Nov 6, 2024
e660725
Always enable tests-jsoo/lib-effects tests for OCaml >= 5.0
vouillon Nov 6, 2024
aa1c9c9
Tests: use an environment variable to know whether we are testing Was…
vouillon Nov 5, 2024
9d6df66
Merge pull request #128 from ocaml-wasm/env-var
vouillon Nov 6, 2024
1d9ac93
Tests: clean-up lib-effects tests
vouillon Nov 7, 2024
49eb19f
cleanup
hhugo Nov 6, 2024
1c536c2
Wasm source map resizing: clean-up
vouillon Nov 7, 2024
7e071a6
Make it explicit when we manipulate standard source maps
vouillon Nov 7, 2024
b5ae6af
Source map related code clean-up
vouillon Nov 7, 2024
c04eca5
Add missing copyright headers
vouillon Nov 7, 2024
a42f326
Cmdliner documentation update
vouillon Nov 7, 2024
370ef42
CI updates
vouillon Nov 7, 2024
ab1faf2
Merge pull request #129 from ocaml-wasm/wasm-source-maps
vouillon Nov 7, 2024
539390d
Typo
vouillon Nov 8, 2024
73df0b4
Fix CI
vouillon Nov 22, 2024
416dfd2
Fix optimization of JavaScript interoperability primitives
vouillon Nov 22, 2024
59f3462
Optimized JavaScript property accesses when using an OCaml string as …
vouillon Nov 22, 2024
7bfec53
Merge pull request #130 from ocaml-wasm/js-prim-fixes
vouillon Nov 26, 2024
6aac869
Update to new JavaScript-Promise Integration API
vouillon Apr 19, 2024
1189e53
CI: move
hhugo Nov 20, 2024
d1566a4
Release 5.9 (#1735)
hhugo Nov 22, 2024
5220982
Misc: adjust opam constraint (#1742)
hhugo Nov 23, 2024
3785e99
Lib: small refactoring around js exception printing (#1743)
hhugo Nov 25, 2024
3e12e52
CI: move
hhugo Nov 20, 2024
ae1284b
Fix ci mac (#1744)
hhugo Nov 25, 2024
825941b
Tests: recursive value compilation
hhugo Nov 18, 2024
e16f8e3
Misc: remove macos CI fix
hhugo Nov 26, 2024
285376a
Tests: promote with new compilation strategy
hhugo Nov 18, 2024
be634ad
Merge branch 'master' of github.com:ocsigen/js_of_ocaml into jsoo-merge
vouillon Nov 26, 2024
5e25815
CI: explicitly set version of all jsoo packages
vouillon Nov 25, 2024
1f11a80
Formatting
vouillon Nov 25, 2024
3c9036a
Merge pull request #48 from ocaml-wasm/updated-jspi
vouillon Nov 26, 2024
52c69c8
Merge pull request #131 from ocaml-wasm/jsoo-merge
vouillon Nov 26, 2024
bb3fb63
Merge branch 'master' of github.com:ocsigen/js_of_ocaml into jsoo-merge
vouillon Nov 26, 2024
ad1676f
No longer pin dune
vouillon Nov 29, 2024
a0b5b8c
Reformat dune files
vouillon Nov 29, 2024
97db4d6
Misc: bump test dep
hhugo Nov 27, 2024
e83dd90
Merge pull request #133 from ocaml-wasm/dune-released
vouillon Nov 29, 2024
6239d59
Use JS String Builtins to convert ASCII OCaml strings to Javascript s…
vouillon Nov 26, 2024
4f76417
Merge pull request #132 from ocaml-wasm/string-conv
vouillon Dec 2, 2024
3656b8f
Update examples
vouillon Nov 29, 2024
b12f852
Merge pull request #134 from ocaml-wasm/examples
vouillon Dec 2, 2024
2e14088
Merge remote-tracking branch 'jsoo/master' into jsoo-merge
vouillon Dec 2, 2024
e6ca2d3
Merge pull request #135 from ocaml-wasm/jsoo-merge
vouillon Dec 2, 2024
07e1752
Revert "Github action: automatically merge with js_of_ocaml"
vouillon Nov 6, 2024
6e4d795
Move READMEs
vouillon Nov 6, 2024
b8ee2b4
Changelog
vouillon Nov 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@
7de742a776fcdad4b098695617b9e7afab822c82
# Biome
5a78e2466221c91fc3607be5b6549797551de4d1
# Wasm_of_ocaml: renamed files
02b848f0dae1924326aceb5e2b689eb4870b9e0c
f51c956d4294c55b45a05fa6520cb5cdc9e2ade3
40f4d4e4034d8fd21e28d74e5ff127dcd3fec37d
a1d6554ea9d055f817edea5d32e485d836001cb3
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
*.ml linguist-language=OCaml
*.mli linguist-language=OCaml

# We are pinning wasm_of_ocaml using this file in the CI. This would
# fail on Windows otherwise.
VERSION -text
183 changes: 183 additions & 0 deletions .github/workflows/build-wasm_of_ocaml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
name: Build wasm_of_ocaml

on:
pull_request:
push:

jobs:
build:
env:
OPAMJOBS: 2
OPAMYES: true

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
ocaml-compiler:
- 4.14.x
- 5.00.x
- 5.01.x
- 5.02.x
separate_compilation:
- true
include:
- os: macos-latest
ocaml-compiler: 5.02.x
separate_compilation: true
- os: ubuntu-latest
ocaml-compiler: 4.14.x
separate_compilation: false

runs-on: ${{ matrix.os }}

steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
git config --global core.ignorecase false

- name: Install node
uses: actions/setup-node@v4
with:
node-version: 23

- name: Restore cached binaryen
id: cache-binaryen
uses: actions/cache/restore@v4
with:
path: binaryen
key: ${{ runner.os }}-binaryen-version_118

- name: Checkout binaryen
if: steps.cache-binaryen.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: WebAssembly/binaryen
path: binaryen
submodules: true
ref: version_118

- name: Install ninja (Ubuntu)
if: matrix.os == 'ubuntu-latest' && steps.cache-binaryen.outputs.cache-hit != 'true'
run: sudo apt-get install ninja-build

- name: Install ninja (MacOS)
if: matrix.os == 'macos-latest' && steps.cache-binaryen.outputs.cache-hit != 'true'
run: brew install ninja

- name: Build binaryen
if: steps.cache-binaryen.outputs.cache-hit != 'true'
working-directory: ./binaryen
run: |
cmake -G Ninja .
ninja

- name: Cache binaryen
if: steps.cache-binaryen.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: binaryen
key: ${{ runner.os }}-binaryen-version_118

- name: Set binaryen's path
run: |
echo "$GITHUB_WORKSPACE/binaryen/bin" >> $GITHUB_PATH

- name: Install OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}

- name: Checkout code
uses: actions/checkout@v4
with:
path: wasm_of_ocaml

- name: Pin faked binaryen-bin package
# It's faster to use a cached version
run: opam install --fake binaryen-bin

- name: Checkout Jane Street opam repository
uses: actions/checkout@v4
with:
repository: janestreet/opam-repository
ref: feaf8f831051fd5f316963b28efd728cf0b0eca1
path: jane-street/opam-repository

- name: Pin wasm_of_ocaml
working-directory: ./wasm_of_ocaml
run: opam pin -n --with-version `< VERSION` .

- name: Install some needed packages
run: opam install opam-format ocamlfind dune graphics cmdliner sexplib0.v0.16.0

- name: Checkout Jane Street packages
run: opam exec -- ocaml wasm_of_ocaml/tools/ci_setup.ml

- name: Install wasm_of_ocaml and its test dependencies
working-directory: ./wasm_of_ocaml
run: |
opam install `basename -s .opam *.opam` num cohttp-lwt-unix ppx_expect cstruct

- name: Run tests
if: ${{ matrix.separate_compilation }}
working-directory: ./wasm_of_ocaml
run: opam exec -- dune build @all @runtest --profile wasm

- name: Run tests with CPS effects
if: ${{ matrix.ocaml-compiler >= '5.' && matrix.separate_compilation }}
working-directory: ./wasm_of_ocaml
run: opam exec -- dune build @all @runtest --profile wasm-effects

- name: Run Base tests
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
working-directory: ./jane-street/lib/base
run: opam exec -- dune runtest

- name: Run Base bigstring tests
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
working-directory: ./jane-street/lib/base_bigstring
run: opam exec -- dune runtest

- name: Run Core tests
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
working-directory: ./jane-street/lib/core
run: opam exec -- dune runtest

- name: Run Bignum tests
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
working-directory: ./jane-street/lib/bignum
run: opam exec -- dune runtest

- name: Run Bin_prot tests
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
working-directory: ./jane-street/lib/bin_prot
run: opam exec -- dune runtest

- name: Run String_dict tests
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
working-directory: ./jane-street/lib/string_dict
run: opam exec -- dune runtest

- name: Run Zarith tests
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
working-directory: ./jane-street/lib/zarith_stubs_js
run: opam exec -- dune runtest

- name: Run Virtual_dom tests
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
working-directory: ./jane-street/lib/virtual_dom
run: opam exec -- dune runtest

- name: Run Bonsai tests
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
working-directory: ./jane-street/lib/bonsai
run: opam exec -- dune runtest

- name: Run Bonsai tests (release profile)
if: ${{ ! matrix.separate_compilation }}
working-directory: ./jane-street/lib/bonsai
run: opam exec -- dune runtest --profile release
18 changes: 16 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,21 @@ jobs:
- run: opam install . --best-effort
if: ${{ matrix.skip-test }}

- run: opam install . --with-test
- run: cat VERSION | xargs opam pin . -n --with-version
if: ${{ !matrix.skip-test }}
shell: bash

- run: opam install conf-c++
# Otherwise, the next step fails reinstalling gcc while compiling
# other packages
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installing binaryen is pretty slow. I wonder if should not do it here and only do it in build-wasm_of_ocaml.yml.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the issue is that dune build @all will invoke wasm-merge and wasm-opt to build runtime/wasm/runtime.wasm.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could cache binaryen, as is done in build-wasm_of_ocaml.yml

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try that

if: ${{ !matrix.skip-test && runner.os == 'Windows' }}

- run: opam install . --with-test --deps-only
# Install the test dependencies
if: ${{ !matrix.skip-test }}

- run: opam install .
# Install the packages (without running the tests)
if: ${{ !matrix.skip-test }}

- run: opam exec -- make all
Expand Down Expand Up @@ -146,4 +160,4 @@ jobs:
branch: wikidoc
folder: doc-dev
clean: true
target-folder: doc/dev/
target-folder: doc/dev/
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Features/Changes
* Lib: fix the type of some DOM properties and methods (#1747)
* Test: use dune test stanzas (#1631)
* Merged Wasm_of_ocaml (#1724)

# 5.9.1 (02-12-2024) - Lille

Expand Down
68 changes: 68 additions & 0 deletions README_wasm_of_ocaml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Wasm_of_ocaml

Wasm_of_ocaml is a fork of Js_of_ocaml which compiles OCaml bytecode to WebAssembly.

## Supported engines

The generated code works with Chrome 11.9, Node.js 22 and Firefox 122 (or more recent versions of these applications).

In particular, the output code requires the following [Wasm extensions](https://webassembly.org/roadmap/) to run:
- [the GC extension](https://github.com/WebAssembly/gc), including functional references and 31-bit integers
- [the tail-call extension](https://github.com/WebAssembly/tail-call/blob/main/proposals/tail-call/Overview.md)
- [the exception handling extension](https://github.com/WebAssembly/exception-handling/blob/master/proposals/exception-handling/Exceptions.md)

OCaml 5.x code using effect handlers can be compiled in two different ways:
One can enable the CPS transformation from `js_of_ocaml` by passing the
`--enable=effects` flag. Without the flag `wasm_of_ocaml` will instead emit code
utilizing
- [the JavaScript-Promise Integration extension](https://github.com/WebAssembly/js-promise-integration/blob/main/proposals/js-promise-integration/Overview.md)


## Installation

The following commands will perform a minimal installation:
```
git clone https://github.com/ocaml-wasm/wasm_of_ocaml
cd wasm_of_ocaml
opam pin add -n --with-version 6.0.0 .
opam install dune.3.17.0 wasm_of_ocaml-compiler
```
You may want to install additional packages. For instance:

```
opam install js_of_ocaml-ppx js_of_ocaml-lwt
```

## Usage

You can try compiling the program in `examples/cubes`. Your program must first be compiled using the OCaml bytecode compiler `ocamlc`. JavaScript bindings are provided by the `js_of_ocaml` package. The syntax extension is provided by `js_of_ocaml-ppx` package. Package `js_of_ocaml-lwt` provides Javascript specific Lwt functions.

```
ocamlfind ocamlc -package js_of_ocaml,js_of_ocaml-ppx,js_of_ocaml-lwt -linkpkg -o cubes.byte cubes.mli cubes.ml
```

Then, run the `wasm_of_ocaml` compiler to produce WebAssembly code:

```
wasm_of_ocaml cubes.byte
```

This outputs a file `cubes.js` which loads the WebAssembly code from file `cube.wasm`. For debugging, we currently also output the generated WebAssembly code in text file to `cube.wat`. Since Chrome does not allow loading from the filesystem, you need to serve the files using some Web server. For instance:
```
python3 -m http.server 8000 --directory .
```

As a larger example, you can try [CAMLBOY](https://github.com/linoscope/CAMLBOY). You need to install a forked version of [Brr](https://github.com/ocaml-wasm/brr/tree/wasm). Once the Js_of_ocaml UI is compiled (with `dune build --profile release`), you can generate WebAssembly code instead with the following command:
```
wasm_of_ocaml _build/default/bin/web/index.bc-for-jsoo
```

## Implementation status

A large part of the runtime is [implemented](https://github.com/ocaml-wasm/wasm_of_ocaml/issues/5). File-related functions and dynamic linking are not supported yet.

## Compatibility with Js_of_ocaml

Since the value representation is different, some adaptations are necessary.

The most notable change is that, except for integers, OCaml numbers are no longer mapped to JavaScript numbers. So, explicit conversions `Js.to_float` and `Js.float` are now necessary to convert between OCaml floats and JavaScript numbers. The typing of JavaScript Typed Arrays has also been changed to deal with this.
29 changes: 29 additions & 0 deletions compiler/bin-wasm_of_ocaml/build_runtime.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
(* Wasm_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

open! Js_of_ocaml_compiler.Stdlib

let info =
Info.make
~name:"build-runtime"
~doc:"Build standalone runtime. Used for separate compilation."
~description:"Wasm_of_ocaml is a compiler from OCaml bytecode to WebAssembly."

let command =
let t = Cmdliner.Term.(const Compile.run $ Cmd_arg.options_runtime_only) in
Cmdliner.Cmd.v info t
19 changes: 19 additions & 0 deletions compiler/bin-wasm_of_ocaml/build_runtime.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
(* Wasm_of_ocaml compiler
* http://www.ocsigen.org/js_of_ocaml/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, with linking exception;
* either version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*)

val command : unit Cmdliner.Cmd.t
Loading
Loading