Add bigarray to the stdlib#1685
Conversation
|
FWIW, ocamltest has a bigarray modifier to include the bigarray library
under otherlibs.
Am I correct that this PR would make the modifier un-necessary?
If I amcorrect, then the PR could include its removal and perhaps also
an update to the tests that makeuse of it.
|
|
Indeed, I removed the modifier |
|
|
|
I am reviewing this. |
|
This is going to produce an unrelated test failure which I have emailed @shindere about, but this patch is OK, and we should merge before 4.07. A bootstrap commit will be needed to remove some redundant primitives; I will do this. |
|
The only failure for a reasonable set of targets appears to be the one which @shindere is currently working on, and I need to follow this with a manual bootstrap commit anyway, so I am going to merge this now. |
|
The bootstrap which completes this GPR is in |
|
This closes MPR6139 |
|
Thanks @dbuenzli, I'll add the mantis issue to the Changes entry. |
|
@diml sorry for asking this question so late. Am I correct that, as far as the source tree is concerned, the bigarray May I ask why and whether there is any plan to do so in a further PR? |
|
They were moved, however the bigarray library is kept for compatibility. The |
|
Jérémie Dimino (2018/04/18 14:05 +0000):
They were moved, however the bigarray library is kept for
compatibility. The `Bigarray.*.map_file` functions were deprecated in
4.06, so we just need to wait a reasonable amount of time before
deleting the bigarray library entirely. I assume that deleting it in
4.08 should be ok.
OK I must really have missed something, sorry.
Which .cma file is one supposed to use when trying to use the bigarray
lib from the sources (without installing?)
|
|
You should just use the If you do want to use the deprecated bigarray library, then you need to to use bigarray.cma as before. |
|
Jérémie Dimino (2018/04/18 14:35 +0000):
You should just use the `Bigarray` module from the stdlib, so you
don't need any special cma.
I do need to handle the cmas directly, see for instance the
lib-dynlink-csharp test, you can git grep for bigarray.cma in this
directory and you'll see.
|
|
Ok, this test should still work as bigarray.cma still exists at the same place. |
|
Jérémie Dimino (2018/04/18 14:45 +0000):
Ok, this test should still work as bigarray.cma still exists at the
same place.
Yeah I confim. I was just wondering why this file has not been moved to
stdlib?
|
|
Because it's not part of the stdlib :)
|
|
Jérémie Dimino (2018/04/18 14:57 +0000):
Because it's not part of the stdlib :)
`Stdlib.Bigarray`, like all other stdlib modules, is compiled as
`Stdlib__Bigarray` and ends up part of `stdlib.cma/cmxa`.
`bigarray.cma` is only the deprecated bigarray library, which simply
extends `Stdlib.Bigarray` with the deprecated functions.
Okay thanks. I'm not sure what one will have to do re:this
lib-dynlink-csharp test when the deprecated bigarray will be removed?
Perhaps the tes will simply no longer need to load it and will continue
to work?
|
I believe so. It should even work right now |
|
Jérémie Dimino (2018/04/18 15:03 +0000):
> Perhaps the tes will simply no longer need to load it and will continue
to work?
I believe so. It should even work right now
OK then I'll get rid of bigarray while porting to ocamltest
Thanks a lot for your support!
… |
|
@diml and @alainfrisch : I am assumiing that unix.cma and unix.cmxs were loaded only to support I hope stopping to load them does not defeat the purpose of the test itself |
|
I admit I don't really know what this test is doing, but I assume that it should indeed load a few files. Maybe the plugin should be updated to test a different function |
|
Jérémie Dimino (2018/04/18 16:03 +0000):
I admit I don't really know what this test is doing, but I assume that
it should indeed load a few files. Maybe the plugin should be updated
to test a different function
Let's hope @alainfrisch will tell us. :)
|
Relevant changes in 4.07 - unix.c now #include <sys/ioctl.h> (since 852b595ff3), but an empty one is fine (only use is in caml_nun_rows_fd in an #ifdef TIOCGWINSZ), see ocaml/ocaml#1431 -> provide an empty ioctl via nolibc - bigarray is now part of the stdlib ocaml/ocaml#1685 -> libotherlibs.a is no longer needed (neither built nor linked)
Relevant changes in 4.07 - unix.c now #include <sys/ioctl.h> (since 852b595ff3), but an empty one is fine (only use is in caml_nun_rows_fd in an #ifdef TIOCGWINSZ), see ocaml/ocaml#1431 -> provide an empty ioctl via nolibc - bigarray is now part of the stdlib ocaml/ocaml#1685 -> libotherlibs.a is no longer needed (neither built nor linked) To support these changes, an empty sys/ioctl.h is added to nolibc. Also, `ocaml-freestanding.pc.in` now contains in `Libs`: -L${libdir} -lasmrum -lnolibc -lopenlibm (instead of ${libdir}/lib for each library). `configure.sh` adds -lotherlibs to these flags in the case that OCAML_GTE_4_07_0 is false. The `Makefile` treats libotherlibs.a as dependency only if OCAML_GTE_4_07_0 is false.
This PR is the next step in moving Bigarray to the Standard Library.
Overview
It moves the Bigarray module to the standard library without the
map_filefunctions. The bigarray library is kept for compatibility purposes and simply extends Stdlib.Bigarray with the deprecaredmap_filefunctions. This way users have more time to update their code, especially the ones who want to keep compatibility with OCaml < 4.06.0.Other relevant details:
otherlibs/bigarray/bigarray_stubswas appended at the end ofbyterun/bigarray.cCamlinternalBigarraymodule was removed since it is no longer neededLimitation
Because all the cmi files are installed in the same directory, in the initial environment the module name
Bigarrayalways resolves toBigarrayfrom the bigarray library rather thanStdlib.Bigarray. One has to useStdlib.Bigarrayexplicitely in order to use bigarrays without depending on unix.Reviewing
Because some code was moved around, the diff shows a lot of added and deleted code. It is easier to review the following files with these commands:
stdlib/bigarray.ml:patdiff <(git show trunk:otherlibs/bigarray/bigarray.ml) stdlib/bigarray.mlstdlib/bigarray.mli:patdiff <(git show trunk:otherlibs/bigarray/bigarray.mli) stdlib/bigarray.mlibyterun/bigarray.c:patdiff <(git show trunk:byterun/bigarray.c; git show trunk:otherlibs/bigarray/bigarray_stubs.c) byterun/bigarray.c