Commit Graph

109 Commits

Author SHA1 Message Date
Patrick Walton
d3fc7b9918 librustc: De-@mut the translation stats 2013-12-26 15:54:36 -08:00
Patrick Walton
9f6706975b librustc: De-@mut fn_stats in the stats 2013-12-26 15:54:36 -08:00
Patrick Walton
e84f79feb1 librustc: De-@mut llvm_insns in the stats 2013-12-26 15:54:35 -08:00
Patrick Walton
8c3a552ac5 librustc: Remove the unused llvm_insn_ctxt from the stats 2013-12-26 15:54:35 -08:00
Patrick Walton
97ceac7377 librustc: De-@mut n_llvm_insns in the stats 2013-12-26 15:54:35 -08:00
Patrick Walton
21e4e410a9 librustc: De-@mut n_closures in the stats 2013-12-26 15:54:35 -08:00
Patrick Walton
c010d08cd5 librustc: De-@mut n_inlines in the stats 2013-12-26 15:54:35 -08:00
Patrick Walton
8c7804ffac librustc: De-@mut n_monos in the stats 2013-12-26 15:54:35 -08:00
Patrick Walton
38572f4981 librustc: De-@mut n_fns in the stats 2013-12-26 15:54:35 -08:00
Patrick Walton
16828bb1dc librustc: De-@mut n_real_glues 2013-12-26 15:54:35 -08:00
Patrick Walton
75efa0725d librustc: De-@mut n_null_glues in the stats 2013-12-26 15:54:35 -08:00
Patrick Walton
26d1394767 librustc: De-@mut n_glues_created in the stats 2013-12-26 15:54:35 -08:00
Patrick Walton
091bfa9cc3 librustc: De-@mut n_static_tydescs in the stats 2013-12-26 15:54:35 -08:00
Patrick Walton
07279011b8 librustc: De-@mut the type descriptor info 2013-12-26 15:54:32 -08:00
Patrick Walton
fbb70d916f librustc: De-@mut the reachable map 2013-12-26 15:54:29 -08:00
Patrick Walton
b941677ea3 librustc: De-@mut the crate context 2013-12-26 13:01:26 -08:00
Patrick Walton
2418cc0212 librustc: De-@mut the crate context's do_not_commit_warning_issued 2013-12-26 13:01:26 -08:00
Patrick Walton
61768de5e9 librustc: De-&mut TypeNames 2013-12-26 13:01:26 -08:00
Patrick Walton
303a39477b librustc: De-@mut CrateContext::symbol_hasher. 2013-12-26 13:01:25 -08:00
Patrick Walton
fc92f92572 librustc: De-@mut CrateContext::finished_tydescs. 2013-12-26 13:01:25 -08:00
Patrick Walton
462a791c34 librustc: De-@mut the external and external_srcs fields of
`CrateContext`
2013-12-26 13:01:25 -08:00
Patrick Walton
1e654f5ff7 librustc: De-@mut CrateContext::externs 2013-12-26 13:01:25 -08:00
Patrick Walton
519db34722 librustc: De-@mut CrateContext::tydescs 2013-12-26 13:01:24 -08:00
Patrick Walton
b5aa6eb69f librustc: De-@mut CrateContext::non_inlineable_statics 2013-12-26 13:01:24 -08:00
Patrick Walton
02bdda2776 librustc: De-@mut CrateContext::all_llvm_symbols 2013-12-26 13:01:24 -08:00
Patrick Walton
b895ba52bc librustc: Remove unused CrateContext::type_short_names 2013-12-26 13:01:24 -08:00
Patrick Walton
25337a7f9f librustc: De-@mut CrateContext::type_hashcodes 2013-12-26 13:01:24 -08:00
Patrick Walton
a1747a6091 librustc: De-@mut CrateContext::adt_reprs 2013-12-26 13:01:24 -08:00
Patrick Walton
db83a957b6 librustc: De-@mut CrateContext::llsizingtypes 2013-12-26 13:01:24 -08:00
Patrick Walton
06805209e4 librustc: De-@mut lltypes. 2013-12-26 13:01:24 -08:00
Patrick Walton
8c194a0136 librustc: De-@mut CrateContext::module_data 2013-12-26 13:01:24 -08:00
Patrick Walton
1185fcc437 librustc: De-@mut the impl_method_cache 2013-12-26 13:01:24 -08:00
Patrick Walton
37e3f2fe63 librustc: De-@mut CrateContext::extern_const_values 2013-12-26 13:01:24 -08:00
Patrick Walton
d16cca1f50 librustc: De-@mut const_values. 2013-12-26 13:01:23 -08:00
Patrick Walton
28943e96cb librustc: De-@mut RefCell::const_globals. 2013-12-26 13:01:23 -08:00
Patrick Walton
0e2041c54b librustc: De-@mut CrateContext::const_cstr_cache. 2013-12-26 13:01:23 -08:00
Patrick Walton
13f85cb097 librustc: De-@mut CrateContext::vtables. 2013-12-26 13:01:23 -08:00
Patrick Walton
5dcc5165a6 librustc: Remove unused discrim_symbols field from the crate context 2013-12-26 13:01:23 -08:00
Patrick Walton
0f3e4fea4f librustc: Remove unused field enum_sizes from the crate context 2013-12-26 13:01:23 -08:00
Patrick Walton
df7f1374d7 librustc: De-@mut item_symbols 2013-12-26 13:01:23 -08:00
Patrick Walton
610096d8c8 librustc: De-@mut CrateContext::item_vals 2013-12-26 13:01:23 -08:00
Patrick Walton
d3f58c59e4 librustc: De-@mut the monomorphizing field in CrateContext 2013-12-26 13:01:23 -08:00
Patrick Walton
b5218ba6ad librustc: De-@mut monomorphized in the crate context 2013-12-26 13:01:23 -08:00
Vadim Chugunov
e3b37154b0 Stop using C++ exceptions for stack unwinding. 2013-12-24 12:13:42 -08:00
Huon Wilson
164f7a290e std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut []. 2013-12-15 23:37:41 +11:00
Jack Moffitt
b349036e5f Make crate hash stable and externally computable.
This replaces the link meta attributes with a pkgid attribute and uses a hash
of this as the crate hash. This makes the crate hash computable by things
other than the Rust compiler. It also switches the hash function ot SHA1 since
that is much more likely to be available in shell, Python, etc than SipHash.

