1. 16 6月, 2013 30 次提交
    • B
      auto merge of #7137 : erickt/rust/from-elem-fixme, r=thestinger · d1927d29
      bors 提交于
      This is to make sure we track optimizing `vec::from_elem`.
      d1927d29
    • B
      auto merge of #7123 : huonw/rust/more-str, r=thestinger · f74e1935
      bors 提交于
      Moves all the remaining functions that could reasonably be methods to be methods, except for some FFI ones (which I believe @erickt is working on, possibly) and `each_split_within`, since I'm not really sure the details of it (I believe @kimundi wrote the current implementation, so maybe he could convert it to an external iterator method on `StrSlice`, e.g. `word_wrap_iter(&self) -> WordWrapIterator<'self>`, where `WordWrapIterator` impls `Iterator<&'self str>`. It probably won't be too hard, since it's already a state machine.)
      
      This also cleans up the comparison impls for the string types, except I'm not sure how the lang items `eq_str` and `eq_str_uniq` need to be handled, so they (`eq_slice` and `eq`) remain stand-alone functions.
      f74e1935
    • B
      auto merge of #7149 : thestinger/rust/vec, r=graydon · 8482d29d
      bors 提交于
      8482d29d
    • D
      fix benchmark and the tutorials · 7f00ab3d
      Daniel Micay 提交于
      7f00ab3d
    • B
      auto merge of #7162 : thestinger/rust/iterator, r=brson · 5572023c
      bors 提交于
      5572023c
    • B
      auto merge of #7114 : pnkfelix/rust/issue3961-fix-whitespace-detection, r=brson · b9119edc
      bors 提交于
      r?  (yes, the review request is back, now that I got it building against incom... I mean master!)
      
      (Attempting to port from orphaned pull-request #6764 )
      
      Fix for #3961. Also includes a test case to illustrate the issues. (All of the entries that say "should align" should align with each other, and the four lines near the end that say "compare _" for _ in {A,B,C,D} should line up with each other.)
      
      Before applying this change set:
      -- the "(should align)"'s are all over the place, and the form/line feeding spaces are not cut out as one might or might not expect.
      -- compare B and D do not match A and C.
      
      (To be honest, its hard to really say what the right behavior is here, and people who are expecting a particular behavior out of a pretty printer in these cases may well get burned.)
      b9119edc
    • H
      remove unused imports · bbcff95a
      Huon Wilson 提交于
      bbcff95a
    • D
      old_iter: rm the min/max free functions · 845465ee
      Daniel Micay 提交于
      845465ee
    • D
      fix test · 52a38b80
      Daniel Micay 提交于
      52a38b80
    • D
      rm CopyableOrderedIter · e097d5ea
      Daniel Micay 提交于
      replaced with OrdIterator
      e097d5ea
    • D
      rm vec::uniq_len · 6c547e42
      Daniel Micay 提交于
      6c547e42
    • H
      std: allow any sort of string to be Added with +. · 30973ccb
      Huon Wilson 提交于
      30973ccb
    • H
    • H
      std: continue improving the comparison trait impls for str. · 4686ed1a
      Huon Wilson 提交于
      This moves them all into the traits submodule, and delegates Ord
      to the TotalOrd instance. It also deletes the stand-alone lt, gt,
      ge and le functions.
      4686ed1a
    • H
    • H
      std: convert str::to_utf16 to a method. · f1886680
      Huon Wilson 提交于
      f1886680
    • H
      std: convert str::{map,levdistance,subslice_offset} to methods. · 4b18fff2
      Huon Wilson 提交于
      The first two become map_chars and lev_distance. Also, remove a few
      allocations in rustdoc.
      4b18fff2
    • B
      auto merge of #7132 : thestinger/rust/rpath, r=brson · c989b791
      bors 提交于
      This is a bad default, because the binaries will point at an absolute
      path regardless of where they are moved. This opens up a security issue
      for packages, because they will attempt to load libraries from a path
      that's often owned by a regular user.
      
      Every Rust binary is currently flagged by Debian, Fedora and Arch lint
      checkers as having dangerous rpaths. They don't meet the requirements to
      be placed in the repositories without manually stripping this from each
      binary.
      
      The relative rpath is still enough to keep the binaries working until
      they are moved relative to the crates they're linked against.
      
      http://wiki.debian.org/RpathIssue
      https://fedoraproject.org/wiki/Packaging:Guidelines#Beware_of_Rpath
      c989b791
    • D
      stop using an absolute rpath · 708395d6
      Daniel Micay 提交于
      This is a bad default, because the binaries will point at an absolute
      path regardless of where they are moved. This opens up a security issue
      for packages, because they will attempt to load libraries from a path
      that's often owned by a regular user.
      
      Every Rust binary is currently flagged by Debian, Fedora and Arch lint
      checkers as having dangerous rpaths. They don't meet the requirements to
      be placed in the repositories without manually stripping this from each
      binary.
      
      The relative rpath is still enough to keep the binaries working until
      they are moved relative to the crates they're linked against.
      
      http://wiki.debian.org/RpathIssue
      https://fedoraproject.org/wiki/Packaging:Guidelines#Beware_of_Rpath
      708395d6
    • B
      auto merge of #7124 : Aatch/rust/trans-refactor-pt1, r=brson · 579c614e
      bors 提交于
      This removes all of the explicit `@mut` fields from `CrateContext`. There are still a few that are managed, but no longer do we have `@mut bool` in the structure.
      
      Most of the changes are changing `@CrateContext` to `@mut CrateContext`, though I did change as many as I could get away with to `&CrateContext` and `&mut CrateContext`. The biggest thing preventing me from changing to `&[mut]` in most places was the instruction counter thing. In two cases, where I got a static borrow error and a dynamic borrow error, I opted to remove the count call there as it was literally the only thing preventing me from switching to `&mut CrateContext` parameters in both cases.
      
      Other things to note:
      
      * the EncoderContext uses borrowed pointers with lifetimes, since it can, though that required me to work around the limitation of not being able to move a structure with borrowed pointers into a heap closure. I changed as much as I could to stack closures, but unfortunately I hit the AST visitor and changing that is somewhat outside the scope of this PR. Instead (and there is a comment to this effect) I choose to unsafely get the structure into the heap, this is because I know the lifetimes involved are safe, even though the compiler can't prove it.
      
      * Many of the changes are workarounds because of the borrow checker, either dynamically freezing it for too long, or inferring too large a scope. This is mostly just from nested function calls where each borrow is considered to last for the entire statement. Other cases are where `CrateContext` was borrowed in a `match` causing it to be borrowed for the entire length of the match, even though that wasn't wanted (or needed).
      
      * I haven't yet tested to see if this changes compilation times in any way. I doubt there will be much of an impact however, as the only major improvements are less indirection and fewer refcount bumps.
      
      * This lays the foundations to remove many more heap allocations in trans as many cases can be changed to use lifetimes instead.
      
      =====
      
      This change includes some other, minor refactorings, as I am planning a series, however I don't want to submit them all at once as it will be hell to continually rebase.
      579c614e
    • D
      iterator: work around method resolve bug · 79cd2dbe
      Daniel Micay 提交于
      79cd2dbe
    • D
      iterator: add a `position` adaptor · 2df66a84
      Daniel Micay 提交于
      2df66a84
    • D
      iterator: add a `find` adaptor · eb5ac84c
      Daniel Micay 提交于
      eb5ac84c
    • J
      Fix Merge Fallout · f2a7fc69
      James Miller 提交于
      f2a7fc69
    • J
      Remove @-fields from CrateContext · cc908b77
      James Miller 提交于
      Remove all the explicit @mut-fields from CrateContext, though many
      fields are still @-ptrs.
      This required changing every single function call that explicitly
      took a @CrateContext, so I took advantage and changed as many as I
      could get away with to &-ptrs or &mut ptrs.
      cc908b77
    • J
      Make CrateContext::new() fn. · 01e098aa
      James Miller 提交于
      Move construction of a CrateContext into a static method on
      CrateContext.
      01e098aa
    • J
      Move CrateContext into it's own file · b1f39ce4
      James Miller 提交于
      b1f39ce4
    • J
      Move trans mod items into trans/mod.rs · 98b1c9e2
      James Miller 提交于
      98b1c9e2
    • B
      auto merge of #7154 : dotdash/rust/glue, r=graydon · 998e41a1
      bors 提交于
      Currently, when calling glue functions, we cast the function to match
      the argument type. This interacts very badly with LLVM and breaks
      inlining of the glue code.
      
      It's more efficient to use a unified function type for the glue
      functions and always cast the function argument instead of the function.
      
      The resulting code for rustc is about 13% faster (measured up to and
      including the "trans" pass) and the resulting librustc is about 5%
      smaller.
      998e41a1
    • B
      Fix inlining of glue code · a08d768c
      Björn Steinbrink 提交于
      Currently, when calling glue functions, we cast the function to match
      the argument type. This interacts very badly with LLVM and breaks
      inlining of the glue code.
      
      It's more efficient to use a unified function type for the glue
      functions and always cast the function argument instead of the function.
      
      The resulting code for rustc is about 13% faster (measured up to and
      including the "trans" pass) and the resulting librustc is about 5%
      smaller.
      a08d768c
  2. 15 6月, 2013 10 次提交
    • B
      auto merge of #7148 : catamorphism/rust/rustpkg_tests, r=graydon · eac0200f
      bors 提交于
      r? @graydon Automate more tests described in the commands.txt file,
      and add infrastructure for running them. Right now, tests shell
      out to call rustpkg. This is not ideal.
      
      Goes part of the way towards addressing #5683
      eac0200f
    • B
      auto merge of #7147 : huonw/rust/vec-connect, r=Aatch · 82f2e4dc
      bors 提交于
      This is caused by StrVector having a generic implementation for &[S]
      and so #5898 means that method resolution of ~[~[1]].concat() sees that
      both StrVector and VectorVector have methods that (superficially) match.
      
      They are now connect_vec and concat_vec, which means that they can actually be
      called.
      82f2e4dc
    • B
      auto merge of #7130 : huonw/rust/rustdoc-highlight, r=thestinger · ac6f1541
      bors 提交于
      This means that type definitions and function signatures have
      pretty colours.
      ac6f1541
    • B
      auto merge of #7109 : bblum/rust/rwlocks, r=brson · 6df66c19
      bors 提交于
      r? @brson
      
      links to issues: #7065 the race that's fixed; #7066 the perf improvement I added. There are also some minor cleanup commits here.
      
      To measure the performance improvement from replacing the exclusive with an atomic uint, I edited the ```msgsend-ring-rw-arcs``` bench test to do a ```write_downgrade``` instead of just a ```write```, so that it stressed the code paths that accessed ```read_count```. (At first I was still using ```write``` and saw no performance difference whatsoever, whoooops.)
      
      The bench test measures how long it takes to send 1,000,000 messages by using rwarcs to emulate pipes. I also measured the performance difference imposed by the fix to the ```access_lock``` race (which involves taking an extra semaphore in the ```cond.wait()``` path). The net result is that fixing the race imposes a 4% to 5% slowdown, but doing the atomic uint optimization gives a 6% to 8% speedup.
      
      Note that this speedup will be most visible in read- or downgrade-heavy workloads. If an RWARC's only users are writers, the optimization doesn't matter. All the same, I think this more than justifies the extra complexity I mentioned in #7066.
      
      The raw numbers are:
      ```
      with xadd read count
              before write_cond fix
                      4.18 to 4.26 us/message
              with write_cond fix
                      4.35 to 4.39 us/message
                      
      with exclusive read count
              before write_cond fix
                      4.41 to 4.47 us/message
              with write_cond fix
                      4.65 to 4.76 us/message
      ```
      6df66c19
    • B
      auto merge of #7133 : kballard/rust/terminfo-parm, r=thestinger · da42e6b7
      bors 提交于
      Implement conditional support in terminfo, along with a few other related operators.
      
      Fix implementation of non-commutative arithmetic operators.
      
      Remove all known cases of task failure from `terminfo::parm::expand`, and change the method signature.
      
      Fix some other miscellaneous issues.
      da42e6b7
    • B
      auto merge of #7125 : alexcrichton/rust/rusti-issues, r=brson · 83d44f87
      bors 提交于
      This un-reverts the reverts of the rusti commits made awhile back. These were reverted for an LLVM failure in rustpkg. I believe that this is not a problem with these commits, but rather that rustc is being used in parallel for rustpkg tests (in-process). This is not working yet (almost! see #7011), so I serialized all the tests to run one after another.
      
      @brson, I'm mainly just guessing as to the cause of the LLVM failures in rustpkg tests. I'm confident that running tests in parallel is more likely to be the problem than those commits I made.
      
      Additionally, this fixes two recently reported issues with rusti.
      83d44f87
    • B
      auto merge of #7122 : thestinger/rust/std, r=luqmana · 7d1065e9
      bors 提交于
      7d1065e9
    • T
      rustpkg: Write more automated tests · e3c4104d
      Tim Chevalier 提交于
      Automate more tests described in the commands.txt file,
      and add infrastructure for running them. Right now, tests shell
      out to call rustpkg. This is not ideal.
      e3c4104d
    • T
      rustc: Don't continue to resolve if there's an error in lang_items · 1adbb452
      Tim Chevalier 提交于
      This confused me when it happened.
      1adbb452
    • B
      auto merge of #7121 : huonw/rust/rand-call, r=pnkfelix · c83bcedd
      bors 提交于
      r? @pnkfelix
      c83bcedd