1. 23 12月, 2020 1 次提交
    • M
      Utilize PGO for rustc linux dist builds · a448f88b
      Mark Rousskov 提交于
      This implements support for applying PGO to the rustc compilation step (not
      standard library or any tooling, including rustdoc). Expanding PGO to more tools
      is not terribly difficult but will involve more work and greater CI time
      commitment.
      
      For the same reason of avoiding greater time commitment, this currently avoids
      implementing for platforms outside of x86_64-unknown-linux-gnu, though in
      practice it should be quite simple to extend over time to more platforms. The
      initial implementation is intentionally minimal here to avoid too much work
      investment before we start seeing wins for a subset of Rust users.
      
      The choice of workloads to profile here is somewhat arbitrary, but the general
      rationale was to aim for a small set that largely avoided time regressions on
      perf.rust-lang.org's full suite of crates. The set chosen is libcore, cargo (and
      its dependencies), and a few ad-hoc stress tests from perf.rlo. The stress tests
      are arguably the most controversial, but they benefit those cases (avoiding
      regressions) and do not really remove wins from other benchmarks.
      
      The primary next step after this PR lands is to implement support for PGO in
      LLVM. It is unclear whether we can afford a full LLVM rebuild in CI, though, so
      the approach taken there may need to be more staggered. rustc-only PGO seems
      well affordable on linux at least, giving us up to 20% wall time wins on some
      crates for 15 minutes of extra CI time (1 hour up from 45 minutes).
      
      The PGO data is uploaded to allow others to reuse it if attempting to reproduce
      the CI build or potentially, in the future, on other platforms where an
      off-by-one strategy is used for dist builds at minimal performance cost.
      a448f88b
  2. 17 12月, 2020 2 次提交
  3. 16 12月, 2020 19 次提交
    • B
      Auto merge of #77117 - davidtwco:issue-34651-split-dwarf, r=nagisa · 2ba7ca2b
      bors 提交于
      cg_llvm: split dwarf support
      
      cc #34651
      
      This PR adds initial support for Split DWARF to rustc, based on the implementation in Clang.
      
      ##### Current Status
      This PR currently has functioning split-dwarf, running rustc with `-Zsplit-dwarf=split` when compiling a binary will produce a `dwp` alongside the binary, which contains the linked dwarf objects.
      
      ```shell-session
      $ rustc -Cdebuginfo=2 -Zsplit-dwarf=split -C save-temps ./foo.rs
      $ ls foo*
      foo
      foo.belfx9afw9cmv8.rcgu.dwo
      foo.belfx9afw9cmv8.rcgu.o
      foo.foo.7rcbfp3g-cgu.0.rcgu.dwo
      foo.foo.7rcbfp3g-cgu.0.rcgu.o
      foo.foo.7rcbfp3g-cgu.1.rcgu.dwo
      foo.foo.7rcbfp3g-cgu.1.rcgu.o
      foo.foo.7rcbfp3g-cgu.2.rcgu.dwo
      foo.foo.7rcbfp3g-cgu.2.rcgu.o
      foo.foo.7rcbfp3g-cgu.3.rcgu.dwo
      foo.foo.7rcbfp3g-cgu.3.rcgu.o
      foo.foo.7rcbfp3g-cgu.4.rcgu.dwo
      foo.foo.7rcbfp3g-cgu.4.rcgu.o
      foo.foo.7rcbfp3g-cgu.5.rcgu.dwo
      foo.foo.7rcbfp3g-cgu.5.rcgu.o
      foo.foo.7rcbfp3g-cgu.6.rcgu.dwo
      foo.foo.7rcbfp3g-cgu.6.rcgu.o
      foo.foo.7rcbfp3g-cgu.7.rcgu.dwo
      foo.foo.7rcbfp3g-cgu.7.rcgu.o
      foo.dwp
      foo.rs
      $ readelf -wi foo.foo.7rcbfp3g-cgu.0.rcgu.o
      # ...
        Compilation Unit @ offset 0x90:
         Length:        0x2c (32-bit)
         Version:       4
         Abbrev Offset: 0x5b
         Pointer Size:  8
       <0><9b>: Abbrev Number: 1 (DW_TAG_compile_unit)
          <9c>   DW_AT_stmt_list   : 0xe8
          <a0>   DW_AT_comp_dir    : (indirect string, offset: 0x13b): /home/david/Projects/rust/rust0
          <a4>   DW_AT_GNU_dwo_name: (indirect string, offset: 0x15b): foo.foo.7rcbfp3g-cgu.0.rcgu.dwo
          <a8>   DW_AT_GNU_dwo_id  : 0x357472a2b032d7b9
          <b0>   DW_AT_low_pc      : 0x0
          <b8>   DW_AT_ranges      : 0x40
          <bc>   DW_AT_GNU_addr_base: 0x0
      # ...
      ```
      
      ##### To-Do
      I've opened this PR as a draft to get feedback and work out how we'd expect rustc to work when Split DWARF is requested. It might be easier to read the PR commit-by-commit.
      
      - [ ] Add error when Split DWARF is requested on platforms where it doesn't make sense.
      - [x] Determine whether or not there should be a single `dwo` output from rustc, or one per codegen-unit as exists currently.
      - [x] Add tests.
      - [x] Fix `single` mode - currently single mode doesn't change the invocation of `addPassesToEmitFile`, which is correct, but it also needs to change the split dwarf path provided to `createCompileUnit` and `createTargetMachine` so that it's just the final binary (currently it is still a non-existent `dwo` file).
      
      r? `@nagisa`
      cc `@michaelwoerister` `@EddyB` `@alexcrichton` `@rust-lang/wg-incr-comp`
      2ba7ca2b
    • D
      cg_llvm: split dwarf filename and comp dir · ee073b5e
      David Wood 提交于
      llvm-dwp concatenates `DW_AT_comp_dir` with `DW_AT_GNU_dwo_name` (only
      when `DW_AT_comp_dir` exists), which can result in it failing to find
      the DWARF object files.
      
      In earlier testing, `DW_AT_comp_dir` wasn't present in the final
      object and the current directory was the output directory.
      
      When running tests through compiletest, the working directory of the
      compilation is different from output directory and that resulted in
      `DW_AT_comp_dir` being in the object file (and set to the current
      working directory, rather than the output directory), and
      `DW_AT_GNU_dwo_name` being set to the full path (rather than just
      the filename), so llvm-dwp was failing.
      
      This commit changes the compilation directory provided to LLVM to match
      the output directory, where DWARF objects are output; and ensures that
      only the filename is used for `DW_AT_GNU_dwo_name`.
      Signed-off-by: NDavid Wood <david@davidtw.co>
      ee073b5e
    • D
      compiletest: add split dwarf compare mode · 99ad915e
      David Wood 提交于
      This commit adds a Split DWARF compare mode to compiletest so that
      debuginfo tests are also tested using Split DWARF in split mode (and
      manually in single mode).
      Signed-off-by: NDavid Wood <david@davidtw.co>
      99ad915e
    • D
      tests: add run-make-fulldeps split-dwarf test · 2b22670b
      David Wood 提交于
      This commit adds a run-make-fulldeps test which checks that a DWARF
      package file is emitted.
      Signed-off-by: NDavid Wood <david@davidtw.co>
      2b22670b
    • D
      cg_clif: fix build with split dwarf · 6c4350dc
      David Wood 提交于
      This commit makes minor changes to the cranelift backend so that it can
      build given changes in cg_ssa for Split DWARF.
      Signed-off-by: NDavid Wood <david@davidtw.co>
      6c4350dc
    • D
      cg_llvm: implement split dwarf support · e3fdae9d
      David Wood 提交于
      This commit implements Split DWARF support, wiring up the flag (added in
      earlier commits) to the modified FFI wrapper (also from earlier
      commits).
      Signed-off-by: NDavid Wood <david@davidtw.co>
      e3fdae9d
    • D
      bootstrap: copy `llvm-dwp` to sysroot · 241160de
      David Wood 提交于
      `llvm-dwp` is required for linking the DWARF objects into DWARF packages
      when using Split DWARF, especially given that rustc produces multiple
      DWARF objects (one for each codegen unit).
      Signed-off-by: NDavid Wood <david@davidtw.co>
      241160de
    • D
      cg_ssa: introduce `TargetMachineFactoryFn` alias · 6890312e
      David Wood 提交于
      This commit removes the `TargetMachineFactory` struct and adds a
      `TargetMachineFactoryFn` type alias which is used everywhere that the
      previous, long type was used.
      Signed-off-by: NDavid Wood <david@davidtw.co>
      6890312e
    • D
      cg_ssa: correct documentation comments · cf49c2a1
      David Wood 提交于
      This commit changes some comments to documentation comments so that
      they can be read on the generated rustdoc.
      Signed-off-by: NDavid Wood <david@davidtw.co>
      cf49c2a1
    • D
      session: add `split-dwarf` flag · 57d05d35
      David Wood 提交于
      This commit adds a flag for Split DWARF, which enables debuginfo to be
      split into multiple files.
      Signed-off-by: NDavid Wood <david@davidtw.co>
      57d05d35
    • D
      llvm: update ffi bindings for split dwarf · 341aa97a
      David Wood 提交于
      This commit modifies the FFI bindings to LLVM required for Split DWARF
      support in rustc. In particular:
      
      - `addPassesToEmitFile`'s wrapper, `LLVMRustWriteOutputFile` now takes
        a `DwoPath` `const char*`. When disabled, `nullptr` should be provided
        which will preserve existing behaviour. When enabled, the path to the
        `.dwo` file should be provided.
      - `createCompileUnit`'s wrapper, `LLVMRustDIBuilderCreateCompileUnit`
        now has two additional arguments, for the `DWOId` and to enable
        `SplitDebugInlining`. `DWOId` should always be zero.
      - `createTargetMachine`'s wrapper, `LLVMRustCreateTargetMachine` has an
        additional argument which should be provided the path to the `.dwo`
        when enabled.
      Signed-off-by: NDavid Wood <david@davidtw.co>
      341aa97a
    • B
      Auto merge of #79682 - jyn514:no-blanket-impls, r=Manishearth,GuillaumeGomez · 268cbfeb
      bors 提交于
      Don't look for blanket impls in intra-doc links
      
      This never worked and has been causing severe performance problems.
      Hopefully it will be re-landed at some point in the future when it
      actually works, but in the meantime it makes no sense to have the code
      around when it does nothing and actively makes rustdoc harder to use.
      
      Closes https://github.com/rust-lang/rust/issues/78761. Does *not* affect https://github.com/rust-lang/rust/issues/78800.
      
      r? `@Manishearth`
      cc `@seeplusplus`
      268cbfeb
    • B
      Auto merge of #79607 - DrMeepster:maybe_uninit_write_slice, r=m-ou-se · ddbc6176
      bors 提交于
      MaybeUninit::copy/clone_from_slice
      
      This PR adds 2 new methods to MaybeUninit under the feature of `maybe_uninit_write_slice`: `copy_from_slice` and `clone_from_slice`.
      
      These are useful for initializing uninitialized buffers (such as the one returned by `Vec::spare_capacity_mut` for example) with initialized data.
      
      The methods behave similarly to the methods on slices, but the destination is uninitialized and they return the destination slice as an initialized slice.
      ddbc6176
    • B
      Auto merge of #80041 - jyn514:shrink-item, r=GuillaumeGomez · 90f4b529
      bors 提交于
      Get rid of `clean::Deprecation`
      
      This brings the size of `item.deprecation` from 56 to 16 bytes. Helps with #79103 and https://github.com/rust-lang/rust/issues/76382, in the same vein as https://github.com/rust-lang/rust/pull/79957.
      
      r? `@GuillaumeGomez`
      90f4b529
    • B
      Auto merge of #78833 - CDirkx:parse_prefix, r=dtolnay · c00a4648
      bors 提交于
      Refactor and fix `parse_prefix` on Windows
      
      This PR is an extension of #78692 as well as a general refactor of `parse_prefix`:
      
      **Fixes**:
      There are two errors in the current implementation of `parse_prefix`:
      
      Firstly, in the current implementation only `\` is recognized as a separator character in device namespace prefixes. This behavior is only correct for verbatim paths; `"\\.\C:/foo"` should be parsed as `"C:"` instead of `"C:/foo"`.
      
      Secondly, the current implementation only handles single separator characters. In non-verbatim paths a series of separator characters should be recognized as a single boundary, e.g. the UNC path `"\\localhost\\\\\\C$\foo"` should be parsed as `"\\localhost\\\\\\C$"` and then `UNC(server: "localhost", share: "C$")`, but currently it is not parsed at all, because it starts being parsed as `\\localhost\` and then has an invalid empty share location.
      
      Paths like `"\\.\C:/foo"` and `"\\localhost\\\\\\C$\foo"` are valid on Windows, they are equivalent to just `"C:\foo"`.
      
      **Refactoring**:
      All uses of `&[u8]` within `parse_prefix` are extracted to helper functions and`&OsStr` is used instead. This reduces the number of places unsafe is used:
      - `get_first_two_components` is adapted to the more general `parse_next_component` and used in more places
      - code for parsing drive prefixes is extracted to `parse_drive`
      c00a4648
    • J
      Don't look for blanket impls in intra-doc links · 6580f11a
      Joshua Nelson 提交于
      This never worked and has been causing severe performance problems.
      Hopefully it will be re-landed at some point in the future when it
      actually works, but in the meantime it makes no sense to have the code
      around when it does nothing and actively makes rustdoc harder to use.
      6580f11a
    • B
      Auto merge of #78399 - vn-ki:gsgdt-graphviz, r=oli-obk · 4031f7b0
      bors 提交于
      make MIR graphviz generation use gsgdt
      
      gsgdt [https://crates.io/crates/gsgdt] is a crate which provides an
      interface for stringly typed graphs. It also provides generation of
      graphviz dot format from said graph.
      
      This is the first in a series of PRs on moving graphviz code out of rustc into normal crates and then implementating graph diffing on top of these crates.
      
      r? `@oli-obk`
      4031f7b0
    • D
      write_slice(_cloned) · 4652a13f
      DrMeepster 提交于
      4652a13f
    • B
      Auto merge of #80044 - jyn514:smaller-name, r=GuillaumeGomez · f76ecd06
      bors 提交于
      [rustdoc] Switch to Symbol for item.name
      
      This decreases the size of `Item` from 680 to 616 bytes. It also does a
      lot less work since it no longer has to copy as much.
      
      Helps with #79103.
      
      r? `@GuillaumeGomez`
      f76ecd06
  4. 15 12月, 2020 18 次提交