Fixes #10188, #8523.
2013-12-10 17:04:24 -07:00
Alex Crichton
fce4a174b9 Implement LTO
This commit implements LTO for rust leveraging LLVM's passes. What this means
is:

* When compiling an rlib, in addition to insdering foo.o into the archive, also
  insert foo.bc (the LLVM bytecode) of the optimized module.

* When the compiler detects the -Z lto option, it will attempt to perform LTO on
  a staticlib or binary output. The compiler will emit an error if a dylib or
  rlib output is being generated.

* The actual act of performing LTO is as follows:

    1. Force all upstream libraries to have an rlib version available.
    2. Load the bytecode of each upstream library from the rlib.
    3. Link all this bytecode into the current LLVM module (just using llvm
       apis)
    4. Run an internalization pass which internalizes all symbols except those
       found reachable for the local crate of compilation.
    5. Run the LLVM LTO pass manager over this entire module

    6a. If assembling an archive, then add all upstream rlibs into the output
        archive. This ignores all of the object/bitcode/metadata files rust
        generated and placed inside the rlibs.
    6b. If linking a binary, create copies of all upstream rlibs, remove the
        rust-generated object-file, and then link everything as usual.

As I have explained in #10741, this process is excruciatingly slow, so this is
*not* turned on by default, and it is also why I have decided to hide it behind
a -Z flag for now. The good news is that the binary sizes are about as small as
they can be as a result of LTO, so it's definitely working.

Closes #10741
Closes #10740
2013-12-09 14:41:49 -08:00
Alex Crichton
52b835c5e7 Store metadata separately in rlib files
Right now whenever an rlib file is linked against, all of the metadata from the
rlib is pulled in to the final staticlib or binary. The reason for this is that
the metadata is currently stored in a section of the object file. Note that this
is intentional for dynamic libraries in order to distribute metadata bundled
with static libraries.

This commit alters the situation for rlib libraries to instead store the
metadata in a separate file in the archive. In doing so, when the archive is
passed to the linker, none of the metadata will get pulled into the result
executable. Furthermore, the metadata file is skipped when assembling rlibs into
an archive.

The snag in this implementation comes with multiple output formats. When
generating a dylib, the metadata needs to be in the object file, but when
generating an rlib this needs to be separate. In order to accomplish this, the
metadata variable is inserted into an entirely separate LLVM Module which is
then codegen'd into a different location (foo.metadata.o). This is then linked
into dynamic libraries and silently ignored for rlib files.

While changing how metadata is inserted into archives, I have also stopped
compressing metadata when inserted into rlib files. We have wanted to stop
compressing metadata, but the sections it creates in object file sections are
apparently too large. Thankfully if it's just an arbitrary file it doesn't
matter how large it is.

I have seen massive reductions in executable sizes, as well as staticlib output
sizes (to confirm that this is all working).
2013-12-09 08:25:58 -08:00
Patrick Walton
8ceb374ab7 librustc: Remove non-procedure uses of do from librustc, librustdoc,
and librustpkg.
2013-11-26 08:25:00 -08:00
Alex Crichton
daf5f5a4d1 Drop the '2' suffix from logging macros
Who doesn't like a massive renaming?
2013-10-22 08:09:56 -07:00