Move some middle-end files around#2281
Conversation
82734a9 to
3237355
Compare
|
@chambart @lthls I've pushed a new version of this, extending the scope slightly to cover moving the I believe I have now fixed up the |
chambart
left a comment
There was a problem hiding this comment.
I can't comment on the dune part but I think this is good to go as soon as the CI is happy.
| emit.mlp files for certain other targets; the reference here ensures | ||
| that when releases are being prepared the .depend files are correct | ||
| for all targets. *) | ||
| [@@@ocaml.warning "-66"] |
There was a problem hiding this comment.
It appears to be required with the dune build, because I think it sets different warning levels. (I also think it is unfortunate that open! is falling foul of warning 66.)
lthls
left a comment
There was a problem hiding this comment.
The code changes look good, I didn't look into the build system changes in too much depth but if CI passes, it should be fine.
Makefile
Outdated
| middle_end/base_types asmcomp/debug driver toplevel; \ | ||
| lambda file_formats middle_end/closure middle_end/flambda \ | ||
| middle_end/flambda/base_types asmcomp/debug \ | ||
| driver toplevel; \ |
db3bd9d to
1a78171
Compare
|
If CI passes, this is now ready to merge. Please be aware that as a result of source files having been moved, stale build artifacts may be left in trees after this PR is merged. I recommend using " |
1a78171 to
6a4132f
Compare
|
I've rebased this, so let's try again. I have had to disable the |
6a4132f to
f113d09
Compare
This file is no longer generated since ocaml#2281, and keeping an old one makes make -C utils config.ml make[1] : on entre dans le répertoire « /home/jjourdan/Travail/soft/ocaml/utils » sed -e 's!%%AFL_INSTRUMENT%%!false!' \ -e 's!%%ARCH%%!amd64!' \ -e 's!%%ARCMD%%!ar!' \ -e 's!%%ASM%%!as!' \ -e 's!%%ASM_CFI_SUPPORTED%%!true!' \ -e 's!%%BYTECCLIBS%%!-lm -ldl -lpthread !' \ -e 's!%%CC%%!gcc!' \ -e 's!%%CCOMPTYPE%%!cc!' \ -e 's!%%OUTPUTOBJ%%!-o !' \ -e 's!%%EXT_ASM%%!.s!' \ -e 's!%%EXT_DLL%%!.so!' \ -e 's!%%EXE%%!!' \ -e 's!%%EXT_LIB%%!.a!' \ -e 's!%%EXT_OBJ%%!.o!' \ -e 's!%%FLAMBDA%%!false!' \ -e 's!%%WITH_FLAMBDA_INVARIANTS%%!false!' \ -e 's!%%FLEXLINK_FLAGS%%!!' \ -e 's!%%FLEXDLL_DIR%%!!' \ -e 's!%%HOST%%!x86_64-pc-linux-gnu!' \ -e 's!%%LIBDIR%%!/usr/local/lib/ocaml!' \ -e 's!%%LIBUNWIND_AVAILABLE%%!false!' \ -e 's!%%LIBUNWIND_LINK_FLAGS%%!!' \ -e 's!%%MKDLL%%!gcc -shared!' \ -e 's!%%MKEXE%%!gcc -O2 -fno-strict-aliasing -fwrapv -Wall -Werror -fno-tree-vrp -ffunction-sections -D_FILE_OFFSET_BITS=64 -D_REENTRANT -DCAML_NAME_SPACE -Wl,-E!' \ -e 's!%%FLEXLINK_LDFLAGS%%! -link \\"-Wl,-E\\"!' \ -e 's!%%MKMAINDLL%%!gcc -shared!' \ -e 's!%%MODEL%%!default!' \ -e 's!%%NATIVECCLIBS%%!-lm -ldl !' \ -e 's!%%OCAMLC_CFLAGS%%!-O2 -fno-strict-aliasing -fwrapv -fPIC!' \ -e 's!%%OCAMLC_CPPFLAGS%%!-D_FILE_OFFSET_BITS=64 -D_REENTRANT!' \ -e 's!%%OCAMLOPT_CFLAGS%%!-O2 -fno-strict-aliasing -fwrapv!' \ -e 's!%%OCAMLOPT_CPPFLAGS%%!-D_FILE_OFFSET_BITS=64 -D_REENTRANT!' \ -e 's!%%PACKLD%%!ld -r -o !' \ -e 's!%%PROFINFO_WIDTH%%!0!' \ -e 's!%%RANLIBCMD%%!ranlib!' \ -e 's!%%FORCE_SAFE_STRING%%!false!' \ -e 's!%%DEFAULT_SAFE_STRING%%!true!' \ -e 's!%%WINDOWS_UNICODE%%!0!' \ -e 's!%%SUPPORTS_SHARED_LIBRARIES%%!true!' \ -e 's!%%SYSTEM%%!linux!' \ -e 's!%%SYSTHREAD_SUPPORT%%!true!' \ -e 's!%%TARGET%%!x86_64-pc-linux-gnu!' \ -e 's!%%WITH_FRAME_POINTERS%%!false!' \ -e 's!%%WITH_PROFINFO%%!false!' \ -e 's!%%WITH_SPACETIME%%!false!' \ -e 's!%%ENABLE_CALL_COUNTS%%!true!' \ -e 's!%%FLAT_FLOAT_ARRAY%%!true!' \ -e 's!%%FUNCTION_SECTIONS%%!true!' \ -e 's!%%CC_HAS_DEBUG_PREFIX_MAP%%!true!' \ -e 's!%%AS_HAS_DEBUG_PREFIX_MAP%%!true!' \ config.mlp > config.ml make[1] : on quitte le répertoire « /home/jjourdan/Travail/soft/ocaml/utils » ./boot/ocamlrun boot/ocamllex -q parsing/lexer.mll produce an invalid file. No change entry needed
This file is no longer generated since ocaml#2281, and keeping an old one makes `make depend` produce an invalid file. No change entry needed
This file is no longer generated since #2281, and keeping an old one makes `make depend` produce an invalid file. No change entry needed
The issue ocaml#9050 comes (partly) from ocaml#2281 forgetting to add the compilerlibs/ocamlmiddleend archives in the installation target. The present patch should solve this issue once and for all, by using a wildcard to install all archives that have been built in compilerlibs/, instead of using a manual listing. Compared to trunk, the following extra files are installed in $(LIBDIR)/compilerlibs: ocamlmiddleend.{a,cma,cmxa}. There are no other changes in the installed-files list.
The issue ocaml#9050 comes (partly) from ocaml#2281 forgetting to add the compilerlibs/ocamlmiddleend archives in the installation target. The present patch should solve this issue once and for all, by using a wildcard to install all archives that have been built in compilerlibs/, instead of using a manual listing. Compared to trunk, the following extra files are installed in $(LIBDIR)/compilerlibs: ocamlmiddleend.{a,cma,cmxa}. There are no other changes in the installed-files list.
This pull request contains very little code and is mostly formed of moves tracked by git.
This work has its roots in the gdb support. In that work, having spent a very long time struggling with various problems relating to object file symbols and references thereto, I decided to write patches to change the representation of symbols throughout the compiler. This enables tracking of certain extra information which can be used to check, in the backend, that we are not going outside the envelope of expressions involving symbols that we know to be correctly assembled and resolved across all architectures.
I extracted these symbol-related changes recently with a view to submitting them separately. However it then became clear that due to the complexity of existing code that handles symbols, other refactoring was going to be required first, to provide a coherent story. The main area of attention was the boundary between the middle end and backend, around
Compilenv, where there is currently a lot of complexity and code that is hard to understand. I think the integration of Flambda made matters significantly worse here; we should have been more careful (guilty).The ultimate aim of this patch is to decouple the middle end from the backend. By doing this, we can provide a clean interface, and separate "middle end" types (for example for variables and symbols) from "backend" types. We can then stop passes such as
Cmmgenfrom reaching back into the middle end (the principle from #2280). We share types as appropriate between the Closure and Flambda middle ends; and move code specific to only one of these middle ends into separate files (some of this happens in a subsequent patch). We also remove the necessity to cherry-pick object files from the backend when linking executables such asocamlobjinfo; the middle-end library will now suffice. A newfile_formats/directory is provided to collect together all of the files representing the formats of compilation artifacts; this seemed on balance like the best approach, given the other possibilities for places for such files to live.We don't get all the way to the ultimate goal with this GPR alone. A subsequent smaller one, which moves some middle-end code from
Asmgeninto themiddle_end/directory, and the patch that provides a middle-end-only replacement forCompilenvand changes the symbol types are required for that. However this is the first step along the road.@chambart Could you please look at this?