Skip to content

Commit 0b675b2

Browse files
flambda-backend: Unrevert PRs that previously depended on Dune 3.11+ (#2586)
* Revert "Revert "Move unboxed definitions from `Stdlib` to `Stable`" (#2580)" This reverts commit 74f5941. * Revert "Revert "Rename extension otherlibs" (#2579)" This reverts commit f6bf7be. * Port `dune` changes * Revert "Revert "Move immutable array modules to `Stable_stdlib`" (#2578)" This reverts commit 96e324a. * Fix mli dependencies --------- Co-authored-by: Diana Kalinichenko <[email protected]>
1 parent 73f7538 commit 0b675b2

File tree

102 files changed

+1789
-1624
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1789
-1624
lines changed

Makefile.common-jst

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ dune_config_targets = \
113113
$(ocamldir)/duneconf/dirs-to-ignore.inc \
114114
$(ocamldir)/duneconf/jst-extra.inc \
115115
dune-project \
116-
$(ocamldir)/stdlib/ocaml_compiler_internal_params \
117116
$(ocamldir)/dune.runtime_selection \
118117
$(ocamldir)/otherlibs/dune
119118

@@ -200,12 +199,6 @@ _install: compiler
200199
install: _install
201200
mkdir -p '$(prefix)'
202201
rsync --chmod=u+rw,go+r -rl _install/ '$(prefix)'
203-
rm -f '$(prefix)/lib/ocaml/ocaml_compiler_internal_params'
204-
# rm `ocaml_compiler_internal_params`, which is used to compile the
205-
# stdlib `Float_u` module with `-extension layouts_alpha`, because we
206-
# don't want user programs that happened to be named
207-
# `ocaml/stdlib/float_u.ml` to get the flag automatically.
208-
209202

210203
# Same as above, but relies on a successfull earlier _install
211204
install_for_opam:
@@ -258,15 +251,15 @@ install_for_test: _install
258251
ln -s . lex; ln -s . yacc; \
259252
ln -s _install/lib/ocaml/compiler-libs compilerlibs; \
260253
mkdir -p otherlibs/{unix,dynlink/native,str,bigarray,runtime_events}; \
261-
mkdir -p otherlibs/{upstream_compatible,stable,beta,alpha}; \
262254
ln -s ../stdlib/threads otherlibs/systhreads$(RUNTIME_SUFFIX); \
263255
$(cpl) stdlib/unix/{lib,}unix* otherlibs/unix; \
264256
$(cpl) stdlib/dynlink/dynlink* otherlibs/dynlink; \
265257
$(cpl) stdlib/str/{lib,}str* otherlibs/str; \
266-
$(cpl) stdlib/upstream_compatible/* otherlibs/upstream_compatible; \
267-
$(cpl) stdlib/stable/* otherlibs/stable; \
268-
$(cpl) stdlib/beta/* otherlibs/beta; \
269-
$(cpl) stdlib/alpha/* otherlibs/alpha; \
258+
for universe in upstream_compatible stable beta alpha ; do \
259+
mkdir -p otherlibs/{stdlib_,}$${universe}; \
260+
$(cpl) stdlib/stdlib_$${universe}/* otherlibs/stdlib_$${universe}; \
261+
$(cpl) stdlib/$${universe}/* otherlibs/$${universe}; \
262+
done; \
270263
if [[ x"$(RUNTIME_DIR)" = x"runtime" ]]; then \
271264
$(cpl) stdlib/runtime_events/{lib,}runtime_events* otherlibs/runtime_events; \
272265
fi; \

ocamltest/ocaml_modifiers.ml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,6 @@ let dynlink =
9393
let str = make_library_modifier
9494
"str" [compiler_subdir ["otherlibs"; "str"]]
9595

96-
let upstream_compatible = make_library_modifier
97-
"upstream_compatible" [compiler_subdir ["otherlibs"; "upstream_compatible"]]
98-
99-
let stable = make_library_modifier
100-
"stable" [compiler_subdir ["otherlibs"; "stable"]]
101-
102-
let beta = make_library_modifier
103-
"beta" [compiler_subdir ["otherlibs"; "beta"]]
104-
105-
let alpha = make_library_modifier
106-
"alpha" [compiler_subdir ["otherlibs"; "alpha"]]
107-
10896
let systhreads =
10997
unix @
11098
(make_library_modifier
@@ -140,17 +128,28 @@ let runtime_suffix = if Config.runtime5 then "" else "4"
140128

141129
let debugger = [add_compiler_subdir ("debugger" ^ runtime_suffix)]
142130

131+
let extension_universe_lib name =
132+
make_library_modifier name [compiler_subdir ["otherlibs"; name]]
133+
143134
let _ =
144135
register_modifiers "principal" principal;
145136
register_modifiers "config" config;
146137
register_modifiers "testing" testing;
147138
register_modifiers "unix" unix;
148139
register_modifiers "dynlink" dynlink;
149140
register_modifiers "str" str;
150-
register_modifiers "upstream_compatible" upstream_compatible;
151-
register_modifiers "stable" stable;
152-
register_modifiers "beta" beta;
153-
register_modifiers "alpha" alpha;
141+
List.iter
142+
(fun old_name ->
143+
let new_name = "stdlib_" ^ old_name in
144+
register_modifiers old_name (extension_universe_lib old_name);
145+
register_modifiers new_name (extension_universe_lib new_name);
146+
)
147+
[
148+
"upstream_compatible";
149+
"stable";
150+
"beta";
151+
"alpha";
152+
];
154153
List.iter
155154
(fun archive -> register_modifiers archive (compilerlibs_archive archive))
156155
[

otherlibs/alpha/dune

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
;* *
1313
;**************************************************************************
1414

15+
;; [alpha] was renamed to [stdlib_alpha]. This library clones [stdlib_alpha]
16+
;; until we move all existing uses of [alpha] to [stdlib_alpha].
17+
1518
(library
1619
(name alpha)
1720
(wrapped false)
@@ -34,10 +37,21 @@
3437
(library_flags
3538
(:standard -linkall)))
3639

40+
;; We clone files from [stdlib_alpha] instead of re-exporting the library
41+
;; to avoid adding a new transitive dependency to builds.
42+
43+
(rule
44+
(deps
45+
(glob_files ../stdlib_alpha/*.{ml,mli}))
46+
(targets alpha.ml alpha.mli)
47+
(action
48+
(bash
49+
"cp ../stdlib_alpha/*.{ml,mli} .; mv stdlib_alpha.ml alpha.ml; mv stdlib_alpha.mli alpha.mli")))
50+
3751
(rule
3852
(deps
3953
(:first-dep ../to_install.sh)
40-
(source_tree .))
54+
(glob_files *.mli))
4155
(action
4256
(with-stdout-to
4357
to_install.sexp

otherlibs/beta/dune

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
;* *
1313
;**************************************************************************
1414

15+
;; [beta] was renamed to [stdlib_beta]. This library clones [stdlib_beta]
16+
;; until we move all existing uses of [beta] to [stdlib_beta].
17+
1518
(library
1619
(name beta)
1720
(wrapped false)
@@ -36,10 +39,21 @@
3639
(library_flags
3740
(:standard -linkall)))
3841

42+
;; We clone files from [stdlib_beta] instead of re-exporting the library
43+
;; to avoid adding a new transitive dependency to builds.
44+
45+
(rule
46+
(deps
47+
(glob_files ../stdlib_beta/*.{ml,mli}))
48+
(targets float32.ml float32.mli float32_u.ml float32_u.mli beta.ml beta.mli)
49+
(action
50+
(bash
51+
"cp ../stdlib_beta/*.{ml,mli} .; mv stdlib_beta.ml beta.ml; mv stdlib_beta.mli beta.mli")))
52+
3953
(rule
4054
(deps
4155
(:first-dep ../to_install.sh)
42-
(source_tree .))
56+
(glob_files *.mli))
4357
(action
4458
(with-stdout-to
4559
to_install.sexp

otherlibs/stable/dune

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
;* *
1313
;**************************************************************************
1414

15+
;; [stable] was renamed to [stdlib_stable]. This library clones [stdlib_stable]
16+
;; until we move all existing uses of [stable] to [stdlib_stable].
17+
1518
(library
1619
(name stable)
1720
(wrapped false)
@@ -34,10 +37,35 @@
3437
(library_flags
3538
(:standard -linkall)))
3639

40+
;; We clone files from [stdlib_stable] instead of re-exporting the library
41+
;; to avoid adding a new transitive dependency to builds.
42+
43+
(rule
44+
(deps
45+
(glob_files ../stdlib_stable/*.{ml,mli}))
46+
(targets
47+
float_u.ml
48+
float_u.mli
49+
iarray.ml
50+
iarray.mli
51+
iarrayLabels.ml
52+
iarrayLabels.mli
53+
int32_u.ml
54+
int32_u.mli
55+
int64_u.ml
56+
int64_u.mli
57+
nativeint_u.ml
58+
nativeint_u.mli
59+
stable.ml
60+
stable.mli)
61+
(action
62+
(bash
63+
"cp ../stdlib_stable/*.{ml,mli} .; mv stdlib_stable.ml stable.ml; mv stdlib_stable.mli stable.mli")))
64+
3765
(rule
3866
(deps
3967
(:first-dep ../to_install.sh)
40-
(source_tree .))
68+
(glob_files *.mli))
4169
(action
4270
(with-stdout-to
4371
to_install.sexp

otherlibs/stable/stable.ml

Lines changed: 0 additions & 3 deletions
This file was deleted.

otherlibs/stable/stable.mli

Lines changed: 0 additions & 3 deletions
This file was deleted.

otherlibs/stdlib_alpha/dune

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
;**************************************************************************
2+
;* *
3+
;* OCaml *
4+
;* *
5+
;* Diana Kalinichenko, Jane Street, New York *
6+
;* *
7+
;* Copyright 2024 Jane Street Group LLC *
8+
;* *
9+
;* All rights reserved. This file is distributed under the terms of *
10+
;* the GNU Lesser General Public License version 2.1, with the *
11+
;* special exception on linking described in the file LICENSE. *
12+
;* *
13+
;**************************************************************************
14+
15+
(library
16+
(name stdlib_alpha)
17+
(wrapped false)
18+
(modes byte native)
19+
(flags
20+
(-strict-sequence
21+
-principal
22+
-absname
23+
-w
24+
+a-4-9-40-41-42-44-45-48-66
25+
-warn-error
26+
A
27+
-bin-annot
28+
-safe-string
29+
-strict-formats
30+
-extension-universe
31+
alpha))
32+
(ocamlopt_flags
33+
(:include %{project_root}/ocamlopt_flags.sexp))
34+
(library_flags
35+
(:standard -linkall)))
36+
37+
(rule
38+
(deps
39+
(:first-dep ../to_install.sh)
40+
(source_tree .))
41+
(action
42+
(with-stdout-to
43+
to_install.sexp
44+
(run "%{first-dep}" "stdlib_alpha"))))
45+
46+
(install
47+
(files
48+
(include to_install.sexp))
49+
(section lib)
50+
(package ocaml))
File renamed without changes.
File renamed without changes.

otherlibs/stdlib_beta/dune

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
;**************************************************************************
2+
;* *
3+
;* OCaml *
4+
;* *
5+
;* Diana Kalinichenko, Jane Street, New York *
6+
;* *
7+
;* Copyright 2024 Jane Street Group LLC *
8+
;* *
9+
;* All rights reserved. This file is distributed under the terms of *
10+
;* the GNU Lesser General Public License version 2.1, with the *
11+
;* special exception on linking described in the file LICENSE. *
12+
;* *
13+
;**************************************************************************
14+
15+
(library
16+
(name stdlib_beta)
17+
(wrapped false)
18+
(modes byte native)
19+
(enabled_if
20+
(= %{architecture} "amd64"))
21+
(flags
22+
(-strict-sequence
23+
-principal
24+
-absname
25+
-w
26+
+a-4-9-40-41-42-44-45-48-66
27+
-warn-error
28+
A
29+
-bin-annot
30+
-safe-string
31+
-strict-formats
32+
-extension-universe
33+
beta))
34+
(ocamlopt_flags
35+
(:include %{project_root}/ocamlopt_flags.sexp))
36+
(library_flags
37+
(:standard -linkall)))
38+
39+
(rule
40+
(deps
41+
(:first-dep ../to_install.sh)
42+
(source_tree .))
43+
(action
44+
(with-stdout-to
45+
to_install.sexp
46+
(run "%{first-dep}" "stdlib_beta"))))
47+
48+
(install
49+
(enabled_if
50+
(= %{architecture} "amd64"))
51+
(files
52+
(include to_install.sexp))
53+
(section lib)
54+
(package ocaml))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

otherlibs/stdlib_stable/dune

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
;**************************************************************************
2+
;* *
3+
;* OCaml *
4+
;* *
5+
;* Diana Kalinichenko, Jane Street, New York *
6+
;* *
7+
;* Copyright 2024 Jane Street Group LLC *
8+
;* *
9+
;* All rights reserved. This file is distributed under the terms of *
10+
;* the GNU Lesser General Public License version 2.1, with the *
11+
;* special exception on linking described in the file LICENSE. *
12+
;* *
13+
;**************************************************************************
14+
15+
(library
16+
(name stdlib_stable)
17+
(wrapped false)
18+
(modes byte native)
19+
(flags
20+
(-strict-sequence
21+
-principal
22+
-absname
23+
-w
24+
+a-4-9-40-41-42-44-45-48-66
25+
-warn-error
26+
A
27+
-bin-annot
28+
-safe-string
29+
-strict-formats
30+
-extension-universe
31+
stable))
32+
(ocamlopt_flags
33+
(:include %{project_root}/ocamlopt_flags.sexp))
34+
(library_flags
35+
(:standard -linkall)))
36+
37+
(rule
38+
(deps
39+
(:first-dep ../to_install.sh)
40+
(source_tree .))
41+
(action
42+
(with-stdout-to
43+
to_install.sexp
44+
(run "%{first-dep}" "stdlib_stable"))))
45+
46+
(install
47+
(files
48+
(include to_install.sexp))
49+
(section lib)
50+
(package ocaml))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

stdlib/int64_u.ml renamed to otherlibs/stdlib_stable/int64_u.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ let[@inline always] of_nativeint x = of_int64 (Int64.of_nativeint x)
8484

8585
let[@inline always] to_nativeint x = Int64.to_nativeint (to_int64 x)
8686

87-
let[@inline always] of_int32_u x = of_int64 (Int64.of_int32 (Stdlib__Int32_u.to_int32 x))
87+
let[@inline always] of_int32_u x = of_int64 (Int64.of_int32 (Int32_u.to_int32 x))
8888

89-
let[@inline always] to_int32_u x = Stdlib__Int32_u.of_int32 (Int64.to_int32 (to_int64 x))
89+
let[@inline always] to_int32_u x = Int32_u.of_int32 (Int64.to_int32 (to_int64 x))
9090

9191
let[@inline always] of_nativeint_u x =
92-
of_int64 (Int64.of_nativeint (Stdlib__Nativeint_u.to_nativeint x))
92+
of_int64 (Int64.of_nativeint (Nativeint_u.to_nativeint x))
9393

9494
let[@inline always] to_nativeint_u x =
95-
Stdlib__Nativeint_u.of_nativeint (Int64.to_nativeint (to_int64 x))
95+
Nativeint_u.of_nativeint (Int64.to_nativeint (to_int64 x))
9696

9797
let[@inline always] bits_of_float x = of_int64 (Int64.bits_of_float x)
9898

File renamed without changes.

0 commit comments

Comments
 (0)