···900900enable_native_toplevel
901901enable_frame_pointers
902902enable_naked_pointers
903903+enable_naked_pointers_checker
903904enable_spacetime
904905enable_cfi
905906enable_imprecise_c99_float_ops
···3179318031803181# Check whether --enable-vmthreads was given.
31813182if test "${enable_vmthreads+set}" = set; then :
31823182- enableval=$enable_vmthreads; as_fn_error $? "The vmthreads library is no longer available. \
31833183-It was deleted in OCaml 4.09." "$LINENO" 5
31833183+ enableval=$enable_vmthreads; if test "x$enableval" != 'xno'; then :
31843184+ as_fn_error $? "The vmthreads library is no longer available. It was deleted in OCaml 4.09." "$LINENO" 5
31853185+fi
31843186fi
3185318731863188···3192319431933195# Check whether --enable-graph-lib was given.
31943196if test "${enable_graph_lib+set}" = set; then :
31953195- enableval=$enable_graph_lib; as_fn_error $? "The graphics library is no longer distributed with OCaml \
31963196-since version 4.09. It is now distributed as a separate \"graphics\" package: \
31973197-https://github.com/ocaml/graphics" "$LINENO" 5
31973197+ enableval=$enable_graph_lib; if test "x$enableval" != 'xno'; then :
31983198+ as_fn_error $? "The graphics library is no longer distributed with OCaml since version 4.09. It is now distributed as a separate \"graphics\" package: https://github.com/ocaml/graphics" "$LINENO" 5
31993199+fi
31983200fi
3199320132003202···3212321432133215# Check whether --enable-bigarray-lib was given.
32143216if test "${enable_bigarray_lib+set}" = set; then :
32153215- enableval=$enable_bigarray_lib; as_fn_error $? "The bigarray-lib option was deleted in OCaml 5.00, \
32163216-as the Bigarray module is now part of the standard library." "$LINENO" 5
32173217+ enableval=$enable_bigarray_lib; if test "x$enableval" != 'xno'; then :
32183218+ as_fn_error $? "The bigarray-lib option was deleted in OCaml 5.00, as the Bigarray module is now part of the standard library." "$LINENO" 5
32193219+fi
32173220fi
3218322132193222···3253325632543257# Check whether --enable-naked-pointers was given.
32553258if test "${enable_naked_pointers+set}" = set; then :
32563256- enableval=$enable_naked_pointers; as_fn_error $? "Naked pointers are not allowed in OCaml Multicore." "$LINENO" 5
32573257-else
32583258- $as_echo "#define NO_NAKED_POINTERS 1" >>confdefs.h
32593259+ enableval=$enable_naked_pointers; if test "x$enableval" != 'xno'; then :
32603260+ as_fn_error $? "Naked pointers were prohibited in OCaml 5.00." "$LINENO" 5
32613261+fi
32623262+fi
3259326332643264+32653265+# Check whether --enable-naked-pointers-checker was given.
32663266+if test "${enable_naked_pointers_checker+set}" = set; then :
32673267+ enableval=$enable_naked_pointers_checker; if test "x$enableval" != 'xno'; then :
32683268+ as_fn_error $? "The naked pointers checker was removed in OCaml 5.00." "$LINENO" 5
32693269+fi
32603270fi
326132713262327232633273# Check whether --enable-spacetime was given.
32643274if test "${enable_spacetime+set}" = set; then :
32653265- enableval=$enable_spacetime; as_fn_error $? "spacetime profiling was deleted in OCaml 4.12." "$LINENO" 5
32753275+ enableval=$enable_spacetime; if test "x$enableval" != 'xno'; then :
32763276+ as_fn_error $? "spacetime profiling was deleted in OCaml 4.12." "$LINENO" 5
32773277+fi
32663278fi
3267327932683280
+20-10
configure.ac
···259259 [enable_instrumented_runtime=auto])
260260261261AC_ARG_ENABLE([vmthreads], [],
262262- [AC_MSG_ERROR([The vmthreads library is no longer available. \
263263-It was deleted in OCaml 4.09.])],
262262+ [AS_IF([test "x$enableval" != 'xno'],
263263+ [AC_MSG_ERROR(m4_normalize([The vmthreads library is no longer available.
264264+ It was deleted in OCaml 4.09.]))])],
264265 [])
265266266267AC_ARG_ENABLE([systhreads],
···268269 [disable the Win32/POSIX threads library])])
269270270271AC_ARG_ENABLE([graph-lib], [],
271271- [AC_MSG_ERROR([The graphics library is no longer distributed with OCaml \
272272-since version 4.09. It is now distributed as a separate "graphics" package: \
273273-https://github.com/ocaml/graphics])],
272272+ [AS_IF([test "x$enableval" != 'xno'],
273273+ [AC_MSG_ERROR(m4_normalize([The graphics library is no longer distributed
274274+ with OCaml since version 4.09. It is now distributed as a separate
275275+ "graphics" package: https://github.com/ocaml/graphics]))])],
274276 [])
275277276278AC_ARG_ENABLE([str-lib],
···282284 [do not build the unix library])])
283285284286AC_ARG_ENABLE([bigarray-lib], [],
285285- [AC_MSG_ERROR([The bigarray-lib option was deleted in OCaml 5.00, \
286286-as the Bigarray module is now part of the standard library.])],
287287+ [AS_IF([test "x$enableval" != 'xno'],
288288+ [AC_MSG_ERROR(m4_normalize([The bigarray-lib option was deleted in OCaml
289289+ 5.00, as the Bigarray module is now part of the standard library.]))])],
287290 [])
288291289292AC_ARG_ENABLE([ocamldoc],
···310313 [use frame pointers in runtime and generated code])])
311314312315AC_ARG_ENABLE([naked-pointers], [],
313313- [AC_MSG_ERROR([Naked pointers are not allowed in OCaml Multicore.])],
314314- [AC_DEFINE([NO_NAKED_POINTERS])])
316316+ [AS_IF([test "x$enableval" != 'xno'],
317317+ [AC_MSG_ERROR([Naked pointers were prohibited in OCaml 5.00.])])],
318318+ [])
319319+320320+AC_ARG_ENABLE([naked-pointers-checker], [],
321321+ [AS_IF([test "x$enableval" != 'xno'],
322322+ [AC_MSG_ERROR([The naked pointers checker was removed in OCaml 5.00.])])],
323323+ [])
315324316325AC_ARG_ENABLE([spacetime], [],
317317- [AC_MSG_ERROR([spacetime profiling was deleted in OCaml 4.12.])],
326326+ [AS_IF([test "x$enableval" != 'xno'],
327327+ [AC_MSG_ERROR([spacetime profiling was deleted in OCaml 4.12.])])],
318328 [])
319329320330AC_ARG_ENABLE([cfi],
···181181 "Target supports function sections"
182182 "Target does not support function sections")
183183184184-let naked_pointers = make
185185- "naked_pointers"
186186- (Actions_helpers.pass_or_skip (Ocamltest_config.naked_pointers)
187187- "Runtime system supports naked pointers"
188188- "Runtime system does not support naked pointers")
189189-190184let has_symlink = make
191185 "has_symlink"
192186 (Actions_helpers.pass_or_skip (Unix.has_symlink () )
···308302 arch_i386;
309303 arch_power;
310304 function_sections;
311311- naked_pointers;
312305 file_exists;
313306 copy;
314307 ]
···118118119119val instrumented_runtime : bool
120120(** Whether the instrumented runtime is available *)
121121-122122-val naked_pointers : bool
123123-(** Whether the runtime system supports naked pointers outside the heap *)
···3333 (**
3434 Computes the total size (in words, including the headers) of all
3535 heap blocks accessible from the argument. Statically
3636- allocated blocks are excluded, unless the runtime system
3737- was configured with [--disable-naked-pointers].
3636+ allocated blocks are included.
38373938 @since 4.04
4039 *)
···11-(* TEST
22- modules = "is_in_static_data.c"
33- * naked_pointers
44- ** native
55-*)
66-77-(* Data that should be statically allocated by the compiler (all versions) *)
88-99-external is_in_static_data : 'a -> bool = "caml_is_in_static_data"
1010-1111-(* Basic constant blocks should be static *)
1212-let block1 = (1,2)
1313-let () = assert(is_in_static_data block1)
1414-1515-(* as pattern shouldn't prevent it *)
1616-let (a, b) as block2 = (1,2)
1717-let () = assert(is_in_static_data block2)
1818-1919-(* Also in functions *)
2020-let f () =
2121- let block = (1,2) in
2222- assert(is_in_static_data block)
2323-2424-let () = (f [@inlined never]) ()
2525-2626-(* Closed functions should be static *)
2727-let closed_function x = x + 1 (* + is a primitive, it cannot be in the closure*)
2828-let () = assert(is_in_static_data closed_function)
2929-3030-(* And functions using closed functions *)
3131-let almost_closed_function x =
3232- (closed_function [@inlined never]) x
3333-let () = assert(is_in_static_data almost_closed_function)
3434-3535-(* Recursive constant functions should be static *)
3636-let rec f1 a = g1 a
3737-and g1 a = f1 a
3838-let () =
3939- assert(is_in_static_data f1);
4040- assert(is_in_static_data g1)
-207
testsuite/tests/asmcomp/is_static_flambda.ml
···11-(* TEST
22- modules = "is_in_static_data.c is_static_flambda_dep.ml"
33- * flambda
44- ** naked_pointers
55- *** native
66-*)
77-88-(* Data that should be statically allocated by the compiler (flambda only) *)
99-1010-external is_in_static_data : 'a -> bool = "caml_is_in_static_data"
1111-1212-(* Also after inlining *)
1313-let g x =
1414- let block = (1,x) in
1515- assert(is_in_static_data block)
1616-1717-let () = (g [@inlined always]) 2
1818-1919-(* Toplevel immutable blocks should be static *)
2020-let block3 = (Sys.opaque_identity 1, Sys.opaque_identity 2)
2121-let () = assert(is_in_static_data block3)
2222-2323-(* Not being bound shouldn't prevent it *)
2424-let () =
2525- assert(is_in_static_data (Sys.opaque_identity 1, Sys.opaque_identity 2))
2626-2727-(* Only with rounds >= 2 currently !
2828-(* Also after inlining *)
2929-let h x =
3030- let block = (Sys.opaque_identity 1,x) in
3131- assert(is_in_static_data block)
3232-3333-let () = (h [@inlined always]) (Sys.opaque_identity 2)
3434-*)
3535-3636-(* Recursive constant values should be static *)
3737-let rec a = 1 :: b
3838-and b = 2 :: a
3939-let () =
4040- assert(is_in_static_data a);
4141- assert(is_in_static_data b)
4242-4343-(* And a mix *)
4444-type e = E : 'a -> e
4545-4646-let rec f1 a = E (g1 a, l1)
4747-and g1 a = E (f1 a, l2)
4848-and l1 = E (f1, l2)
4949-and l2 = E (g1, l1)
5050-5151-let () =
5252- assert(is_in_static_data f1);
5353- assert(is_in_static_data g1);
5454- assert(is_in_static_data l1);
5555- assert(is_in_static_data l2)
5656-5757-(* Also in functions *)
5858-let i () =
5959- let rec f1 a = E (g1 a, l1)
6060- and g1 a = E (f1 a, l2)
6161- and l1 = E (f1, l2)
6262- and l2 = E (g1, l1) in
6363-6464- assert(is_in_static_data f1);
6565- assert(is_in_static_data g1);
6666- assert(is_in_static_data l1);
6767- assert(is_in_static_data l2)
6868-6969-let () = (i [@inlined never]) ()
7070-7171-module type P = module type of Stdlib
7272-(* Top-level modules should be static *)
7373-let () = assert(is_in_static_data (module Stdlib:P))
7474-7575-(* Not constant let rec to test extraction to initialize_symbol *)
7676-let r = ref 0
7777-let rec a = (incr r; !r) :: b
7878-and b = (incr r; !r) :: a
7979-8080-let next =
8181- let r = ref 0 in
8282- fun () -> incr r; !r
8383-8484-let () =
8585- assert(is_in_static_data next)
8686-8787-(* Exceptions without arguments should be static *)
8888-exception No_argument
8989-let () = assert(is_in_static_data No_argument)
9090-9191-(* And also with constant arguments *)
9292-exception Some_argument of string
9393-let () = assert(is_in_static_data (Some_argument "some string"))
9494-9595-(* Even when exposed by inlining *)
9696-let () =
9797- let exn =
9898- try (failwith [@inlined always]) "some other string" with exn -> exn
9999- in
100100- assert(is_in_static_data exn)
101101-102102-(* Verify that approximation intersection correctly loads exported
103103- approximations.
104104-105105- Is_static_flambda_dep.pair is a pair with 1 as first element. The
106106- intersection of approximations should return a block with
107107- approximation: [tag 0: [tag 0: Int 1, Unknown], Unknown] *)
108108-let f x =
109109- let pair =
110110- if Sys.opaque_identity x then
111111- (1, 2), 3
112112- else
113113- Is_static_flambda_dep.pair, 4
114114- in
115115- let n = fst (fst pair) in
116116- let res = n, n in
117117- assert(is_in_static_data res)
118118- [@@inline never]
119119-120120-let () =
121121- f true;
122122- f false
123123-124124-(* Verify that physical equality/inequality is correctly propagated *)
125125-126126-(* In these tests, tuple can be statically allocated only if it is a
127127- known constant since the function is never inlined (hence this
128128- code is never at toplevel) *)
129129-130130-let () =
131131- let f () =
132132- let v = (1, 2) in
133133- (* eq is supposed to be considered always true since v is a
134134- constant, hence aliased to a symbol.
135135- It is not yet optimized away if it is not constant *)
136136- let eq = v == v in
137137- let n = if eq then 1 else 2 in
138138- let tuple = (n,n) in
139139- assert(is_in_static_data tuple)
140140- in
141141- (f [@inlined never]) ()
142142-143143-let () =
144144- let f () =
145145- let v = (1, 2) in
146146- (* same with inequality *)
147147- let eq = v != v in
148148- let n = if eq then 1 else 2 in
149149- let tuple = (n,n) in
150150- assert(is_in_static_data tuple)
151151- in
152152- (f [@inlined never]) ()
153153-154154-let () =
155155- let f x =
156156- let v1 = Some x in
157157- let v2 = None in
158158- let eq = v1 == v2 in
159159- (* The values are structurally different, so must be physically
160160- different *)
161161- let n = if eq then 1 else 2 in
162162- let tuple = (n,n) in
163163- assert(is_in_static_data tuple)
164164- in
165165- (f [@inlined never]) ()
166166-167167-let () =
168168- let f x =
169169- let v1 = Some x in
170170- let v2 = None in
171171- let eq = v1 != v2 in
172172- (* same with inequality *)
173173- let n = if eq then 1 else 2 in
174174- let tuple = (n,n) in
175175- assert(is_in_static_data tuple)
176176- in
177177- (f [@inlined never]) ()
178178-179179-let () =
180180- let f x =
181181- let v1 = (1, 2) in
182182- let v2 = (3, 2) in
183183- let eq = v1 == v2 in
184184- (* difference is deeper *)
185185- let n = if eq then 1 else 2 in
186186- let tuple = (n,n) in
187187- assert(is_in_static_data tuple)
188188- in
189189- (f [@inlined never]) ()
190190-191191-module Int = struct
192192- type t = int
193193- let compare (a:int) b = compare a b
194194-end
195195-module IntMap = Map.Make (Int)
196196-197197-let () =
198198- let f () =
199199- let a = IntMap.empty in
200200- let b = (IntMap.add [@inlined]) 1 (Some 1) a in
201201- assert(is_in_static_data b);
202202- let c = (IntMap.add [@inlined]) 1 (Some 2) b in
203203- assert(is_in_static_data c);
204204- let d = (IntMap.add [@inlined]) 1 (Some 2) c in
205205- assert(is_in_static_data d);
206206- in
207207- (f [@inlined never]) ()
···11-(* TEST
22- modules = "is_in_static_data.c simple_float_const.ml"
33- * flambda
44- ** flat-float-array
55- *** naked_pointers
66- **** native
77-*)
88-99-external is_in_static_data : 'a -> bool = "caml_is_in_static_data"
1010-1111-let a = [|0.; 1.|]
1212-let f = 1.23
1313-let b = [|0.; f; f|]
1414-let g = Sys.opaque_identity 1.23
1515-let c = [|0.; g|]
1616-let d = [|0.; Simple_float_const.f|]
1717-1818-let () = assert(is_in_static_data a)
1919-let () = assert(is_in_static_data f)
2020-let () = assert(is_in_static_data b)
2121-2222-let () = assert(not (is_in_static_data c))
2323-(* In fact this one could be static by preallocating the array then
2424- patching it when g is available *)
2525-2626-let () = assert(is_in_static_data d)
···11-(* TEST
22- modules = "is_in_static_data.c simple_float_const_opaque.ml"
33- flags = "-opaque"
44- * flambda
55- ** flat-float-array
66- *** naked_pointers
77- **** native
88-*)
99-1010-external is_in_static_data : 'a -> bool = "caml_is_in_static_data"
1111-1212-let a = [|0.; 1.|]
1313-let f = 1.23
1414-let b = [|0.; f; f|]
1515-let g = Sys.opaque_identity 1.23
1616-let c = [|0.; g|]
1717-let d = [|0.; Simple_float_const_opaque.f|]
1818-1919-let () = assert(is_in_static_data a)
2020-let () = assert(is_in_static_data f)
2121-let () = assert(is_in_static_data b)
2222-2323-let () = assert(not (is_in_static_data c))
2424-(* In fact this one could be static by preallocating the array then
2525- patching it when g is available *)
2626-2727-let () = assert(not (is_in_static_data d))
2828-(* The dependency Simple_float_const_opaque is built with opaque,
2929- hence the value of Simple_float_const_opaque.f cannot be known
3030- preventing the static allocation of d *)