Skip to content

Add support for OCaml 4.14 #1173

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

Merged
merged 2 commits into from
Dec 20, 2021
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
2 changes: 1 addition & 1 deletion compiler/lib/instr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ let ops =
let if_v407 =
match Ocaml_version.v with
| `V4_04 | `V4_06 -> fun _ -> K_will_not_happen
| `V4_07 | `V4_08 | `V4_09 | `V4_10 | `V4_11 | `V4_12 | `V4_13 -> fun k -> k
| `V4_07 | `V4_08 | `V4_09 | `V4_10 | `V4_11 | `V4_12 | `V4_13 | `V4_14 -> fun k -> k
in
let instrs =
[| ACC0, KNullary, "ACC0"
Expand Down
3 changes: 3 additions & 0 deletions compiler/lib/magic_number.ml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ let current_exe =
| `V4_11 -> 28
| `V4_12 -> 29
| `V4_13 -> 30
| `V4_14 -> 31
in
"Caml1999X", v

Expand All @@ -90,6 +91,7 @@ let current_cmo =
| `V4_11 -> 28
| `V4_12 -> 29
| `V4_13 -> 30
| `V4_14 -> 31
in
"Caml1999O", v

Expand All @@ -105,6 +107,7 @@ let current_cma =
| `V4_11 -> 28
| `V4_12 -> 29
| `V4_13 -> 30
| `V4_14 -> 31
in
"Caml1999A", v

Expand Down
3 changes: 1 addition & 2 deletions compiler/lib/ocaml_version.ml
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ let v =
| 4 :: 11 :: _ -> `V4_11
| 4 :: 12 :: _ -> `V4_12
| 4 :: 13 :: _ -> `V4_13
(* Trunk is the next 4.14, it's likely compatible with 4.13 *)
| 4 :: 14 :: _ -> `V4_13
| 4 :: 14 :: _ -> `V4_14
| _ ->
if compare current [ 4; 4 ] < 0
then failwith "OCaml version unsupported. Upgrade to OCaml 4.04 or newer."
Expand Down
1 change: 1 addition & 0 deletions compiler/lib/ocaml_version.mli
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ val v :
| `V4_11 (* OCaml 4.11 *)
| `V4_12 (* OCaml 4.12 *)
| `V4_13 (* OCaml 4.13 *)
| `V4_14 (* OCaml 4.14 *)
]
4 changes: 2 additions & 2 deletions compiler/lib/parse_bytecode.ml
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ let method_cache_id = ref 1
let new_closure_repr =
match Ocaml_version.v with
| `V4_04 | `V4_06 | `V4_07 | `V4_08 | `V4_09 | `V4_10 | `V4_11 -> false
| `V4_12 | `V4_13 -> true
| `V4_12 | `V4_13 | `V4_14 -> true

let clo_offset_3 = if new_closure_repr then 3 else 2

Expand Down Expand Up @@ -2129,7 +2129,7 @@ let parse_bytecode code globals debug_data =

let override_global =
match Ocaml_version.v with
| `V4_13 -> []
| `V4_13 | `V4_14 -> []
| `V4_04 | `V4_06 | `V4_07 | `V4_08 | `V4_09 | `V4_10 | `V4_11 | `V4_12 ->
let jsmodule name func =
Prim (Extern "%overrideMod", [ Pc (String name); Pc (String func) ])
Expand Down
6 changes: 6 additions & 0 deletions runtime/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,3 +452,9 @@ function caml_ml_output_int (chanid,i) {
caml_ml_output(chanid,s,0,4);
return 0
}

//Provides: caml_ml_is_buffered
function caml_ml_is_buffered(c) { return 1 }

//Provides: caml_ml_set_buffered
function caml_ml_set_buffered(c,v) { return 0 }
1 change: 1 addition & 0 deletions tools/toplevel_expect/dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
toplevel_expect_test.ml-4.11
toplevel_expect_test.ml-4.12
toplevel_expect_test.ml-4.13
toplevel_expect_test.ml-4.14
toplevel_expect_test.ml-default)
(action
(with-stdout-to
Expand Down
Loading