Skip to content

Commit 439417b

Browse files
authored
Configure flag to use the 5.x runtime; make the 5.x runtime build (oxcaml#2004)
* Configure flag to use the 5.x runtime; make the 5.x runtime build * Add flambda2_runtime5 CI job * Add build_upstream_closure_runtime5 job * Fix magic number * Remove --verbose from dune command * Fix st_stubs.c for exception_pointer rename to match 5.x * Expect runtime5 CI jobs to fail * Missed settings of RUNTIME_DIR * Missed settings of RUNTIME_DIR again * Progress towards making the make build work * Continue fixing make build for runtime4 * Expect runtime5 CI jobs to fail - fixing * Expect runtime5 CI jobs to fail - fixing again * CI script debugging
1 parent 19fce80 commit 439417b

Some content is hidden

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

45 files changed

+544
-495
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ jobs:
4141
os: ubuntu-latest
4242
build_ocamlparam: _,ocamlcfg=1
4343

44+
- name: flambda2_runtime5
45+
config: --enable-middle-end=flambda2 --enable-runtime5
46+
os: ubuntu-latest
47+
expected_fail: true
48+
4449
- name: flambda2_debug_runtime
4550
config: --enable-middle-end=flambda2
4651
os: ubuntu-latest
@@ -99,11 +104,17 @@ jobs:
99104
config: --enable-middle-end=closure
100105
os: ubuntu-20.04
101106

107+
- name: build_upstream_closure_runtime5
108+
config: --enable-middle-end=closure --enable-runtime5
109+
os: ubuntu-20.04
110+
expected_fail: true
111+
102112
env:
103113
J: "3"
104114
# On macOS, the testsuite is slow, so run only on push to main (#507)
105115
run_testsuite: "${{matrix.os != 'macos-latest' || (github.event_name == 'push' && github.event.ref == 'refs/heads/main')}}"
106116
build_upstream: "${{matrix.name == 'build_upstream_closure'}}"
117+
expected_fail: "${{matrix.expected_fail == true}}"
107118

108119
steps:
109120
- name: Checkout the Flambda backend repo
@@ -210,7 +221,13 @@ jobs:
210221
run: |
211222
if [ $run_testsuite = true ]; then target=ci; else target=compiler; fi
212223
export PATH=$GITHUB_WORKSPACE/ocaml-414/_install/bin:$PATH
213-
if [ $build_upstream = true ]; then make -j$J build_and_test_upstream; else make $target; fi
224+
if [ $build_upstream = true ]; then \
225+
make -j$J build_and_test_upstream \
226+
|| (if [ $expected_fail = true ]; then exit 0; else exit 1; fi); \
227+
else \
228+
make $target \
229+
|| (if [ $expected_fail = true ]; then exit 0; else exit 1; fi); \
230+
fi
214231
env:
215232
BUILD_OCAMLPARAM: ${{ matrix.build_ocamlparam }}
216233
OCAMLPARAM: ${{ matrix.ocamlparam }}

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,28 @@ ci-coverage: boot-runtest coverage
3232
.PHONY: minimizer-upstream
3333
minimizer-upstream:
3434
cp chamelon/dune.upstream chamelon/dune
35-
cd chamelon && $(dune) build
35+
cd chamelon && RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build
3636

3737
.PHONY: minimizer
3838
minimizer: _build/_bootinstall
3939
cp chamelon/dune.jst chamelon/dune
40-
cd chamelon && $(dune) build
40+
cd chamelon && RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build
4141

4242
.PHONY: hacking-runtest
4343
hacking-runtest: _build/_bootinstall
44-
$(dune) build $(ws_boot) $(coverage_dune_flags) -w $(boot_targets) @runtest
44+
RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build $(ws_boot) $(coverage_dune_flags) -w $(boot_targets) @runtest
4545

4646
# Only needed for running the test tools by hand; runtest will take care of
4747
# building them using Dune
4848
.PHONY: test-tools
4949
test-tools: runtime-stdlib
50-
$(dune) build $(ws_main) @middle_end/flambda2/tests/tools/all
50+
RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build $(ws_main) @middle_end/flambda2/tests/tools/all
5151

5252
ARCHES=amd64 arm64
5353
.PHONY: check_all_arches
5454
check_all_arches: _build/_bootinstall
5555
for arch in $(ARCHES); do \
56-
ARCH=$$arch $(dune) build $(ws_boot) ocamloptcomp.cma; \
56+
ARCH=$$arch RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build $(ws_boot) ocamloptcomp.cma; \
5757
done
5858

5959
# Compare the Flambda backend installation tree against the upstream one.
@@ -83,7 +83,7 @@ _compare/config.status: ocaml/config.status
8383

8484
.PHONY: promote
8585
promote:
86-
$(dune) promote $(ws_main)
86+
RUNTIME_DIR=$(RUNTIME_DIR) $(dune) promote $(ws_main)
8787

8888
.PHONY: fmt
8989
fmt:
@@ -109,24 +109,24 @@ check-fmt:
109109

110110
.PHONY: regen-flambda2-parser
111111
regen-flambda2-parser: $(dune_config_targets)
112-
$(dune) build $(ws_boot) @middle_end/flambda2/parser/regen --auto-promote || true
112+
RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build $(ws_boot) @middle_end/flambda2/parser/regen --auto-promote || true
113113
# Make sure regeneration is idempotent, and also check that the previous step
114114
# worked (can't tell the difference between failure and successful
115115
# auto-promotion)
116-
$(dune) build $(ws_boot) @middle_end/flambda2/parser/regen
116+
RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build $(ws_boot) @middle_end/flambda2/parser/regen
117117

118118
.PHONY: regen-flambda2-tests
119119
regen-flambda2-tests: boot-compiler regen-flambda2-test-dune-rules
120-
$(dune) build $(ws_runstd) \
120+
RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build $(ws_runstd) \
121121
@middle_end/flambda2/tests/regen --auto-promote || true
122-
$(dune) build $(ws_runstd) \
122+
RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build $(ws_runstd) \
123123
@middle_end/flambda2/tests/regen
124124

125125
.PHONY: regen-flambda2-test-dune-rules
126126
regen-flambda2-test-dune-rules: $(dune_config_targets)
127-
$(dune) build $(ws_boot) \
127+
RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build $(ws_boot) \
128128
@middle_end/flambda2/tests/regen-dune-rules --auto-promote || true
129-
$(dune) build $(ws_boot) \
129+
RUNTIME_DIR=$(RUNTIME_DIR) $(dune) build $(ws_boot) \
130130
@middle_end/flambda2/tests/regen-dune-rules
131131

132132
## Build upstream compiler.

backend/amd64/emit.mlp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,13 +1761,13 @@ let emit_instr fallthrough i =
17611761
load_label_addr lbl_handler r11;
17621762
I.push r11;
17631763
cfi_adjust_cfa_offset 8;
1764-
I.push (domain_field Domainstate.Domain_exception_pointer);
1764+
I.push (domain_field Domainstate.Domain_exn_handler);
17651765
cfi_adjust_cfa_offset 8;
1766-
I.mov rsp (domain_field Domainstate.Domain_exception_pointer);
1766+
I.mov rsp (domain_field Domainstate.Domain_exn_handler);
17671767
stack_offset := !stack_offset + 16;
17681768
| Lpoptrap ->
17691769
emit_pop_trap_label ();
1770-
I.pop (domain_field Domainstate.Domain_exception_pointer);
1770+
I.pop (domain_field Domainstate.Domain_exn_handler);
17711771
cfi_adjust_cfa_offset (-8);
17721772
I.add (int 8) rsp;
17731773
cfi_adjust_cfa_offset (-8);
@@ -1787,8 +1787,8 @@ let emit_instr fallthrough i =
17871787
(* BACKPORT END *)
17881788
record_frame Reg.Set.empty (Dbg_raise i.dbg)
17891789
| Lambda.Raise_notrace ->
1790-
I.mov (domain_field Domainstate.Domain_exception_pointer) rsp;
1791-
I.pop (domain_field Domainstate.Domain_exception_pointer);
1790+
I.mov (domain_field Domainstate.Domain_exn_handler) rsp;
1791+
I.pop (domain_field Domainstate.Domain_exn_handler);
17921792
I.pop r11;
17931793
I.jmp r11
17941794
end

configure.ac

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AC_PREREQ([2.69])
22
AC_INIT([The Flambda backend for OCaml],
3-
5.1.1+jst-runtime4,
3+
5.1.1+jst,
44
[mshinwell@janestreet.com],
55
[flambda_backend],
66
[http://github.com/ocaml-flambda/flambda_backend])
@@ -36,6 +36,12 @@ AC_ARG_ENABLE([middle-end],
3636
[*], [AC_MSG_ERROR([Bad middle end (not closure, flambda or flambda2)])])],
3737
[AC_MSG_ERROR([--enable-middle-end=closure|flambda|flambda2 must be provided])])
3838

39+
AC_ARG_ENABLE([runtime5],
40+
[AS_HELP_STRING([--enable-runtime5],
41+
[Use the OCaml 5 runtime])],
42+
[runtime5_arg=--enable-runtime5],
43+
[runtime5_arg=])
44+
3945
AC_ARG_ENABLE([coverage],
4046
[AS_HELP_STRING([--enable-coverage],
4147
[Run compiler tests instrumented to output coverage data using bisect_ppx
@@ -62,7 +68,7 @@ AC_SUBST([legacy_layout])
6268
AC_DISABLE_OPTION_CHECKING
6369

6470
AX_SUBDIRS_CONFIGURE([ocaml],
65-
[$middle_end_arg,-C,--disable-ocamldoc,--disable-stdlib-manpages,--enable-ocamltest],
71+
[$middle_end_arg,$runtime5_arg,-C,--disable-ocamldoc,--disable-stdlib-manpages,--enable-ocamltest],
6672
[],
6773
[],
6874
[])

ocaml/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,6 @@ META
358358
/yacc/.gdb_history
359359

360360
/otherlibs/dynlink/natdynlinkops
361+
362+
dune.runtime_selection
363+

0 commit comments

Comments
 (0)