1. 15 12月, 2020 3 次提交
    • B
      Auto merge of #79922 - tmiasko:lower-discriminant, r=nagisa · 5d77fc8d
      bors 提交于
      Lower `discriminant_value` intrinsic
      
      This allows const propagation to evaluate comparisons involving
      field-less enums using derived implementations of `PartialEq` (after
      inlining `eq`).
      5d77fc8d
    • B
      Auto merge of #79938 - tmiasko:stdarch, r=Amanieu · 8b3ee82e
      bors 提交于
      Update stdarch submodule
      
      Changes included:
      
      * Use a bootstrap guard for modules with new target features
      * Avoid calling intrinsics with invalid const arguments
      * Avx512bw
      * Avx512cd
      * Add AVX512BITALG
      * Add GFNI Intrinsics
      * Add AVX512VPOPCNTDQ Intrinsics
      * Add VPCLMULQDQ Intrinsics
      * Avx512bw
      * Reimplement `_xgetbv` with LLVM intrinsics
      * Avx512bw
      * Add reamained vmax and vmin via auto-generated code
      * Add VAES intrinsics
      
      Fixes #56483.
      8b3ee82e
    • B
      Auto merge of #77618 - fusion-engineering-forks:windows-parker, r=Amanieu · fa416394
      bors 提交于
      Add fast futex-based thread parker for Windows.
      
      This adds a fast futex-based thread parker for Windows. It either uses WaitOnAddress+WakeByAddressSingle or NT Keyed Events (NtWaitForKeyedEvent+NtReleaseKeyedEvent), depending on which is available. Together, this makes this thread parker work for Windows XP and up. Before this change, park()/unpark() did not work on Windows XP: it needs condition variables, which only exist since Windows Vista.
      
      ---
      
      Unfortunately, NT Keyed Events are an undocumented Windows API. However:
      - This API is relatively simple with obvious behaviour, and there are several (unofficial) articles documenting the details. [1]
      - parking_lot has been using this API for years (on Windows versions before Windows 8). [2] Many big projects extensively use parking_lot, such as servo and the Rust compiler itself.
      - It is the underlying API used by Windows SRW locks and Windows critical sections. [3] [4]
      - The source code of the implementations of Wine, ReactOs, and Windows XP are available and match the expected behaviour.
      - The main risk with an undocumented API is that it might change in the future. But since we only use it for older versions of Windows, that's not a problem.
      - Even if these functions do not block or wake as we expect (which is unlikely, see all previous points), this implementation would still be memory safe. The NT Keyed Events API is only used to sleep/block in the right place.
      
      [1]\: http://www.locklessinc.com/articles/keyed_events/
      [2]\: https://github.com/Amanieu/parking_lot/commit/43abbc964e
      [3]\: https://docs.microsoft.com/en-us/archive/msdn-magazine/2012/november/windows-with-c-the-evolution-of-synchronization-in-windows-and-c
      [4]\: Windows Internals, Part 1, ISBN 9780735671300
      
      ---
      
      The choice of fallback API is inspired by parking_lot(_core), but the implementation of this thread parker is different. While parking_lot has no use for a fast path (park() directly returning if unpark() was already called), this implementation has a fast path that returns without even checking which waiting/waking API to use, as the same atomic variable with compatible states is used in all cases.
      fa416394
  2. 14 12月, 2020 12 次提交
  3. 13 12月, 2020 25 次提交