Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E0406 #2

Closed
wants to merge 16 commits into from
Closed

E0406 #2

wants to merge 16 commits into from

Commits on Jun 14, 2016

  1. Configuration menu
    Copy the full SHA
    f8d2fdf View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    592eaa5 View commit details
    Browse the repository at this point in the history
  3. specialize zip: Specialize .zip() for TrustedRandomAccess iterators

    This allows common iterator compositions like a.zip(b) where a, b
    are slice::{Iter, IterMut} compile to *much* better code.
    bluss committed Jun 14, 2016
    Configuration menu
    Copy the full SHA
    a8f2e9b View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    515c4d3 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    13f8f40 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c2ef20f View commit details
    Browse the repository at this point in the history
  7. specialize zip: Add benchmarks

    bluss committed Jun 14, 2016
    Configuration menu
    Copy the full SHA
    85cd49f View commit details
    Browse the repository at this point in the history
  8. specialize zip: Use associated type for specialized zip struct data

    The associated type must be 'static to avoid dropck related errors.
    bluss committed Jun 14, 2016
    Configuration menu
    Copy the full SHA
    5df05c6 View commit details
    Browse the repository at this point in the history

Commits on Jun 15, 2016

  1. rustdoc: Add stability notices to impl items

    Also fixes missing stability notices on methods with no docs.
    ollie27 committed Jun 15, 2016
    Configuration menu
    Copy the full SHA
    195fc5a View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2016

  1. Fixed the TAGS.rustc.emacs and TAGS.rustc.vi make targets.

    (They were added to `ctags.mk` in PR rust-lang#33256, but I guess I must have
     only tested running `make TAGS.emacs TAGS.rustc.emacs` and not `make
     TAGS.rustc.emacs` on its own.)
    pnkfelix committed Jun 17, 2016
    Configuration menu
    Copy the full SHA
    272ce38 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9ac3d9b View commit details
    Browse the repository at this point in the history
  3. Auto merge of rust-lang#33090 - bluss:special-zip-2, r=aturon

    Specialize .zip() for efficient slice and slice iteration
    
    The idea is to introduce a private trait TrustedRandomAccess and specialize .zip() for random access iterators into a counted loop.
    
    The implementation in the PR is internal and has no visible effect in the API
    
    Why a counted loop? To have each slice iterator compile to just a pointer, and both pointers are indexed with the same loop counter value in the generated code. When this succeeds, copying loops are readily recognized and replaced with memcpy and addition loops autovectorize well.
    
    The TrustedRandomAccess approach works very well on the surface. Microbenchmarks optimize well, following the ideas above, and that is a dramatic improvement of .zip()'s codegen.
    
    ```rust
    // old zip before this PR: bad, byte-for-byte loop
    // with specialized zip: memcpy
    pub fn copy_zip(xs: &[u8], ys: &mut [u8]) {
        for (a, b) in ys.iter_mut().zip(xs) {
            *a = *b;
        }
    }
    
    // old zip before this PR: single addition per iteration
    // with specialized zip: vectorized
    pub fn add_zip(xs: &[f32], ys: &mut [f32]) {
        for (a, b) in ys.iter_mut().zip(xs) { *a += *b; }
    }
    
    // old zip before this PR: single addition per iteration
    // with specialized zip: vectorized (!!)
    pub fn add_zip3(xs: &[f32], ys: &[f32], zs: &mut [f32]) {
        for ((a, b), c) in zs.iter_mut().zip(xs).zip(ys) { *a += *b * *c; }
    }
    ```
    
    Yet in more complex situations, the .zip() loop can still fall back to its old behavior where phantom null checks throw in fake premature end of the loop conditionals. Remember that a NULL inside
    Option<(&T, &T)> makes it a `None` value and a premature (in this case)
    end of the loop.
    
    So even if we have 1) an explicit `Some` in the code and 2) the types of the pointers are `&T` or `&mut T` which are nonnull, we can still get a phantom null check at that point.
    
    One example that illustrates the difference is `copy_zip` with slice versus Vec arguments. The involved iterator types are exactly the same, but the Vec version doesn't compile down to memcpy. Investigating into this, the function argument metadata emitted to llvm plays the biggest role. As eddyb summarized, we need nonnull for the loop to autovectorize and noalias for it to replace with memcpy.
    
    There was an experiment to use `assume` to add a non-null assumption on each of the two elements in the specialized zip iterator, but this only helped in some of the test cases and regressed others. Instead I think the nonnull/noalias metadata issue is something we need to solve separately anyway.
    
    These have conditionally implemented TrustedRandomAccess
    
    - Enumerate
    - Zip
    
    These have not implemented it
    
    - Map is sideeffectful. The forward case would be workable, but the double ended case is complicated.
    - Chain, exact length semantics unclear
    - Filter, FilterMap, FlatMap and many others don't offer random access and/or exact length
    bors authored Jun 17, 2016
    Configuration menu
    Copy the full SHA
    c8eff68 View commit details
    Browse the repository at this point in the history
  4. Auto merge of rust-lang#34322 - pnkfelix:fix-rustc-ctags, r=alexcrichton

    Fixed the `TAGS.rustc.emacs` and `TAGS.rustc.vi` make targets.
    
    (They were added to `ctags.mk` in PR rust-lang#33256, but I guess I must have
     only tested running `make TAGS.emacs TAGS.rustc.emacs` and not `make
     TAGS.rustc.emacs` on its own.)
    bors authored Jun 17, 2016
    Configuration menu
    Copy the full SHA
    222e337 View commit details
    Browse the repository at this point in the history
  5. Auto merge of rust-lang#34292 - ollie27:rustdoc_depr_impl, r=Guillaum…

    …eGomez
    
    rustdoc: Add stability notices to impl items
    
    Also fixes missing stability notices on methods with no docs.
    
    For example [`f64::is_positive`](https://doc.rust-lang.org/nightly/std/primitive.f64.html#method.is_positive) is missing its deprecation message.
    bors authored Jun 17, 2016
    Configuration menu
    Copy the full SHA
    1f9423a View commit details
    Browse the repository at this point in the history
  6. Auto merge of rust-lang#34323 - GuillaumeGomez:unreachable_not_unreac…

    …hable, r=pnkfelix
    
    Fix panic when using debug in rustc
    
    When I was using `println!("{:?}")` [here](https://github.com/rust-lang/rust/blob/master/src/librustc_resolve/lib.rs#L1610) and [here](https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/collect.rs#L836), I was able to get into this `unreachache`.
    bors authored Jun 17, 2016
    Configuration menu
    Copy the full SHA
    646015c View commit details
    Browse the repository at this point in the history

Commits on Jun 18, 2016

  1. Configuration menu
    Copy the full SHA
    1414e89 View commit details
    Browse the repository at this point in the history