[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Pack considered harmful (was: Fwd: Cross-module inlining fails)
You'll be amused to hear that one of the reasons for the performance drop after moving to OPAM is because of a small bug in OASIS. When you use packed modules, the .cmx file of the packed result is not installed. This has the knock on effect of disabling cross-module inlining, and leading to several core Mirage libraries (such as the OS and Net modules) not being inlined. The fix is pretty easy (install the cmx!), so I'll make the appropriate modifications shortly. Life was so much easier in the monolithic tree :-) -anil Begin forwarded message: > From: Markus Mottl <markus.mottl@xxxxxxxxx> > Subject: Re: Cross-module inlining fails > Date: 19 November 2012 18:16:55 GMT > To: ocaml-core@xxxxxxxxxxxxxxxx > Cc: oasis-devel@xxxxxxxxxxxxxxxxxxxxxxxxx > Reply-To: ocaml-core@xxxxxxxxxxxxxxxx > > On Mon, Nov 19, 2012 at 1:00 PM, Sylvain Le Gall <sylvain@xxxxxxxxxxx> wrote: >> Well, .cmx file should be installed EXCEPT if you are using packed >> modules... > > The .cmx files of _submodules_ should not be installed for packed > libraries, this is correct, but the (single) .cmx file resulting from > packing should be installed for packed libraries. > >> The culprit is: >> (not lib.lib_pack) && (* Do not install .cmx packed submodules *) >> in src/oasis/OASISLibrary.ml > > This is the location of the likely bug. My modification to setup.ml > below is completely untested and may not even compile, but the idea is > probably right: > > (* The .cmx that be compiled along *) > let cmxs = > let should_be_built = > match bs.bs_compiled_object with > | Native -> true > | Best -> is_native > | Byte -> false > in > if should_be_built then > if lib.lib_pack then [ cs.cs_name ^ ".cmx" ] > else > find_modules > (lib.lib_modules @ lib.lib_internal_modules) > "cmx" > else > [] > in > >> You can experiment installing .cmx by commenting this line. But I am really >> not sure this will help that much. I thought that .cmxs was a pack of .cmx >> so that inlining can work using what is inside this archive (contrary to >> .cmxa). >> >> Maybe the inlining using .cmxs doesn't work as excepted ? > > .cmxs files are used for dynamic linking and are hence the "dynamic > brother" of .cmxa files. Cross-module inlining, however, is done > during compilation, not linking. It can only be done if the ".cmx" > files of modules referenced from the currently compiled file are > visible. .cmxa and .cmxs files are completely ignored during > compilation. > > Regards, > Markus > > -- > Markus Mottl http://www.ocaml.info markus.mottl@xxxxxxxxx >
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |