Skip to content
Merged
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
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
* Misc: drop support for OCaml 4.12 and bellow
* Misc: switch to dune.3.19
* Misc: initial support for ocaml 5.4 (#2030)
* Compiler: use a Wasm text files preprocessor (#1822)
* Compiler: support for OCaml 4.14.3+trunk (#1844)
* Compiler: optimize compilation of switches
Expand Down
1 change: 1 addition & 0 deletions compiler/lib-wasm/generate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ module Generate (Target : Target_sig.S) = struct
| Constant c -> Constant.translate c
| Special (Alias_prim _) -> assert false
| Prim (Extern "caml_alloc_dummy_function", [ _; Pc (Int arity) ]) ->
(* Removed in OCaml 5.2 *)
Closure.dummy ~cps:(effects_cps ()) ~arity:(Targetint.to_int_exn arity)
| Prim (Extern "caml_alloc_dummy_infix", _) ->
Closure.dummy ~cps:(effects_cps ()) ~arity:1
Expand Down
1 change: 1 addition & 0 deletions compiler/lib/effects.ml
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ let rewrite_instr ~st (instr : instr) : instr =
st.in_cps := Var.Set.add x !(st.in_cps);
Let (x, Closure (cps_params, cps_cont, None))
| Let (x, Prim (Extern "caml_alloc_dummy_function", [ size; arity ])) -> (
(* Removed in OCaml 5.2 *)
match arity with
| Pc (Int a) ->
Let
Expand Down
4 changes: 4 additions & 0 deletions compiler/lib/eval.ml
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,10 @@ let eval_instr update_count inline_constant ~target info i =
in Specialize_js, which would make the call to [the_const_of]
below fail. *)
[ i ]
| Let (x, Prim (Extern "caml_atomic_load_field", [ Pv o; f ])) -> (
match the_int info f with
| None -> [ i ]
| Some i -> [ Let (x, Field (o, Targetint.to_int_exn i, Non_float)) ])
| Let (x, Prim (IsInt, [ y ])) -> (
match is_int info y with
| Unknown -> [ i ]
Expand Down
1 change: 1 addition & 0 deletions compiler/lib/generate.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,7 @@ let rec translate_expr ctx loc x e level : (_ * J.statement_list) Expr_builder.t
let* fields = build_fields fields in
return (J.EObj fields)
| Extern "caml_alloc_dummy_function", [ _; size ] ->
(* Removed in Ocaml 5.2 *)
let* i =
let* cx = access' ~ctx size in
return
Expand Down
3 changes: 2 additions & 1 deletion compiler/lib/magic_number.ml
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ let v =
| 5 :: 01 :: _ -> 33
| 5 :: 02 :: _ -> 34
| 5 :: 03 :: _ -> 35
| 5 :: 04 :: _ -> 36
| _ ->
if Ocaml_version.compare current [ 4; 13 ] < 0
then failwith "OCaml version unsupported. Upgrade to OCaml 4.13 or newer."
else (
assert (Ocaml_version.compare current [ 5; 4 ] >= 0);
assert (Ocaml_version.compare current [ 5; 5 ] >= 0);
failwith "OCaml version unsupported. Upgrade js_of_ocaml.")

let current_exe = "Caml1999X", v
Expand Down
45 changes: 45 additions & 0 deletions compiler/tests-check-prim/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,48 @@
+toplevel.js
%{dep:unix.bc}))))

(rule
(targets main.5.4.output)
(mode
(promote (until-clean)))
(enabled_if (and (>= %{ocaml_version} 5.4)(< %{ocaml_version} 5.5)))
(action
(with-stdout-to
%{targets}
(run
%{bin:js_of_ocaml}
check-runtime
+dynlink.js
+toplevel.js
%{dep:main.bc}))))

(rule
(targets unix-Win32.5.4.output)
(mode
(promote (until-clean)))
(enabled_if (and (>= %{ocaml_version} 5.4)(< %{ocaml_version} 5.5)(= %{os_type} Win32)))
(action
(with-stdout-to
%{targets}
(run
%{bin:js_of_ocaml}
check-runtime
+dynlink.js
+toplevel.js
%{dep:unix.bc}))))

(rule
(targets unix-Unix.5.4.output)
(mode
(promote (until-clean)))
(enabled_if (and (>= %{ocaml_version} 5.4)(< %{ocaml_version} 5.5)(= %{os_type} Unix)))
(action
(with-stdout-to
%{targets}
(run
%{bin:js_of_ocaml}
check-runtime
+dynlink.js
+toplevel.js
%{dep:unix.bc}))))

7 changes: 5 additions & 2 deletions compiler/tests-check-prim/gen_dune.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type version =
| `V5_2
| `V5_3
| `V5_4
| `V5_5
]

let string_of_version : version -> string = function
Expand All @@ -18,6 +19,7 @@ let string_of_version : version -> string = function
| `V5_2 -> "5.2"
| `V5_3 -> "5.3"
| `V5_4 -> "5.4"
| `V5_5 -> "5.5"

let next_version : version -> version option = function
| `V4_13 -> Some `V4_14
Expand All @@ -26,7 +28,8 @@ let next_version : version -> version option = function
| `V5_1 -> Some `V5_2
| `V5_2 -> Some `V5_3
| `V5_3 -> Some `V5_4
| `V5_4 -> None
| `V5_4 -> Some `V5_5
| `V5_5 -> None

