1. 14 2月, 2014 32 次提交
    • B
      2fe7bfe4
    • E
    • B
      auto merge of #12256 : brson/rust/android, r=alexcrichton · 8d6fef67
      bors 提交于
      Android bot has been having some problems. A few details in the commits.
      8d6fef67
    • B
      Stop looping on error waiting for android test results · 67841793
      Brian Anderson 提交于
      These seem to be causing iloops on the bots. Let's rather see the errors.
      67841793
    • B
      compiletest: Run all android tests serially · a06ce0c9
      Brian Anderson 提交于
      This is an attempt to isolate test failures on the bots. It may also
      eliminate problems with the emulators breaking by reducing the chance
      of OOM.
      a06ce0c9
    • B
      auto merge of #12172 : alexcrichton/rust/green-improvements, r=brson · 22c34f3c
      bors 提交于
      These commits pick off some low-hanging fruit which were slowing down spawning green threads. The major speedup comes from fixing a bug in stack caching where we never used any cached stacks!
      
      The program I used to benchmark is at the end. It was compiled with `rustc --opt-level=3 bench.rs --test` and run as `RUST_THREADS=1 ./bench --bench`. I chose to use `RUST_THREADS=1` due to #11730 as the profiles I was getting interfered too much when all the schedulers were in play (and shouldn't be after #11730 is fixed). All of the units below are in ns/iter as reported by `--bench` (lower is better).
      
      |               | green | native | raw    |
      | ------------- | ----- | ------ | ------ |
      | osx before    | 12699 | 24030  | 19734  |
      | linux before  | 10223 | 125983 | 122647 |
      | osx after     |  3847 | 25771  | 20835  |
      | linux after   |  2631 | 135398 | 122765 |
      
      Note that this is *not* a benchmark of spawning green tasks vs native tasks. I put in the native numbers just to get a ballpark of where green tasks are. This is benchmark is *clearly* benefiting from stack caching. Also, OSX is clearly not 5x faster than linux, I think my VM is just much slower.
      
      All in all, this ended up being a nice 4x speedup for spawning a green task when you're using a cached stack.
      
      ```rust
      extern mod extra;
      extern mod native;
      use std::rt::thread::Thread;
      
      #[bench]
      fn green(bh: &mut extra::test::BenchHarness) {
          let (p, c) = SharedChan::new();
          bh.iter(|| {
              let c = c.clone();
              spawn(proc() {
                  c.send(());
              });
              p.recv();
          });
      }
      
      #[bench]
      fn native(bh: &mut extra::test::BenchHarness) {
          let (p, c) = SharedChan::new();
          bh.iter(|| {
              let c = c.clone();
              native::task::spawn(proc() {
                  c.send(());
              });
              p.recv();
          });
      }
      
      #[bench]
      fn raw(bh: &mut extra::test::BenchHarness) {
          bh.iter(|| {
              Thread::start(proc() {}).join()
          });
      }
      ```
      22c34f3c
    • A
      Remove two allocations from spawning a green task · 301ff0c2
      Alex Crichton 提交于
      Two unfortunate allocations were wrapping a proc() in a proc() with
      GreenTask::build_start_wrapper, and then boxing this proc in a ~proc() inside of
      Context::new(). Both of these allocations were a direct result from two
      conditions:
      
      1. The Context::new() function has a nice api of taking a procedure argument to
         start up a new context with. This inherently required an allocation by
         build_start_wrapper because extra code needed to be run around the edges of a
         user-provided proc() for a new task.
      
      2. The initial bootstrap code only understood how to pass one argument to the
         next function. By modifying the assembly and entry points to understand more
         than one argument, more information is passed through in registers instead of
         allocating a pointer-sized context.
      
      This is sadly where I end up throwing mips under a bus because I have no idea
      what's going on in the mips context switching code and don't know how to modify
      it.
      
      Closes #7767
      cc #11389
      301ff0c2
    • A
      Don't require an allocation for on_exit messages · 21a064d5
      Alex Crichton 提交于
      Instead, use an enum to allow running both a procedure and sending the task
      result over a channel. I expect the common case to be sending on a channel (e.g.
      task::try), so don't require an extra allocation in the common case.
      
      cc #11389
      21a064d5
    • A
      Don't allocate in LocalHeap::new() · aaead93c
      Alex Crichton 提交于
      One of these is allocated for every task, trying to cut down on allocations
      
      cc #11389
      aaead93c
    • A
      Fix a bug where cached stacks weren't re-used · d5e0622f
      Alex Crichton 提交于
      The condition was the wrong direction and it also didn't take equality into
      account. Tests were added for both cases.
      
      For the small benchmark of `task::try(proc() {}).unwrap()`, this takes the
      iteration time on OSX from 15119 ns/iter to 6179 ns/iter (timed with
      RUST_THREADS=1)
      
      cc #11389
      d5e0622f
    • B
      auto merge of #12061 : pongad/rust/delorderable, r=cmr · 68129d29
      bors 提交于
      #12057
      68129d29
    • M
      Removed num::Orderable · bf1464c4
      Michael Darakananda 提交于
      bf1464c4
    • B
      auto merge of #12017 : FlaPer87/rust/replace-mod-crate, r=alexcrichton · 89b1686b
      bors 提交于
      The first setp for #9880 is to add a new `crate` keyword. This PR does exactly that. I took a chance to refactor `parse_item_foreign_mod` and I broke it down into 2 separate methods to isolate each feature.
      
      The next step will be to push a new stage0 snapshot and then get rid of all `extern mod` around the code.
      89b1686b
    • B
      auto merge of #12248 : alexcrichton/rust/rollup, r=alexcrichton · 94d453e4
      bors 提交于
      This passed `make check` locally, so hopefully it passes on bors!
      94d453e4
    • A
      Rebase conflicts from this giant stack of patches · 640b2285
      Alex Crichton 提交于
      List of PRs contained in this rollup:
      
      Closes #12167 r=alexcrichton
      Closes #12200 r=alexcrichton
      Closes #12206 r=pcwalton
      Closes #12209 r=huonw
      Closes #12211 r=pcwalton
      Closes #12217 r=brson
      Closes #12218 r=alexcrichton
      Closes #12220 r=alexcrichton
      Closes #12222 r=kballard
      Closes #12225 r=alexcrichton
      Closes #12227 r=kballard
      Closes #12237 r=alexcrichton
      Closes #12240 r=kballard
      640b2285
    • A
      Lift $dst outside the closure in write! · 76c313ce
      Alex Crichton 提交于
      If you were writing to something along the lines of `self.foo` then with the new
      closure rules it meant that you were borrowing `self` for the entirety of the
      closure, meaning that you couldn't format other fields of `self` at the same
      time as writing to a buffer contained in `self`.
      
      By lifting the borrow outside of the closure the borrow checker can better
      understand that you're only borrowing one of the fields at a time. This had to
      use type ascription as well in order to preserve trait object coercions.
      76c313ce
    • J
    • A
      Register new snapshots · 1c5295c0
      Alex Crichton 提交于
      1c5295c0
    • H
      mk: make NO_REBUILD more forceful and more general. · 44e6883d
      Huon Wilson 提交于
      Previously crates like `green` and `native` would still depend on their
      parents when running `make check-stage2-green NO_REBUILD=1`, this
      ensures that they only depend on their source files.
      
      Also, apply NO_REBUILD to the crate doc tests, so, for example,
      `check-stage2-doc-std` will use an already compiled `rustdoc` directly.
      44e6883d
    • A
      Relax an assertion in start_selection() · 065e121f
      Alex Crichton 提交于
      It asserted that the previous count was always nonnegative, but DISCONNECTED is
      a valid value for it to see. In order to continue to remember to store
      DISCONNECTED after DISCONNECTED was seen, I also added a helper method.
      
      Closes #12226
      065e121f
    • H
      std::comm: replace Handle.id with a method. · 411a01fe
      Huon Wilson 提交于
      The `id` shouldn't be changed by external code, and exposing it publicly
      allows to be accidentally changed.
      
      Also, remove the first element special case in the `select!` macro.
      411a01fe
    • T
      Add documentation for conditional-compilation · 866d6cc3
      Tobias Bucher 提交于
      This documents in-source conditions using #[cfg(...)] and configurations
      pre-defined by the compiler.
      
      Fix #7962.
      866d6cc3
    • B
      957fcb3f
    • L
      Move base64 and hex from libextra to libserialize · 8a5b938b
      Liigo Zhuang 提交于
      8a5b938b
    • F
      Remove a source of O(n^2) running time in bigints. · 7dc187af
      Felix S. Klock II 提交于
      ::num::bigint, Remove a source of O(n^2) running time in `fn shr_bits`.
      
      I'll cut to the chase: On my laptop, this brings the running time on
      `pidigits 2000` (from src/test/bench/shootout-pidigits.rs) from this:
      ```
      % time ./pidigits 2000 > /dev/null
      
      real	0m7.695s
      user	0m7.690s
      sys	0m0.005s
      ```
      to this:
      ```
      % time ./pidigits 2000 > /dev/null
      
      real	0m0.322s
      user	0m0.318s
      sys	0m0.004s
      ```
      
      The previous code was building up a vector by repeatedly making a
      fresh copy for each element that was unshifted onto the front,
      yielding quadratic running time.  This fixes that by building up the
      vector in reverse order (pushing elements onto the end) and then
      reversing it.
      
      (Another option would be to build up a zero-initialized vector of the
      desired length and then installing all of the shifted result elements
      into their target index, but this was easier to hack up quickly, and
      yields the desired asymptotic improvement.  I have been thinking of
      adding a `vec::from_fn_rev` to handle this case, maybe I will try that
      this weekend.)
      7dc187af
    • S
      606c23a7
    • A
      Include compiler-rt in the distribution tarballs · 745aa748
      Alex Crichton 提交于
      745aa748
    • S
      Stop unloading syntax libraries · 6b429d07
      Steven Fackler 提交于
      Externally loaded libraries are able to do things that cause references
      to them to survive past the expansion phase (e.g. creating @-box cycles,
      launching a task or storing something in task local data). As such, the
      library has to stay loaded for the lifetime of the process.
      6b429d07
    • F
      Remove obsolete warnings for `extern mod` · 5deb3c9c
      Flavio Percoco 提交于
      This patch gets rid of ObsoleteExternModAttributesInParens and
      ObsoleteNamedExternModule since the replacement of `extern mod` with
      `extern crate` avoids those cases and raises different errors. Both have
      been around for at least a version which makes this a good moment to get
      rid of them.
      5deb3c9c
    • F
      Replace `extern mod` with `extern crate` · 9a6d92c1
      Flavio Percoco 提交于
      This patch adds a new keyword `crate` which is intended to replace mod
      in the context of `extern mod` as part of the issue #9880. The patch
      doesn't replace all `extern mod` cases since it is necessary to first
      push a new snapshot 0.
      
      The implementation could've been less invasive than this. However I
      preferred to take this chance to split the `parse_item_foreign_mod`
      method and pull the `extern crate` part out of there, hence the new
      method `parse_item_foreign_crate`.
      9a6d92c1
    • F
      Replace `crate` usage with `krate` · 968633b6
      Flavio Percoco 提交于
      This patch replaces all `crate` usage with `krate` before introducing the
      new keyword. This ensures that after introducing the keyword, there
      won't be any compilation errors.
      
      krate might not be the most expressive substitution for crate but it's a
      very close abbreviation for it. `module` was already used in several
      places already.
      968633b6
    • B
      auto merge of #12210 : zr40/rust/patch-1, r=cmr · cfb87f10
      bors 提交于
      According to kimundi on IRC, the current term for `()` is 'unit'. This commit updates tutorial.md to change 'nil' to 'unit' where `()` is described.
      cfb87f10
  2. 13 2月, 2014 5 次提交
    • B
      auto merge of #12165 : fhahn/rust/change-some-tests, r=alexcrichton · 58eeb07c
      bors 提交于
      While working on #11363 I stumbled over a couple of ignored tests, that seem to be fixed or invalid.
      
      * src/test/run-pass/issue-3559.rs was fixed in #4726
      * src/test/compile-fail/borrowck-call-sendfn.rs was fixed in #2978
      * update src/test/compile-fail/issue-5500-1.rs to work with current Rust (I'm not 100% sure if the original condition is tested as mentioned in #5500, but I think so)
      * removed src/test/compile-fail/issue-5500.rs because it is tested in
          src/test/run-fail/issue-5500.rs (they are the same test cases, I just renamed src/test/run-fail/addr-of-bot.rs to be consistent with the other issue name
      58eeb07c
    • B
      auto merge of #12216 : alexcrichton/rust/another-snap-fix, r=brson · c62f6cef
      bors 提交于
      Hurray more snapshot blockers!
      c62f6cef
    • A
      Ignore another fourcc test on cross compiles · 064281c1
      Alex Crichton 提交于
      064281c1
    • F
      Reenable some ignored test cases · 195d8fdc
      Florian Hahn 提交于
      * src/test/run-pass/issue-3559.rs was fixed in #4726
      * src/test/compile-fail/borrowck-call-sendfn.rs was fixed in #2978
      * update src/test/compile-fail/issue-5500-1.rs to work with current Rust
      * removed src/test/compile-fail/issue-5500.rs because it is tested in
          src/test/run-fail/issue-5500.rs
      * src/test/compile-fail/view-items-at-top.rs fixed
      * #897 fixed
      * compile-fail/issue-6762.rs issue was closed as dup of #6801
      * deleted compile-fail/issue-2074.rs because it became irelevant and is
        irrelevant #2074, a test covering this was added in
        4f92f452
      195d8fdc
    • B
      auto merge of #12204 : alexcrichton/rust/seek, r=pcwalton · 1d5c52d8
      bors 提交于
      This adopts the rules posted in #10432:
      
      1. If a seek position is negative, then an error is generated
      2. Seeks beyond the end-of-file are allowed. Future writes will fill the gap
         with data and future reads will return errors.
      3. Seeks within the bounds of a file are fine.
      
      Closes #10432
      1d5c52d8
  3. 12 2月, 2014 3 次提交