Skip to content
Snippets Groups Projects
  1. Mar 21, 2017
  2. Mar 20, 2017
    • Duncan P. N. Exon Smith's avatar
      Reapply "Modules: Cache PCMs in memory and avoid a use-after-free" · 2bf5f686
      Duncan P. N. Exon Smith authored
      This reverts commit r298185, effectively reapplying r298165, after fixing the
      new unit tests (PR32338).  The memory buffer generator doesn't null-terminate
      the MemoryBuffer it creates; this version of the commit informs getMemBuffer
      about that to avoid the assert.
      
      Original commit message follows:
      
      ----
      
      Clang's internal build system for implicit modules uses lock files to
      ensure that after a process writes a PCM it will read the same one back
      in (without contention from other -cc1 commands).  Since PCMs are read
      from disk repeatedly while invalidating, building, and importing, the
      lock is not released quickly.  Furthermore, the LockFileManager is not
      robust in every environment.  Other -cc1 commands can stall until
      timeout (after about eight minutes).
      
      This commit changes the lock file from being necessary for correctness
      to a (possibly dubious) performance hack.  The remaining benefit is to
      reduce duplicate work in competing -cc1 commands which depend on the
      same module.  Follow-up commits will change the internal build system to
      continue after a timeout, and reduce the timeout.  Perhaps we should
      reconsider blocking at all.
      
      This also fixes a use-after-free, when one part of a compilation
      validates a PCM and starts using it, and another tries to swap out the
      PCM for something new.
      
      The PCMCache is a new type called MemoryBufferCache, which saves memory
      buffers based on their filename.  Its ownership is shared by the
      CompilerInstance and ModuleManager.
      
      - The ModuleManager stores PCMs there that it loads from disk, never
      touching the disk if the cache is hot.
      
      - When modules fail to validate, they're removed from the cache.
      
      - When a CompilerInstance is spawned to build a new module, each
      already-loaded PCM is assumed to be valid, and is frozen to avoid
      the use-after-free.
      
      - Any newly-built module is written directly to the cache to avoid the
      round-trip to the filesystem, making lock files unnecessary for
      correctness.
      
      Original patch by Manman Ren; most testcases by Adrian Prantl!
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298278 91177308-0d34-0410-b5e6-96231b3b80d8
      2bf5f686
  3. Mar 18, 2017
  4. Mar 17, 2017
    • Duncan P. N. Exon Smith's avatar
      Modules: Cache PCMs in memory and avoid a use-after-free · 4c3cdee2
      Duncan P. N. Exon Smith authored
      Clang's internal build system for implicit modules uses lock files to
      ensure that after a process writes a PCM it will read the same one back
      in (without contention from other -cc1 commands).  Since PCMs are read
      from disk repeatedly while invalidating, building, and importing, the
      lock is not released quickly.  Furthermore, the LockFileManager is not
      robust in every environment.  Other -cc1 commands can stall until
      timeout (after about eight minutes).
      
      This commit changes the lock file from being necessary for correctness
      to a (possibly dubious) performance hack.  The remaining benefit is to
      reduce duplicate work in competing -cc1 commands which depend on the
      same module.  Follow-up commits will change the internal build system to
      continue after a timeout, and reduce the timeout.  Perhaps we should
      reconsider blocking at all.
      
      This also fixes a use-after-free, when one part of a compilation
      validates a PCM and starts using it, and another tries to swap out the
      PCM for something new.
      
      The PCMCache is a new type called MemoryBufferCache, which saves memory
      buffers based on their filename.  Its ownership is shared by the
      CompilerInstance and ModuleManager.
      
        - The ModuleManager stores PCMs there that it loads from disk, never
          touching the disk if the cache is hot.
      
        - When modules fail to validate, they're removed from the cache.
      
        - When a CompilerInstance is spawned to build a new module, each
          already-loaded PCM is assumed to be valid, and is frozen to avoid
          the use-after-free.
      
        - Any newly-built module is written directly to the cache to avoid the
          round-trip to the filesystem, making lock files unnecessary for
          correctness.
      
      Original patch by Manman Ren; most testcases by Adrian Prantl!
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@298165 91177308-0d34-0410-b5e6-96231b3b80d8
      4c3cdee2
  5. Mar 16, 2017
  6. Mar 15, 2017
  7. Mar 14, 2017
  8. Mar 13, 2017
  9. Mar 11, 2017
  10. Mar 10, 2017
  11. Mar 08, 2017
  12. Mar 07, 2017
  13. Mar 06, 2017
  14. Mar 02, 2017
    • Krasimir Georgiev's avatar
      [clang-format] Use number of unwrapped lines for short namespace · 77b000e5
      Krasimir Georgiev authored
      Summary:
      This patch makes the namespace comment fixer use the number of unwrapped lines
      that a namespace spans to detect it that namespace is short, thus not needing
      end comments to be added.
      This is needed to ensure clang-format is idempotent. Previously, a short namespace
      was detected by the original source code lines. This has the effect of requiring two
      runs for this example:
      ```
      namespace { class A; }
      ```
      after first run:
      ```
      namespace {
      class A;
      }
      ```
      after second run:
      ```
      namespace {
      class A;
      } // namespace
      ```
      
      Reviewers: djasper
      
      Reviewed By: djasper
      
      Subscribers: cfe-commits, klimek
      
      Differential Revision: https://reviews.llvm.org/D30528
      
      git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@296736 91177308-0d34-0410-b5e6-96231b3b80d8
      77b000e5
  15. Mar 01, 2017
  16. Feb 28, 2017
  17. Feb 27, 2017
Loading