1. 08 Nov, 2023 3 commits
  2. 07 Nov, 2023 2 commits
    • Properly handle signal stacks and frame-size calculations · bb7bbb12
      We can determine the signal stack, so use that information to
      make better decisions about when to calculate the frame size
      and when not to. This fixes a several tests where the memory
      layout had the signal stack and main stack in position that
      confused some of the greater-than/less-than comparisons.
      
      Also cleanup certain types to avoid more casting than necessary.
      
      PiperOrigin-RevId: 580221819
      Change-Id: I0365b03e7893741603dc66e6d36a069d0b7f5404
      Abseil Team committed
    • Add control()/slot() functions to iterator/const_iterator. · 116ee0fe
      This allows for avoiding e.g. it.inner_.slot_ on const iterators.
      
      Also, refactor HashtableDebugAccess::AllocatedByteSize to use regular iteration instead of looking directly at control/slot_array of the table in order to support small object optimization.
      
      PiperOrigin-RevId: 580194253
      Change-Id: I64cd69287834ee5c7a8daf867c532258806bfb7b
      Evan Brown committed
  3. 06 Nov, 2023 1 commit
  4. 03 Nov, 2023 1 commit
  5. 02 Nov, 2023 2 commits
  6. 01 Nov, 2023 1 commit
  7. 31 Oct, 2023 1 commit
    • Mutex: Remove destructor in release build · f3760b4d
      The Mutex destructor is needed only to clean up debug logging
      and invariant checking synch events. These are not supposed
      to be used in production, but the non-empty destructor has
      costs for production builds.
      
      Instead of removing synch events in destructor,
      drop all of them if we accumulated too many.
      For tests is should not matter (we maybe only consume
      a bit more memory). Production builds should be either unaffected
      (if don't use debug logging), or use periodic reset of all synch events.
      
      PiperOrigin-RevId: 578123259
      Change-Id: I0ec59183a5f63ea0a6b7fc50f0a77974e7f677be
      Dmitry Vyukov committed
  8. 30 Oct, 2023 4 commits
    • Optimize memcasecmp. Benchmarks shows slight improvement. · 6c8338c2
      We are also avoiding potential cache-misses, by avoiding load.
      
      name                         old speed            new speed            delta
      BM_Searchcase                3.09GB/s ±13%        3.20GB/s ±16%   +3.69%  (p=0.039 n=20+17)
      BM_SearchcaseMedium          1.08GB/s ± 7%        1.04GB/s ±14%     ~     (p=0.814 n=16+20)
      BM_SearchcasePathological     618kB/s ±13%         652kB/s ± 6%   +5.55%  (p=0.043 n=20+16)
      BM_Memcasematch              2.43GB/s ± 3%        2.45GB/s ± 3%     ~     (p=0.488 n=17+16)
      BM_MemcasematchMedium         230MB/s ± 8%         261MB/s ±14%  +13.77%  (p=0.000 n=16+20)
      BM_MemcasematchPathological   624kB/s ±14%         619kB/s ±14%     ~     (p=0.836 n=20+20)
      
      PiperOrigin-RevId: 577919033
      Change-Id: I31324e04b6a577c582ad630d171d3b41d826f1e4
      Ilya Tokar committed
    • Roll forward: Add sanitizer mode checks that element constructors/destructors… · dc3ef295
      Roll forward: Add sanitizer mode checks that element constructors/destructors don't make reentrant calls to raw_hash_set member functions.
      
      PiperOrigin-RevId: 577877803
      Change-Id: I254c589b00cadec6ff95dfd60a8a38ab303c1af5
      Evan Brown committed
    • Fix an unreachable code warning on some platforms · e7d9317b
      #1558
      
      PiperOrigin-RevId: 577874842
      Change-Id: I1d56f3f4b445f6c4a9df2fe06fec542cb00e0e92
      Derek Mauro committed
    • absl: speed up Mutex::Lock · f4106724
      Currently Mutex::Lock contains not inlined non-tail call:
      TryAcquireWithSpinning -> GetMutexGlobals -> LowLevelCallOnce -> init closure
      This turns the function into non-leaf with stack frame allocation
      and additional register use. Remove this non-tail call to make the function leaf.
      Move spin iterations initialization to LockSlow.
      
      Current Lock happy path:
      
      00000000001edc20 <absl::Mutex::Lock()>:
        1edc20:	55                   	push   %rbp
        1edc21:	48 89 e5             	mov    %rsp,%rbp
        1edc24:	53                   	push   %rbx
        1edc25:	50                   	push   %rax
        1edc26:	48 89 fb             	mov    %rdi,%rbx
        1edc29:	48 8b 07             	mov    (%rdi),%rax
        1edc2c:	a8 19                	test   $0x19,%al
        1edc2e:	75 0e                	jne    1edc3e <absl::Mutex::Lock()+0x1e>
        1edc30:	48 89 c1             	mov    %rax,%rcx
        1edc33:	48 83 c9 08          	or     $0x8,%rcx
        1edc37:	f0 48 0f b1 0b       	lock cmpxchg %rcx,(%rbx)
        1edc3c:	74 42                	je     1edc80 <absl::Mutex::Lock()+0x60>
        ... unhappy path ...
        1edc80:	48 83 c4 08          	add    $0x8,%rsp
        1edc84:	5b                   	pop    %rbx
        1edc85:	5d                   	pop    %rbp
        1edc86:	c3                   	ret
      
      New Lock happy path:
      
      00000000001eea80 <absl::Mutex::Lock()>:
        1eea80:	48 8b 07             	mov    (%rdi),%rax
        1eea83:	a8 19                	test   $0x19,%al
        1eea85:	75 0f                	jne    1eea96 <absl::Mutex::Lock()+0x16>
        1eea87:	48 89 c1             	mov    %rax,%rcx
        1eea8a:	48 83 c9 08          	or     $0x8,%rcx
        1eea8e:	f0 48 0f b1 0f       	lock cmpxchg %rcx,(%rdi)
        1eea93:	75 01                	jne    1eea96 <absl::Mutex::Lock()+0x16>
        1eea95:	c3                   	ret
        ... unhappy path ...
      
      PiperOrigin-RevId: 577790105
      Change-Id: I20793534050302ff9f7a20aed93791c088d98562
      Dmitry Vyukov committed
  9. 27 Oct, 2023 2 commits
    • Rollback "Mutex: Remove destructor in release build" · 89d2caa1
      PiperOrigin-RevId: 577180526
      Change-Id: Iec53709456805ca8dc5327669cc0f6c95825d0e9
      Dmitry Vyukov committed
    • Mutex: Remove destructor in release build · cdb1e7f4
      The Mutex destructor is needed only to clean up debug logging
      and invariant checking synch events. These are not supposed
      to be used in production, but the non-empty destructor has
      costs for production builds.
      
      Instead of removing synch events in destructor,
      drop all of them if we accumulated too many.
      For tests is should not matter (we maybe only consume
      a bit more memory). Production builds should be either unaffected
      (if don't use debug logging), or use periodic reset of all synch events.
      
      PiperOrigin-RevId: 577106805
      Change-Id: Icaaf7166b99afcd5dce92b4acd1be661fb72f10b
      Dmitry Vyukov committed
  10. 26 Oct, 2023 2 commits
  11. 25 Oct, 2023 1 commit
  12. 24 Oct, 2023 4 commits
  13. 20 Oct, 2023 5 commits
  14. 19 Oct, 2023 1 commit
    • Optimize prefetch codegen. · 03786143
      Currently we use "r" constraint to pass prefetched address.
      This forces the compiler to actually put it into a register.
      As the result some uses look as:
      
       16bfb7c:	48 01 cf             	add    %rcx,%rdi
       16bfb7f:	0f 0d 0f             	prefetchw (%rdi)
      --
       16bfccf:	48 83 c1 60          	add    $0x60,%rcx
       16bfcd3:	0f 0d 09             	prefetchw (%rcx)
      
      Use "m" constraint instead. It's more relaxed and requires
      to just materialize the address in some form using whatever
      addressing modes the target supports (e.g. x86 off(base, index, scale)).
      With the change the same code becomes:
      
       16bfb7c:	0f 0d 0c 39          	prefetchw (%rcx,%rdi,1)
      --
       16bfccf:	0f 0d 49 60          	prefetchw 0x60(%rcx)
      
      PiperOrigin-RevId: 574723975
      Change-Id: Id0c8645f8c702d1842685343901da321f6513156
      Dmitry Vyukov committed
  15. 18 Oct, 2023 1 commit
  16. 17 Oct, 2023 2 commits
    • Rollback: Add sanitizer mode checks that element constructors/destructors don't… · 7676c565
      Rollback: Add sanitizer mode checks that element constructors/destructors don't make reentrant calls to raw_hash_set member functions.
      
      PiperOrigin-RevId: 574232718
      Change-Id: I8ef25fec00b76ee5fb9424e7614ca55edd6ba81b
      Evan Brown committed
    • PR #1546: CMake: Enable CMP0074 so that GTest_ROOT can be specified · b87875aa
      Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1546
      
      I am building Abseil with tests enabled and an external GTest build, i.e.
      ```
      -DABSL_BUILD_TESTING=ON
      -DABSL_USE_EXTERNAL_GOOGLETEST=ON
      -DABSL_FIND_GOOGLETEST=ON
      -DGTest_ROOT=/path/to/googletest/1.14.0
      ```
      
      However, CMake (3.20.2) configuration yielded this result:
      ```
      -- Looking for pthread_create in pthreads - not found
      -- Looking for pthread_create in pthread
      -- Looking for pthread_create in pthread - found
      -- Found Threads: TRUE
      CMake Warning (dev) at CMakeLists.txt:150 (find_package):
        Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
        Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
        command to set the policy and suppress this warning.
      
        CMake variable GTest_ROOT is set to:
      
          /path/to/googletest/1.14.0
      
        For compatibility, CMake is ignoring the variable.
      This warning is for project developers.  Use -Wno-dev to suppress it.
      
      CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
        Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR
        GTEST_MAIN_LIBRARY)
      Call Stack (most recent call first):
        /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
        /usr/share/cmake/Modules/FindGTest.cmake:255 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
        CMakeLists.txt:150 (find_package)
      
      -- Configuring incomplete, errors occurred!
      See also "/tmp/abseil-build/CMakeFiles/CMakeOutput.log".
      See also "/tmp/abseil-build/CMakeFiles/CMakeError.log".
      ```
      
      This PR sets `CMP0074=NEW` so that the GTest install location can be specified via `GTest_ROOT`.
      Merge 4e4f035affd9b8af739634afdf9c2e80d14c2391 into 2a18ba75
      
      Merging this change closes #1546
      
      COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1546 from iskunk:feature/fix-gtest-root 4e4f035affd9b8af739634afdf9c2e80d14c2391
      PiperOrigin-RevId: 574159856
      Change-Id: Ifc796500c3a6403d28a027375116437bc743205a
      Daniel Richard G committed
  17. 16 Oct, 2023 2 commits
  18. 12 Oct, 2023 5 commits