]> git.lizzy.rs Git - rust.git/commit
auto merge of #7495 : thestinger/rust/exchange, r=cmr
authorbors <bors@rust-lang.org>
Sun, 30 Jun 2013 22:02:05 +0000 (15:02 -0700)
committerbors <bors@rust-lang.org>
Sun, 30 Jun 2013 22:02:05 +0000 (15:02 -0700)
commit040ac2a93270b4420c59621521d554a078e2d451
tree16dc8d87d4352a8e695949c906af4e5e55f2f47d
parentca835f482cebcd353db789e45f9cec72db1a24ed
parent4a29d6eb3f20c2b7a05bb9c9c2f964da606e39ca
auto merge of #7495 : thestinger/rust/exchange, r=cmr

With these changes, exchange allocator headers are never initialized, read or written to. Removing the header will now just involve updating the code in trans using an offset to only do it if the type contained is managed.

The only thing blocking removing the initialization of the last field in the header was ~fn since it uses it to store the dynamic size/types due to captures. I temporarily switched it to a `closure_exchange_alloc` lang item (it uses the same `exchange_free`) and #7496 is filed about removing that.

Since the `exchange_free` call is now inlined all over the codebase, I don't think we should have an assert for null. It doesn't currently ever happen, but it would be fine if we started generating code that did do it. The `exchange_free` function also had a comment declaring that it must not fail, but a regular assert would cause a failure. I also removed the atomic counter because valgrind can already find these leaks, and we have valgrind bots now.

Note that exchange free does not currently print an error an out-of-memory when it aborts, because our `io` code may allocate. We could probably get away with a `#[rust_stack]` call to a `stdio` function but it would be better to make a write system call.
src/librustc/middle/lang_items.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/closure.rs
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/foreign.rs
src/librustc/middle/trans/tvec.rs
src/librustc/middle/trans/type_use.rs
src/librustc/middle/typeck/check/mod.rs
src/libstd/vec.rs