Skip to content

Re-roll "Move immutable array modules to Stable_stdlib" #2597

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 4 commits into from
May 22, 2024
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
8 changes: 1 addition & 7 deletions ocaml/otherlibs/alpha/dune
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

(library
(name alpha)
(wrapped false)
(public_name ocaml.alpha)
(modes byte native)
(flags
(-strict-sequence
Expand Down Expand Up @@ -56,9 +56,3 @@
(with-stdout-to
to_install.sexp
(run "%{first-dep}" "alpha"))))

(install
(files
(include to_install.sexp))
(section lib)
(package ocaml))
10 changes: 1 addition & 9 deletions ocaml/otherlibs/beta/dune
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

(library
(name beta)
(wrapped false)
(public_name ocaml.beta)
(modes byte native)
(enabled_if
(= %{architecture} "amd64"))
Expand Down Expand Up @@ -58,11 +58,3 @@
(with-stdout-to
to_install.sexp
(run "%{first-dep}" "beta"))))

(install
(enabled_if
(= %{architecture} "amd64"))
(files
(include to_install.sexp))
(section lib)
(package ocaml))
12 changes: 5 additions & 7 deletions ocaml/otherlibs/stable/dune
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

(library
(name stable)
(wrapped false)
(public_name ocaml.stable)
(modes byte native)
(flags
(-strict-sequence
Expand Down Expand Up @@ -46,6 +46,10 @@
(targets
float_u.ml
float_u.mli
iarray.ml
iarray.mli
iarrayLabels.ml
iarrayLabels.mli
int32_u.ml
int32_u.mli
int64_u.ml
Expand All @@ -66,9 +70,3 @@
(with-stdout-to
to_install.sexp
(run "%{first-dep}" "stable"))))

(install
(files
(include to_install.sexp))
(section lib)
(package ocaml))
8 changes: 1 addition & 7 deletions ocaml/otherlibs/stdlib_alpha/dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

(library
(name stdlib_alpha)
(wrapped false)
(public_name ocaml.stdlib_alpha)
(modes byte native)
(flags
(-strict-sequence
Expand Down Expand Up @@ -42,9 +42,3 @@
(with-stdout-to
to_install.sexp
(run "%{first-dep}" "stdlib_alpha"))))

(install
(files
(include to_install.sexp))
(section lib)
(package ocaml))
10 changes: 1 addition & 9 deletions ocaml/otherlibs/stdlib_beta/dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

(library
(name stdlib_beta)
(wrapped false)
(public_name ocaml.stdlib_beta)
(modes byte native)
(enabled_if
(= %{architecture} "amd64"))
Expand Down Expand Up @@ -44,11 +44,3 @@
(with-stdout-to
to_install.sexp
(run "%{first-dep}" "stdlib_beta"))))

(install
(enabled_if
(= %{architecture} "amd64"))
(files
(include to_install.sexp))
(section lib)
(package ocaml))
8 changes: 1 addition & 7 deletions ocaml/otherlibs/stdlib_stable/dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

(library
(name stdlib_stable)
(wrapped false)
(public_name ocaml.stdlib_stable)
(modes byte native)
(flags
(-strict-sequence
Expand Down Expand Up @@ -42,9 +42,3 @@
(with-stdout-to
to_install.sexp
(run "%{first-dep}" "stdlib_stable"))))

(install
(files
(include to_install.sexp))
(section lib)
(package ocaml))
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions ocaml/otherlibs/stdlib_stable/stdlib_stable.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ module Float_u = Float_u
module Int32_u = Int32_u
module Int64_u = Int64_u
module Nativeint_u = Nativeint_u
module Iarray = Stdlib__Iarray
module IarrayLabels = Stdlib__IarrayLabels
module Iarray = Iarray
module IarrayLabels = IarrayLabels
4 changes: 2 additions & 2 deletions ocaml/otherlibs/stdlib_stable/stdlib_stable.mli
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ module Float_u = Float_u
module Int32_u = Int32_u
module Int64_u = Int64_u
module Nativeint_u = Nativeint_u
module Iarray = Stdlib__Iarray
module IarrayLabels = Stdlib__IarrayLabels
module Iarray = Iarray
module IarrayLabels = IarrayLabels
8 changes: 1 addition & 7 deletions ocaml/otherlibs/stdlib_upstream_compatible/dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

(library
(name stdlib_upstream_compatible)
(wrapped false)
(public_name ocaml.stdlib_upstream_compatible)
(modes byte native)
(flags
(-strict-sequence
Expand Down Expand Up @@ -42,9 +42,3 @@
(with-stdout-to
to_install.sexp
(run "%{first-dep}" "stdlib_upstream_compatible"))))

(install
(files
(include to_install.sexp))
(section lib)
(package ocaml))
21 changes: 0 additions & 21 deletions ocaml/otherlibs/to_install.sh

This file was deleted.

8 changes: 1 addition & 7 deletions ocaml/otherlibs/upstream_compatible/dune
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

(library
(name upstream_compatible)
(wrapped false)
(public_name ocaml.upstream_compatible)
(modes byte native)
(flags
(-strict-sequence
Expand Down Expand Up @@ -57,9 +57,3 @@
(with-stdout-to
to_install.sexp
(run "%{first-dep}" "upstream_compatible"))))

(install
(files
(include to_install.sexp))
(section lib)
(package ocaml))
26 changes: 0 additions & 26 deletions ocaml/stdlib/.depend
Original file line number Diff line number Diff line change
Expand Up @@ -454,32 +454,6 @@ stdlib__Hashtbl.cmx : hashtbl.ml \
stdlib__Hashtbl.cmi : hashtbl.mli \
stdlib.cmi \
stdlib__Seq.cmi
stdlib__Iarray.cmo : iarray.ml \
stdlib.cmi \
stdlib__Seq.cmi \
stdlib__Array.cmi \
stdlib__Iarray.cmi
stdlib__Iarray.cmx : iarray.ml \
stdlib.cmx \
stdlib__Seq.cmx \
stdlib__Array.cmx \
stdlib__Iarray.cmi
stdlib__Iarray.cmi : iarray.mli \
stdlib.cmi \
stdlib__Seq.cmi
stdlib__IarrayLabels.cmo : iarrayLabels.ml \
stdlib.cmi \
stdlib__Seq.cmi \
stdlib__Array.cmi \
stdlib__IarrayLabels.cmi
stdlib__IarrayLabels.cmx : iarrayLabels.ml \
stdlib.cmx \
stdlib__Seq.cmx \
stdlib__Array.cmx \
stdlib__IarrayLabels.cmi
stdlib__IarrayLabels.cmi : iarrayLabels.mli \
stdlib.cmi \
stdlib__Seq.cmi
stdlib__In_channel.cmo : in_channel.ml \
stdlib__Sys.cmi \
stdlib.cmi \
Expand Down
2 changes: 0 additions & 2 deletions ocaml/stdlib/StdlibModules
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ STDLIB_MODULE_BASENAMES = \
unit \
marshal \
array \
iarray \
float \
int32 \
nativeint \
Expand Down Expand Up @@ -94,7 +93,6 @@ STDLIB_MODULE_BASENAMES = \
filename \
complex \
arrayLabels \
iarrayLabels \
listLabels \
bytesLabels \
stringLabels \
Expand Down
12 changes: 0 additions & 12 deletions ocaml/stdlib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@
gc.mli
hashtbl.ml
hashtbl.mli
iarray.ml
iarray.mli
iarrayLabels.ml
iarrayLabels.mli
in_channel.ml
in_channel.mli
int.ml
Expand Down Expand Up @@ -280,12 +276,6 @@
.stdlib.objs/byte/stdlib__Hashtbl.cmi
.stdlib.objs/byte/stdlib__Hashtbl.cmt
.stdlib.objs/byte/stdlib__Hashtbl.cmti
.stdlib.objs/byte/stdlib__Iarray.cmi
.stdlib.objs/byte/stdlib__Iarray.cmt
.stdlib.objs/byte/stdlib__Iarray.cmti
.stdlib.objs/byte/stdlib__IarrayLabels.cmi
.stdlib.objs/byte/stdlib__IarrayLabels.cmt
.stdlib.objs/byte/stdlib__IarrayLabels.cmti
.stdlib.objs/byte/stdlib__In_channel.cmi
.stdlib.objs/byte/stdlib__In_channel.cmt
.stdlib.objs/byte/stdlib__In_channel.cmti
Expand Down Expand Up @@ -488,8 +478,6 @@
.stdlib.objs/native/stdlib__Either.cmx
.stdlib.objs/native/stdlib__In_channel.cmx
.stdlib.objs/native/stdlib__Out_channel.cmx
.stdlib.objs/native/stdlib__Iarray.cmx
.stdlib.objs/native/stdlib__IarrayLabels.cmx
(META as stdlib/META))
(section lib)
(package ocaml_runtime_stdlib))
6 changes: 4 additions & 2 deletions ocaml/testsuite/tests/array-functions/test_iarray.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
(* TEST *)
(* TEST
include stdlib_stable;
*)

module Iarray = Stdlib__Iarray
module Iarray = Stdlib_stable.Iarray
external ( .:() ) : 'a iarray -> int -> 'a = "%array_safe_get"

(* Copied from [test.ml], but with all the [Array.fill] tests deleted *)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
(* TEST
flags = "-extension comprehensions";
include stdlib_stable;
expect;
*)

module Iarray = Stdlib__Iarray;;
module Iarray = Stdlib_stable.Iarray;;
[%%expect{|
module Iarray = Stdlib__Iarray
module Iarray = Stdlib_stable.Iarray
|}];;

(******************************************************************************
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
(* TEST
flags = "-extension comprehensions";
include stdlib_stable;
*)

module Iarray = Stdlib__Iarray
module Iarray = Stdlib_stable.Iarray

(******************************************************************************
* ******** ATTENTION! ******** *
Expand Down
5 changes: 3 additions & 2 deletions ocaml/testsuite/tests/lib-array/test_iarray.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
(* TEST
include stdlib_stable;
expect;
*)

module Iarray = Stdlib__Iarray;;
module Iarray = Stdlib_stable.Iarray;;

external ( .:() ) : 'a iarray -> int -> 'a = "%array_safe_get";;

Expand All @@ -15,7 +16,7 @@ let marray : int array = [|1;2;3;4;5|];;
let mfarray : float array = [|1.5;2.5;3.5;4.5;5.5|];;

[%%expect{|
module Iarray = Stdlib__Iarray
module Iarray = Stdlib_stable.Iarray
external ( .:() ) : 'a iarray -> int -> 'a = "%array_safe_get"
val iarray : int iarray = [:1; 2; 3; 4; 5:]
val ifarray : float iarray = [:1.5; 2.5; 3.5; 4.5; 5.5:]
Expand Down
1 change: 1 addition & 0 deletions ocaml/testsuite/tests/mixed-blocks/constructor_args.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
(* Prelude: Functions on unboxed numbers *)

module Float32_u = Beta.Float32_u
module Float32 = Beta.Float32
module Float_u = Stable.Float_u
module Int32_u = Stable.Int32_u
module Int64_u = Stable.Int64_u
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module Float32_u_array0 : Gen_u_array.S0
"caml_array_blit" "caml_unboxed_float32_vect_blit"
let empty () = [||]
external to_boxed : ('a : float32) -> (float32[@local_opt]) = "%box_float32"
let compare_element x y = Float32.compare (to_boxed (x ())) (to_boxed (y ()))
let compare_element x y = Beta.Float32.compare (to_boxed (x ())) (to_boxed (y ()))
end

module Float32_u_array = Gen_u_array.Make (Float32_u_array0)
Expand Down
8 changes: 4 additions & 4 deletions ocaml/testsuite/tests/typing-layouts-float32/alloc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ struct
measure_alloc (fun () -> go #0.s #0.s)
in
Printf.printf "Unboxed:\n estimate: %f\n allocations: %s\n"
(Float32.to_float (to_float32 est) *. 4.) (get_allocations ())
(Beta.Float32.to_float (to_float32 est) *. 4.) (get_allocations ())
end

module Pi_boxed =
struct
open Float32
open Beta.Float32
open Operators

let[@inline never] step n estimate =
Expand Down Expand Up @@ -125,8 +125,8 @@ let print_record_and_allocs s r =
Printf.printf
"%s:\n allocated bytes: %.2f\n a: %.2f\n b: %.2f\n c: %.2f\n d: %.2f\n"
s allocs
(Float32.to_float (Float32_u.to_float32 r.a)) (Float32.to_float (Float32_u.to_float32 r.b))
(Float32.to_float (Float32_u.to_float32 r.c)) (Float32.to_float (Float32_u.to_float32 r.d))
(Beta.Float32.to_float (Float32_u.to_float32 r.a)) (Beta.Float32.to_float (Float32_u.to_float32 r.b))
(Beta.Float32.to_float (Float32_u.to_float32 r.c)) (Beta.Float32.to_float (Float32_u.to_float32 r.d))

(* Building a record should only allocate the box *)
let[@inline never] build x =
Expand Down
Loading
Loading