diff options
| author | Björn Steinbrink <bsteinbr@gmail.com> | 2013-07-16 19:25:06 +0200 |
|---|---|---|
| committer | Björn Steinbrink <bsteinbr@gmail.com> | 2013-07-17 17:21:41 +0200 |
| commit | 15ea4a8dd8242a0ee01169872bc538c974e748c9 (patch) | |
| tree | 35c668c1895e506808af19b2d3c68526026cdd78 /src/rt/rust_kernel.cpp | |
| parent | 3e572511af26f5b469cbfded83069ca215c74740 (diff) | |
| download | rust-15ea4a8dd8242a0ee01169872bc538c974e748c9.tar.gz rust-15ea4a8dd8242a0ee01169872bc538c974e748c9.zip | |
Generate better code for intrinsics
Currently, our intrinsics are generated as functions that have the usual setup, which means an alloca, and therefore also a jump, for those intrinsics that return an immediate value. This is especially bad for unoptimized builds because it means that an intrinsic like "contains_managed" that should be just "ret 0" or "ret 1" actually ends up allocating stack space, doing a jump and a store/load sequence before it finally returns the value. To fix that, we need a way to stop the generic function declaration mechanism from allocating stack space for the return value. This implicitly also kills the jump, because the block for static allocas isn't required anymore. Additionally, trans_intrinsic needs to build the return itself instead of calling finish_fn, because the latter relies on the availability of the return value pointer. With these changes, we get the bare minimum code required for our intrinsics, which makes them small enough that inlining them makes the resulting code smaller, so we can mark them as "always inline" to get better performing unoptimized builds. Optimized builds also benefit slightly from this change as there's less code for LLVM to translate and the smaller intrinsics help it to make better inlining decisions for a few code paths. Building stage2 librustc gets ~1% faster for the optimized version and 5% for the unoptimized version.
Diffstat (limited to 'src/rt/rust_kernel.cpp')
0 files changed, 0 insertions, 0 deletions
