Move compressed marshaling away from the stdlib and into the compilers (trunk version)#12758
Conversation
Late thought: libcomprmarsh.a could probably just as well reside in compilerlibs/ , both during build and after installation. Keep this possibility in mind during review. |
b00370c to
f26bbf6
Compare
I understand this choice corresponds to the second bullet point in #12734 (comment). Was this chosen because of simplicity, to avoid changing the way the compiler works? And regardless of this PR, do we agree that the change mentioned in the first bullet point would be an improvement in general? |
Yes! You're right I should have been more explicit.
For reference: the first bullet point is about changing I'm not 100% comfortable with this change because there's no way to change At any rate, the "first bullet" approach that is followed in this PR (an explicit libcomprmarsh.a library, autolinked from ocamlcommon.cmxa) is a step towards an otherlibs/compression library providing compressed marshaling and other data compression facilities to the users. (Stay tuned!) |
6454050 to
535d4e4
Compare
|
@hhugo is there a possibility that you would be interested in reviewing this PR? |
damiendoligez
left a comment
There was a problem hiding this comment.
Looks good to me, I found only a typo.
IIUC, this would make sense with the current version, but you'd have to move it back to provide compression for general marshalling, right? |
Currently, both the bytecode version and the native-code version of Dynlink drag in many modules from the compiler, including some that use compressed marshaling. This causes users of dynlink.cmxa to depend on -lzstd systematically. Actually, the native-code version of Dynlink needs much fewer compiler modules, none of which require compressed marshaling. This commit just shrinks the list of compiler modules included in dynlink.cmxa, thus cutting the dependency on -lzstd. (cherry picked from commit c6d6e8b)
2cb97c9 to
bee4cc8
Compare
These functions used to be in extern.c and intern.c. Now, they are in zstd.c and connect themselves to extern.c and intern.c via hooks activated by a new primitive `caml_zstd_initialize`. (cherry picked from commit aae3ad5)
- Removes the Marshal.Compression constructor and the Marshal.compression_supported function, in preparation for a different user-facing API later. - Introduce the Compression module in the compiler sources, providing simple compressed marshaling support (just `output_value` and `input_value` for now) - Call caml_zstd_initialize from Compression. - Add missing type constraint in otherlibs/dynlink/byte/dynlink.ml - Update configure messages accordingly. (cherry picked from commit 5068559) (cherry picked from commit 02b0d07) (cherry picked from commit e5c9d45) (cherry picked from commit 6db7ccb) (cherry picked from commit 8abed5e) Co-authored-by: Xavier Leroy <xavier.leroy@college-de-france.fr>
…erlibs To this end, we produce a new library libcomprmarsh.a, containing runtime/zstd.n.o, and attach both -lcomprmarsh and -lzstd to ocamlcommon.cmxa. (cherry picked and much improved from commit 9398511)
b8f21c7 to
735e26b
Compare
|
Thanks for the feedback! I merged without further delay because the bootstrap in this PR is a pain to re-do properly. (It is absolutely necessary to disable ZSTD compression until the new compilers are stable.) I will now attempt a backport to 5.2. |
|
Cherry-picked to 5.2. The bootstrap had to be redone for 5.2, so I cherry-picked each commit individually. We end up with cherry-picks of cherry-picks... I hope everything is OK. That's what happens when urgent PRs are not reviewed before a release branch is cut. |
This is the "forward port" of #12734 from the 5.1 branch to the trunk.
Besides adapting to recent changes in extern.c and in the top Makefile, this PR also proposes a different way to auto-link compressed marshaling support when ocamlcommon.cmxa is used:
@dra27 and I did not want to follow this approach in a minor release like 5.1.1, as it introduces a new installed file, which could upset packagers. But it seems appropriate for a major release like 5.2.
This is the only significant change from #12734. Compare 833ca02 (this PR) with 9398511 (the 5.1.1 solution).