Skip to content

Commit

Permalink
Move immutable array modules to Stable_stdlib (#2570)
Browse files Browse the repository at this point in the history
* Use Dune 3.15.2 in CI

* Update docs

* Fix typo

* Bump Dune language version to 3.11

* `glob_files` in beta

* `glob_files` in alpha

* `glob_files` in stable

* `glob_files` in upstream_compatible

* Move directories

* Rename files

* Some makefile changes

* Revert

* Clone libraries under old names

* Fix makefile

* Export new libraries in tests

* Tests

* Fix indentation

* Fix indentation

* Move files to `stdlib_stable` from `stdlib`

* Move `Iarray` to `Stdlib_stable`

* Fix `Iarray` tests

---------

Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com>
  • Loading branch information
dkalinichenko-js and d-kalinichenko committed May 14, 2024
1 parent 2207eb1 commit db0f07b
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 56 deletions.
4 changes: 4 additions & 0 deletions ocaml/otherlibs/stable/dune
Original file line number Diff line number Diff line change
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 Down
File renamed without changes.
File renamed without changes.
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
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
3 changes: 2 additions & 1 deletion ocaml/testsuite/tests/typing-local/float_iarray.ml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(* TEST
include stdlib_stable;
{
reference = "${test_source_directory}/float_iarray.heap.reference";
bytecode;
Expand All @@ -16,7 +17,7 @@
(* Testing that local [float iarray]s don't allocate on access. This is a
question because for flat float arrays, accesses have to box the float. *)

module Iarray = Stdlib__Iarray
module Iarray = Stdlib_stable.Iarray

let ( .:() ) = Iarray.( .:() )

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
(* TEST
include stdlib_stable;
{
reference = "${test_source_directory}/iarray.byte.reference";
reference = "${test_source_directory}/test_iarray.byte.reference";
bytecode;
}{
stack-allocation;
reference = "${test_source_directory}/iarray.stack.reference";
reference = "${test_source_directory}/test_iarray.stack.reference";
native;
}{
no-stack-allocation;
reference = "${test_source_directory}/iarray.heap.reference";
reference = "${test_source_directory}/test_iarray.heap.reference";
native;
}
*)
Expand All @@ -21,7 +22,7 @@
2. Correctness: They actually create arrays on the stack (by testing that no
GCed allocation happens). *)

module Iarray = Stdlib__Iarray
module Iarray = Stdlib_stable.Iarray

external opaque_local : local_ 'a -> local_ 'a = "%opaque"

Expand Down

0 comments on commit db0f07b

Please sign in to comment.