Skip to content

Commit

Permalink
Update magic numbers for 4.14.1-22 (and add tools/bump_magic_numbers.sh)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshinwell committed Oct 13, 2023
1 parent 85954ed commit 8f79b55
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 14 deletions.
Binary file modified ocaml/boot/ocamlc
Binary file not shown.
Binary file modified ocaml/boot/ocamllex
Binary file not shown.
2 changes: 1 addition & 1 deletion ocaml/runtime/caml/exec.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct exec_trailer {

/* Magic number for this release */

#define EXEC_MAGIC "Caml1999X511"
#define EXEC_MAGIC "Caml1999X512"

#endif /* CAML_INTERNALS */

Expand Down
26 changes: 13 additions & 13 deletions ocaml/utils/config.mlp
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,28 @@ let poll_insertion = %%POLL_INSERTION%%
(* When artifacts are incompatible with upstream OCaml, ocaml-jst uses
magic numbers ending in 5xx. (The AST remains
compatible, so use upstream numbers) *)
let exec_magic_number = "Caml1999X511"
let exec_magic_number = "Caml1999X512"
(* exec_magic_number is duplicated in runtime/caml/exec.h *)
and cmi_magic_number = "Caml1999I512"
and cmo_magic_number = "Caml1999O512"
and cma_magic_number = "Caml1999A512"
and cmi_magic_number = "Caml1999I513"
and cmo_magic_number = "Caml1999O513"
and cma_magic_number = "Caml1999A513"
and cmx_magic_number =
if flambda || flambda2 then
"Caml2021y514"
"Caml2021y515"
else
"Caml2021Y514"
"Caml2021Y515"
and cmxa_magic_number =
if flambda || flambda2 then
"Caml2021z514"
"Caml2021z515"
else
"Caml2021Z514"
"Caml2021Z515"
and ast_impl_magic_number = "Caml1999M031"
and ast_intf_magic_number = "Caml1999N031"
and cmxs_magic_number = "Caml1999D513"
and cmt_magic_number = "Caml1999T512"
and cms_magic_number = "Caml1999S510"
and linear_magic_number = "Caml1999L512"
and cfg_magic_number = "Caml2021G512"
and cmxs_magic_number = "Caml1999D514"
and cmt_magic_number = "Caml1999T513"
and cms_magic_number = "Caml1999S511"
and linear_magic_number = "Caml1999L513"
and cfg_magic_number = "Caml2021G513"

let interface_suffix = ref ".mli"

Expand Down
32 changes: 32 additions & 0 deletions tools/bump_magic_numbers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -eu -o pipefail

# Needs GNU sed which is not the default on macOS
sed=gsed
gsed --version >/dev/null || sed=sed

if [ "$(git status --porcelain --untracked-files=no)" != "" ]; then
echo "There must be a clean 'git status' before running this script"
exit 1
fi

git clean -dfX
(cd ocaml && ./configure && make -j8 coldstart && make -j8 coreall)

# Unfortunately the "e" modifier appears not to work except for replacing
# a whole line

$sed -i \
-e 's/^#define EXEC_MAGIC "Caml1999X\([0-9][0-9][0-9]\)"/echo "#define EXEC_MAGIC \\x22Caml1999X$((\1 + 1))\\x22"/ge' \
ocaml/runtime/caml/exec.h

$sed -i \
-e 's/^\(let\|and\) \([a-z][a-z_]*\) = "Caml\([0-9][0-9][0-9][0-9]\)\([a-zA-Z]\)\(5[0-9][0-9]\)"/echo "\1 \2 = \\x22Caml\3\4$((\5 + 1))\\x22"/ge' \
ocaml/utils/config.mlp

$sed -i \
-e 's/^ "Caml\([0-9][0-9][0-9][0-9]\)\([a-zA-Z]\)\(5[0-9][0-9]\)"/echo " \\x22Caml\1\2$((\3 + 1))\\x22"/ge' \
ocaml/utils/config.mlp

(cd ocaml && make -j8 coreall && make -j8 bootstrap)

0 comments on commit 8f79b55

Please sign in to comment.