type os_type =
| Unix
Expand Down Expand Up @@ -82,7 +85,7 @@ let rule bc ocaml_version os_type =
bc

let () =
let versions : version list = [ `V4_14; `V5_2; `V5_3 ] in
let versions : version list = [ `V4_14; `V5_2; `V5_3; `V5_4 ] in
List.iter
(fun ocaml_version ->
List.iter
Expand Down
199 changes: 199 additions & 0 deletions compiler/tests-check-prim/main.5.4.output
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
Missing
-------

From main.bc:
caml_assume_no_perform
caml_continuation_use
caml_int_as_pointer
caml_reset_afl_instrumentation
debugger

Unused
-------

From +array.js:
caml_check_bound

From +bigarray.js:
caml_ba_create_from
caml_ba_init

From +bigstring.js:
caml_bigstring_blit_ba_to_ba
caml_bigstring_blit_ba_to_bytes
caml_bigstring_blit_bytes_to_ba
caml_bigstring_blit_string_to_ba
caml_bigstring_memcmp
caml_hash_mix_bigstring

From +effect.js:
jsoo_effect_not_supported

From +fs.js:
caml_ba_map_file
caml_ba_map_file_bytecode
caml_fs_init
jsoo_create_file
jsoo_create_file_extern

From +graphics.js:
caml_gr_arc_aux
caml_gr_blit_image
caml_gr_clear_graph
caml_gr_close_graph
caml_gr_close_subwindow
caml_gr_create_image
caml_gr_current_x
caml_gr_current_y
caml_gr_display_mode
caml_gr_doc_of_state
caml_gr_draw_arc
caml_gr_draw_char
caml_gr_draw_image
caml_gr_draw_rect
caml_gr_draw_str
caml_gr_draw_string
caml_gr_dump_image
caml_gr_fill_arc
caml_gr_fill_poly
caml_gr_fill_rect
caml_gr_lineto
caml_gr_make_image
caml_gr_moveto
caml_gr_open_graph
caml_gr_open_subwindow
caml_gr_plot
caml_gr_point_color
caml_gr_remember_mode
caml_gr_resize_window
caml_gr_set_color
caml_gr_set_font
caml_gr_set_line_width
caml_gr_set_text_size
caml_gr_set_window_title
caml_gr_sigio_handler
caml_gr_sigio_signal
caml_gr_size_x
caml_gr_size_y
caml_gr_state
caml_gr_state_create
caml_gr_state_get
caml_gr_state_init
caml_gr_state_set
caml_gr_synchronize
caml_gr_text_size
caml_gr_wait_event
caml_gr_window_id

From +hash.js:
caml_hash_mix_int64

From +ints.js:
caml_div
caml_mod

From +jslib.js:
caml_is_js
caml_trampoline
caml_trampoline_return
caml_wrap_exception

From +marshal.js:
caml_marshal_constants

From +mlBytes.js:
caml_array_of_bytes (deprecated)
caml_array_of_string (deprecated)
caml_bytes_of_utf16_jsstring
caml_new_string (deprecated)
caml_string_concat
caml_to_js_string (deprecated)

From +runtime_events.js:
caml_runtime_events_create_cursor
caml_runtime_events_free_cursor
caml_runtime_events_read_poll
caml_runtime_events_user_resolve

From +stdlib.js:
caml_build_symbols
caml_is_printable
caml_maybe_print_stats
caml_register_global
jsoo_toplevel_reloc

From +sys.js:
caml_fatal_uncaught_exception
caml_format_exception
caml_is_special_exception
caml_set_static_env
caml_sys_const_naked_pointers_checked

From +toplevel.js:
jsoo_get_runtime_aliases
jsoo_toplevel_init_compile
jsoo_toplevel_init_reloc

From +unix.js:
caml_strerror
caml_unix_access
caml_unix_chdir
caml_unix_chmod
caml_unix_cleanup
caml_unix_close
caml_unix_closedir
caml_unix_fchmod
caml_unix_filedescr_of_fd
caml_unix_findclose
caml_unix_findfirst
caml_unix_findnext
caml_unix_fstat
caml_unix_fstat_64
caml_unix_fsync
caml_unix_ftruncate
caml_unix_ftruncate_64
caml_unix_getegid
caml_unix_geteuid
caml_unix_getgid
caml_unix_getpwnam
caml_unix_gettimeofday
caml_unix_getuid
caml_unix_gmtime
caml_unix_has_symlink
caml_unix_inchannel_of_filedescr
caml_unix_inet_addr_of_string
caml_unix_isatty
caml_unix_link
caml_unix_localtime
caml_unix_lookup_file
caml_unix_lseek
caml_unix_lseek_64
caml_unix_lstat
caml_unix_lstat_64
caml_unix_mkdir
caml_unix_mktime
caml_unix_open
caml_unix_opendir
caml_unix_outchannel_of_filedescr
caml_unix_read
caml_unix_read_bigarray
caml_unix_readdir
caml_unix_readlink
caml_unix_rename
caml_unix_rewinddir
caml_unix_rmdir
caml_unix_single_write
caml_unix_startup
caml_unix_stat
caml_unix_stat_64
caml_unix_symlink
caml_unix_time
caml_unix_times
caml_unix_truncate
caml_unix_truncate_64
caml_unix_unlink
caml_unix_utimes
caml_unix_write
caml_unix_write_bigarray
unix_error_message

Loading
Loading