Skip to content

Commit

Permalink
Revert "Move immutable array modules to Stable_stdlib (#2570)" (#2594)
Browse files Browse the repository at this point in the history
This reverts commit db0f07b.

Co-authored-by: Diana Kalinichenko <dkalinichenko@janestreet.com>
  • Loading branch information
dkalinichenko-js and d-kalinichenko committed May 20, 2024
1 parent db58a68 commit 8a1a5d0
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 27 deletions.
4 changes: 0 additions & 4 deletions ocaml/otherlibs/stable/dune
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
(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
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 = Iarray
module IarrayLabels = IarrayLabels
module Iarray = Stdlib__Iarray
module IarrayLabels = Stdlib__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 = Iarray
module IarrayLabels = IarrayLabels
module Iarray = Stdlib__Iarray
module IarrayLabels = Stdlib__IarrayLabels
26 changes: 26 additions & 0 deletions ocaml/stdlib/.depend
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,32 @@ 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: 2 additions & 0 deletions ocaml/stdlib/StdlibModules
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ STDLIB_MODULE_BASENAMES = \
unit \
marshal \
array \
iarray \
float \
int32 \
nativeint \
Expand Down Expand Up @@ -93,6 +94,7 @@ STDLIB_MODULE_BASENAMES = \
filename \
complex \
arrayLabels \
iarrayLabels \
listLabels \
bytesLabels \
stringLabels \
Expand Down
12 changes: 12 additions & 0 deletions ocaml/stdlib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@
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 @@ -276,6 +280,12 @@
.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 @@ -478,6 +488,8 @@
.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))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 2 additions & 4 deletions ocaml/testsuite/tests/array-functions/test_iarray.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
(* TEST
include stdlib_stable;
*)
(* TEST *)

module Iarray = Stdlib_stable.Iarray
module Iarray = Stdlib__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,12 +1,11 @@
(* TEST
flags = "-extension comprehensions";
include stdlib_stable;
expect;
*)

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

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

module Iarray = Stdlib_stable.Iarray
module Iarray = Stdlib__Iarray

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

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

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

Expand All @@ -16,7 +15,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_stable.Iarray
module Iarray = Stdlib__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: 1 addition & 2 deletions ocaml/testsuite/tests/typing-local/float_iarray.ml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(* TEST
include stdlib_stable;
{
reference = "${test_source_directory}/float_iarray.heap.reference";
bytecode;
Expand All @@ -17,7 +16,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_stable.Iarray
module Iarray = Stdlib__Iarray

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

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

module Iarray = Stdlib_stable.Iarray
module Iarray = Stdlib__Iarray

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

Expand Down

0 comments on commit 8a1a5d0

Please sign in to comment.