Conversation
e79b360 to
d8e87a6
Compare
|
I pushed a simplified version of the PR (build the prefixed version in parallel to the unprefixed one). This way the existing build system is not touched at all which makes the change much easier to digest and we can trivially distribute both versions for backwards-compatibility. I have updated the PR description in consequence and removed the [POC] from the PR title since I am happy with this approach. |
78845d3 to
0825b97
Compare
|
Taking a cue from #1569, I adapted the |
|
Some rough timings for This PR: trunk: |
1bb5b64 to
119335a
Compare
|
Thanks for working on this! I'm really looking forward not having to expunge toplevels as this leads to really confusing situations for users. I wanted to give this a try in utop, which made me wonder how the new prefixed libraries should be presented to the user. Have you thought about this? The current prefixed libraries are available as BTW, if we compile the two versions in parallel, then we won't be able to easily share values between code using the unprefixed version and code using the prefixed version. This is not a huge deal, but we could avoid it generating the following implementations for modules of the unprefixed version: This should also cut build times.
Maybe we should keep it as well for the sub-directory names? |
|
Many thanks for this great piece of work, @nojb! As you mentionned dependencies and just out of curiosity: according to |
|
Thanks for the comments!
Yes, that's one possibility. Another one could be
This is a neat idea; I will give it a try.
Indeed. |
Dealing with dependencies took about 50% of the time so far, I would say. Do you have something particular in mind? |
|
Nicolás Ojeda Bär (2019/01/14 13:55 +0000):
> As you mentionned dependencies and just out of curiosity: according to
> you, how much simpler would your task have been, were there no .depend files
> to take into account?
Dealing with dependencies took about 50% of the time so far, I would say.
Do you have something particular in mind?
Yeah, one of the thing that's waiting on my to-do-list for a very long
time is to try computing the dependencies dynamically rather than
storing them, but as I see it that's quite a lot of work so not sure it
will happen soon.
|
5a3f611 to
8ca15ae
Compare
d9c6aad to
710ba52
Compare
|
I pushed one more commit implementing most of @diml's suggestion. Differences with previous commit:
Still left to do adapt:
|
858a3e7 to
25edde1
Compare
How bad is that in practice ? Aren't most users using |
|
I'd to highlight that strictly speaking one does not need to get rid of the expunge process for improving the toplevel experience. Rather the proper functionality has to be exposed in the |
Thanks for the review. I pushed a fix for this along with several simplifications.
Yes, they are disabled because |
f886ded to
a5063f5
Compare
|
This may not be directly related to this PR, but at least |
Good question, I am not sure; will try to do some git archaeology to see if it reveals anything. |
The |
|
Recently (more or less) we added support for |
|
|
||
| compilerlibs/ocaml_common__compdynlink.cmo: \ | ||
| compilerlibs/ocaml_common__compdynlink.mlbyte | ||
| $(CAMLC) $(COMPFLAGS) $(shell compilerlibs/Compflags $@) -c -impl $< |
There was a problem hiding this comment.
@shindere will be sad to see a new Compflags script added to the build system...
|
Please check this on MacOS before you merge (for example with precheck) because Apple's version of gnumake is rather old and the Makefile changes are non-trivial. |
|
Damien Doligez (2019/04/10 10:17 +0000):
damiendoligez commented on this pull request.
> @@ -723,19 +511,93 @@ manual-pregen: opt.opt
# The clean target
clean:: partialclean
+# Prefixed compiler-libs
+
+compilerlibs/ocaml_common__compdynlink.cmo: \
+ compilerlibs/ocaml_common__compdynlink.mlbyte
+ $(CAMLC) $(COMPFLAGS) $(shell compilerlibs/Compflags $@) -c -impl $<
@shindere will be sad to see a new `Compflags` script added to the
build system...
Indeed. Well initially it was @xavierleroy's suggestion to get rid of
such scripts, see #8601.
|
|
I had sort of forgotten about this PR. For the record, I have been bitten by compiler-units-name conflicts related to compilerlibs recently (I had a From a high-level perspective, I think it's a royal pain that all OCaml projects have to consider unit prefixing/wrapping; Dune makes it somewhat hidden, but they remain ugly workarounds for the lack of a proper namespacing system -- or at least support mixing compilation units with the same file name and different digests in the same project (my own #2228 was a zero-th step in this direction, and I know @mshinwell and @lpw25 are working on this on-and-off as well). |
|
I closed this PR because it was seriously out of date, but I am planning to take another shot at this shortly, following your #9211 which has rearranged some things in a useful way. |
This PR proposes to prefix
compiler-libs.Why?
To get rid of the
expungeprocess: this is necessary to allow several interesting improvements to the toplevel experience (see MPR#7589 and MPR#6704)compiler-libsincludes many modules with common names (Path,Location,Parser, etc). Prefixing it will be an improvement for all users.Proposal
As written above, we put all the modules in
compiler-libsunder a prefix. Actually we use four different top-level modules:Ocaml_commoncorresponding toocamlcommon.cmaOcaml_bytecompcorresponding toocamlbytecomp.cmaOcaml_optcompcorresponding toocamloptcomp.cmaOcaml_toplevelcorresponding toocamltoplevel.cmaBackwards compatibility
This will break all users of
compiler-libs. To maintain backwards compatibility both the prefixed and unprefixed versions are distributed as a transitional measure. In any case, the unprefixed version is the one used to build the compiler (to avoid invasive changes to the build system).Approach
The idea is not to touch the build of the compiler at all, so a parallel, prefixed, version of
compiler-libsis built inside a special directory,prefixed_compilerlibs.The prefix modules are generated at
prefixed_compilerlibs/ocaml_{common,bytecomp,optcomp,toplevel}.mlusing the scripttools/gen_prefix.ml.Each file, eg
bytecomp/lambda.mlis copied to a prefixed sourceprefixed_compilerlibs/ocaml_common__lambda.ml, and then we use the official recipe for compiling prefixed libraries as explained in the manual. This way one can useocamldepdirectly on the prefixed sources to compute dependendencies.The implementation uses
Makefilemacros to tame some of the duplication.Current state
The patch is complete:
make worldandmake world.optmake dependmake installin per-library directories under thestdlibinstall directory, as in Tidy up installation-directory/lib/ocaml #1569. For example, the prefixedocamlcommonlibrary files are installed in+ocamlcommon.Odds and ends
ocamlmiddleend(currently used only for linkingocamlobjinfo) to a first-class member ofcompiler-libs?Related projects
@diml @dbuenzli