rust/src
Björn Steinbrink 92d1f155da Emit LLVM lifetime intrinsics to improve stack usage and codegen in general
Lifetime intrinsics help to reduce stack usage, because LLVM can apply
stack coloring to reuse the stack slots of dead allocas for new ones.

For example these functions now both use the same amount of stack, while
previous `bar()` used five times as much as `foo()`:

````rust
fn foo() {
  println("{}", 5);
}

fn bar() {
  println("{}", 5);
  println("{}", 5);
  println("{}", 5);
  println("{}", 5);
  println("{}", 5);
}
````

On top of that, LLVM can also optimize out certain operations when it
knows that memory is dead after a certain point. For example, it can
sometimes remove the zeroing used to cancel the drop glue. This is
possible when the glue drop itself was already removed because the
zeroing dominated the drop glue call. For example in:

````rust
pub fn bar(x: (Box<int>, int)) -> (Box<int>, int) {
    x
}
````

With optimizations, this currently results in:

````llvm
define void @_ZN3bar20h330fa42547df8179niaE({ i64*, i64 }* noalias nocapture nonnull sret, { i64*, i64 }* noalias nocapture nonnull) unnamed_addr #0 {
"_ZN29_$LP$Box$LT$int$GT$$C$int$RP$39glue_drop.$x22glue_drop$x22$LP$1347$RP$17h88cf42702e5a322aE.exit":
  %2 = bitcast { i64*, i64 }* %1 to i8*
  %3 = bitcast { i64*, i64 }* %0 to i8*
  tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 16, i32 8, i1 false)
  tail call void @llvm.memset.p0i8.i64(i8* %2, i8 0, i64 16, i32 8, i1 false)
  ret void
}
````

But with lifetime intrinsics we get:

````llvm
define void @_ZN3bar20h330fa42547df8179niaE({ i64*, i64 }* noalias nocapture nonnull sret, { i64*, i64 }* noalias nocapture nonnull) unnamed_addr #0 {
"_ZN29_$LP$Box$LT$int$GT$$C$int$RP$39glue_drop.$x22glue_drop$x22$LP$1347$RP$17h88cf42702e5a322aE.exit":
  %2 = bitcast { i64*, i64 }* %1 to i8*
  %3 = bitcast { i64*, i64 }* %0 to i8*
  tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %3, i8* %2, i64 16, i32 8, i1 false)
  tail call void @llvm.lifetime.end(i64 16, i8* %2)
  ret void
}
````

Fixes #15665
2014-07-22 09:17:41 +02:00
..
compiler-rt@62a4ca6055
compiletest
doc auto merge of #15803 : omp/rust/master, r=alexcrichton 2014-07-20 14:21:32 +00:00
driver
etc
gyp@1e46da1000
jemalloc@024c67ad65
liballoc alloc: Stabilize rc module. 2014-07-18 18:34:38 -07:00
libarena
libbacktrace
libcollections auto merge of #15806 : treeman/rust/std-doc, r=alexcrichton 2014-07-20 17:46:32 +00:00
libcore auto merge of #15806 : treeman/rust/std-doc, r=alexcrichton 2014-07-20 17:46:32 +00:00
libcoretest
libdebug
libflate
libfmt_macros
libfourcc
libgetopts
libglob
libgraphviz librustc: Implement lifetime elision. 2014-07-19 13:10:58 -07:00
libgreen librustc: Implement lifetime elision. 2014-07-19 13:10:58 -07:00
libhexfloat
liblibc
liblog
libnative
libnum
librand
libregex
libregex_macros
librlibc
librustc Emit LLVM lifetime intrinsics to improve stack usage and codegen in general 2014-07-22 09:17:41 +02:00
librustc_back Register new snapshots 2014-07-19 20:38:00 -07:00
librustc_llvm Register new snapshots 2014-07-19 20:38:00 -07:00
librustdoc Implement new mod import sugar 2014-07-20 12:40:08 +02:00
librustrt librustc: Implement lifetime elision. 2014-07-19 13:10:58 -07:00
librustuv librustc: Implement lifetime elision. 2014-07-19 13:10:58 -07:00
libsemver
libserialize Ignore one test. 2014-07-18 11:58:45 -07:00
libstd auto merge of #15797 : brson/rust/taskstab, r=alexcrichton 2014-07-20 12:01:31 +00:00
libsync
libsyntax auto merge of #15808 : jakub-/rust/use-mod, r=alexcrichton 2014-07-20 21:06:32 +00:00
libterm
libtest
libtime
libunicode Register new snapshots 2014-07-19 20:38:00 -07:00
liburl
libuuid
libuv@43495892de
llvm@1bba09755d
rt
rustllvm
test auto merge of #15808 : jakub-/rust/use-mod, r=alexcrichton 2014-07-20 21:06:32 +00:00
README.md
snapshots.txt Register new snapshots 2014-07-19 20:38:00 -07:00

This is a preliminary version of the Rust compiler, libraries and tools.

Source layout:

Path Description
librustc/ The self-hosted compiler
liballoc/ Rust's core allocation library
libcore/ The Rust core library
libdebug/ Debugging utilities
libstd/ The standard library (imported and linked by default)
libgreen/ The M:N runtime library
libnative/ The 1:1 runtime library
libsyntax/ The Rust parser and pretty-printer
libtest/ Rust's test-runner code
------------------- ---------------------------------------------------------
libarena/ The arena (a fast but limited) memory allocator
libbacktrace/ The libbacktrace library
libcollections/ A collection of useful data structures and containers
libflate/ Simple compression library
libfmt_macros/ Macro support for format strings
libfourcc/ Data format identifier library
libgetopts/ Get command-line-options library
libglob/ Unix glob patterns library
libgraphviz/ Generating files for Graphviz
libhexfloat/ Hexadecimal floating-point literals
liblibc/ Bindings for the C standard library
liblog/ Utilities for program-wide and customizable logging
libnum/ Extended number support library (complex, rational, etc)
librand/ Random numbers and distributions
libregex/ Regular expressions
libregex_macros/ The regex! syntax extension
libsemver/ Rust's semantic versioning library
libserialize/ Encode-Decode types library
libsync/ Concurrency mechanisms and primitives
libterm/ ANSI color library for terminals
libtime/ Time operations library
liburl/ URL handling lirary
libuuid/ UUID's handling code
------------------- ---------------------------------------------------------
rt/ The runtime system
rt/rust_*.c - Some of the runtime services
rt/vg - Valgrind headers
rt/msvc - MSVC support
rt/sundown - The Markdown library used by rustdoc
------------------- ---------------------------------------------------------
compiletest/ The test runner
test/ Testsuite
test/codegen - Tests for the LLVM IR infrastructure
test/compile-fail - Tests that should fail to compile
test/debug-info - Tests for the debuginfo tool
test/run-fail - Tests that should compile, run and fail
test/run-make - Tests that depend on a Makefile infrastructure
test/run-pass - Tests that should compile, run and succeed
test/bench - Benchmarks and miscellaneous
test/pretty - Pretty-printer tests
test/auxiliary - Dependencies of tests
------------------- ---------------------------------------------------------
librustdoc/ The Rust API documentation tool
libuv/ The libuv submodule
librustuv/ Rust libuv support code
------------------- ---------------------------------------------------------
llvm/ The LLVM submodule
rustllvm/ LLVM support code
------------------- ---------------------------------------------------------
etc/ Scripts, editors support, misc

NOTE: This list (especially the second part of the table which contains modules and libraries) is highly volatile and subject to change.