Skip to content

Consume Hints produced by ocaml#13438 #1721

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

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 9 additions & 1 deletion .github/workflows/js_of_ocaml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ jobs:
skip-doc: true
- os: ubuntu-latest
os-name: Ubuntu
ocaml-compiler: "5.3"
ocaml-name: "5.3.1+pr"
ocaml-compiler: "ocaml-variants.5.3.1+trunk"
skip-effects: false
skip-test: false
skip-doc: false
Expand Down Expand Up @@ -130,6 +131,10 @@ jobs:
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}

- name: patch compiler
if: matrix.ocaml-compiler == 'ocaml-variants.5.3.1+trunk'
run: opam pin ocaml-variants https://github.com/hhugo/ocaml.git#optimization-hints

# Work-around a race between reinstalling mingw-w64-shims
# (because of conf-pkg-config optional dep) and installing other
# packages that implicitly depend on mingw-w64-shims.
Expand All @@ -145,6 +150,9 @@ jobs:
# It's faster to use a cached version
run: opam install --fake binaryen-bin

- name: pin dune
run: opam pin add dune https://github.com/hhugo/dune.git#jsoo-shape2

- run: opam install . --best-effort --solver builtin-mccs+glpk
if: ${{ matrix.skip-test }}

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/wasm_of_ocaml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ jobs:
- run: opam install conf-pkg-config conf-mingw-w64-gcc-i686 conf-mingw-w64-g++-x86_64
if: runner.os == 'Windows'

- name: pin dune
run: opam pin add dune https://github.com/hhugo/dune.git#jsoo-shape2

- name: Pin wasm_of_ocaml
working-directory: ./wasm_of_ocaml
run: opam pin . -n --with-version dev
Expand Down
10 changes: 10 additions & 0 deletions compiler/lib-wasm/generate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,26 @@ module Generate (Target : Target_sig.S) = struct
; "caml_nativeint_compare", (`Pure, [ Nativeint; Nativeint ], Value)
; "caml_int64_compare", (`Pure, [ Int64; Int64 ], Value)
; "caml_string_get32", (`Mutator, [ Value; Value ], Int32)
; "caml_string_get32u", (`Mutator, [ Value; Value ], Int32)
; "caml_string_get64", (`Mutator, [ Value; Value ], Int64)
; "caml_string_get64u", (`Mutator, [ Value; Value ], Int64)
; "caml_bytes_get32", (`Mutator, [ Value; Value ], Int32)
; "caml_bytes_get32u", (`Mutator, [ Value; Value ], Int32)
; "caml_bytes_get64", (`Mutator, [ Value; Value ], Int64)
; "caml_bytes_get64u", (`Mutator, [ Value; Value ], Int64)
; "caml_bytes_set32", (`Mutator, [ Value; Value; Int32 ], Value)
; "caml_bytes_set32u", (`Mutator, [ Value; Value; Int32 ], Value)
; "caml_bytes_set64", (`Mutator, [ Value; Value; Int64 ], Value)
; "caml_bytes_set64u", (`Mutator, [ Value; Value; Int64 ], Value)
; "caml_lxm_next", (`Pure, [ Value ], Int64)
; "caml_ba_uint8_get32", (`Mutator, [ Value; Value ], Int32)
; "caml_ba_uint8_get32u", (`Mutator, [ Value; Value ], Int32)
; "caml_ba_uint8_get64", (`Mutator, [ Value; Value ], Int64)
; "caml_ba_uint8_get64u", (`Mutator, [ Value; Value ], Int64)
; "caml_ba_uint8_set32", (`Mutator, [ Value; Value; Int32 ], Value)
; "caml_ba_uint8_set32u", (`Mutator, [ Value; Value; Int32 ], Value)
; "caml_ba_uint8_set64", (`Mutator, [ Value; Value; Int64 ], Value)
; "caml_ba_uint8_set64u", (`Mutator, [ Value; Value; Int64 ], Value)
; "caml_nextafter_float", (`Pure, [ Float; Float ], Float)
; "caml_classify_float", (`Pure, [ Float ], Value)
; "caml_ldexp_float", (`Pure, [ Float; Value ], Float)
Expand Down
8 changes: 8 additions & 0 deletions compiler/lib/ocaml_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -283,4 +283,12 @@ module Cmo_format = struct
let imports (t : t) = t.cu_imports

let force_link (t : t) = t.cu_force_link

let hints_pos (t : t) = t.cu_hint [@@if ocaml_version >= (5, 3, 1)]

let hints_size (t : t) = t.cu_hintsize [@@if ocaml_version >= (5, 3, 1)]

let hints_size _ = 0 [@@if ocaml_version < (5, 3, 1)]

let hints_pos _ = 0 [@@if ocaml_version < (5, 3, 1)]
end
4 changes: 4 additions & 0 deletions compiler/lib/ocaml_compiler.mli
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,8 @@ module Cmo_format : sig
val force_link : t -> bool

val imports : t -> (string * string option) list

val hints_pos : t -> int

val hints_size : t -> int
end
Loading
Loading