Skip to content
  1. Jan 26, 2009
  2. Jan 24, 2009
  3. Jan 23, 2009
    • Ted Kremenek's avatar
      Added virtual method DiagnosticClient::IncludeInDiagnosticCounts(). This is... · ea06ec1c
      Ted Kremenek authored
      Added virtual method DiagnosticClient::IncludeInDiagnosticCounts().  This is used by Diagnostics to determine if a diagnostic sent to a given DiagnosticClient should be included in the count of diagnostics.  The default implementation of this method returns 'true'.
      
      Implemented DiagCollector::IncludeInDiagnosticCounts() to return 'false' so that the batching of diagnostics for use with BugReporter doesn't mess up the count of real diagnostics.
      
      llvm-svn: 62873
      ea06ec1c
  4. Jan 21, 2009
    • Chris Lattner's avatar
      Add a bit to IdentifierInfo that acts as a simple predicate which · ad89ec01
      Chris Lattner authored
      tells us whether Preprocessor::HandleIdentifier needs to be called.
      Because this method is only rarely needed, this saves a call and a
      bunch of random checks.  This drops the time in HandleIdentifier 
      from 3.52ms to .98ms on cocoa.h on my machine.
      
      llvm-svn: 62675
      ad89ec01
    • Ted Kremenek's avatar
      Fix: <rdar://problem/6510344> [pth] PTH slows down regular lexer considerably... · 52f73cad
      Ted Kremenek authored
      Fix: <rdar://problem/6510344> [pth] PTH slows down regular lexer considerably (when it has substantial work)
      
      Changes to IdentifierTable:
      - High-level summary: StringMap never owns IdentifierInfos.  It just
      references them.
      - The string map now has StringMapEntry<IdentifierInfo*> instead of
        StringMapEntry<IdentifierInfo>.  The IdentifierInfo object is
        allocated using the same bump pointer allocator as used by the
        StringMap.
      
      Changes to IdentifierInfo:
      - Added an extra pointer to point to the
        StringMapEntry<IdentifierInfo*> in the string map.  This pointer
        will be null if the IdentifierInfo* is *only* used by the PTHLexer
        (that is it isn't in the StringMap).
      
      Algorithmic changes:
      - Non-PTH case:
         IdentifierInfo::get() will always consult the StringMap first to
         see if we have an IdentifierInfo object.  If that StringMapEntry
         references a null pointer, we allocate a new one from the BumpPtrAllocator
         and update the reference in the StringMapEntry.
      - PTH case:
         We do the same lookup as with the non-PTH case, but if we don't get
         a hit in the StringMap we do a secondary lookup in the PTHManager for
         the IdentifierInfo.  If we don't find an IdentifierInfo we create a
         new one as in the non-PTH case.  If we do find and IdentifierInfo
         in the PTHManager, we update the StringMapEntry to refer to it so
         that the IdentifierInfo will be found on the next StringMap lookup.
         This way we only do a binary search in the PTH file at most once
         for a given IdentifierInfo.  This greatly speeds things up for source
         files containing a non-trivial amount of code.
      
      Performance impact:
         While these changes do add some extra indirection in
         IdentifierTable to access an IdentifierInfo*, I saw speedups even
         in the non-PTH case as well.
      
         Non-PTH: For -fsyntax-only on Cocoa.h, we see a 6% speedup.
         PTH (with Cocoa.h in token cache): 11% speedup.
      
         I also did an experiment where we did -fsyntax-only on a source file
         including a large header and Cocoa.h, but the token cache did not
         contain the larger header.  For this file, we were seeing a performance
         *regression* when using PTH of 3% over non-PTH.  Now we are seeing
         a performance improvement of 9%!
      
      Tests:
         The serialization tests are now failing.  I looked at this extensively,
         and I my belief is that this change is unmasking a bug rather than
         introducing a new one.  I have disabled the serialization tests for now.
      
      llvm-svn: 62636
      52f73cad
  5. Jan 19, 2009
  6. Jan 18, 2009
  7. Jan 17, 2009
  8. Jan 16, 2009
  9. Jan 15, 2009
    • Ted Kremenek's avatar
      IdentifierInfo: · a705b04d
      Ted Kremenek authored
      - IdentifierInfo can now (optionally) have its string data not be
        co-located with itself.  This is for use with PTH.  This aspect is a
        little gross, as getName() and getLength() now make assumptions
        about a possible alternate representation of IdentifierInfo.
        Perhaps we should make IdentifierInfo have virtual methods?
      
      IdentifierTable:
      - Added class "IdentifierInfoLookup" that can be used by
        IdentifierTable to perform "string -> IdentifierInfo" lookups using
        an auxilliary data structure.  This is used by PTH.
      - Perform tests show that IdentifierTable::get() does not slow down
        because of the extra check for the IdentiferInfoLookup object (the
        regular StringMap lookup does enough work to mitigate the impact of
        an extra null pointer check).
      - The upshot is that now that some IdentifierInfo objects might be
        owned by the IdentiferInfoLookup object.  This should be reviewed.
      
      PTH:
      - Modified PTHManager::GetIdentifierInfo to *not* insert entries in
        IdentifierTable's string map, and instead create IdentifierInfo
        objects on the fly when mapping from persistent IDs to
        IdentifierInfos.  This saves a ton of work with string copies,
        hashing, and StringMap lookup and resizing.  This change was
        motivated because when processing source files in the PTH cache we
        don't need to do any string -> IdentifierInfo lookups.
      - PTHManager now subclasses IdentifierInfoLookup, allowing clients of
        IdentifierTable to transparently use IdentifierInfo objects managed
        by the PTH file.  PTHManager resolves "string -> IdentifierInfo"
        queries by doing a binary search over a sorted table of identifier
        strings in the PTH file (the exact algorithm we use can be changed
        as needed).
      
      These changes lead to the following performance changes when using PTH on Cocoa.h:
      - fsyntax-only: 10% performance improvement
      - Eonly: 30% performance improvement
      
      llvm-svn: 62273
      a705b04d
  10. Jan 12, 2009
  11. Jan 06, 2009
    • Ted Kremenek's avatar
      SourceManager: Implement "lazy" creation of MemBuffers for source files. · 763ea559
      Ted Kremenek authored
      - Big Idea:
         Source files are now mmaped when ContentCache::getBuffer() is first called.
         While this doesn't change the functionality when lexing regular source files,
         it can result in source files not being paged in when using PTH.
      
      - Performance change:
        - No observable difference (-fsyntax-only/-Eonly) on Cocoa.h when doing
          regular source lexing.
        - No observable time difference (-fsyntax-only/-Eonly) on Cocoa.h when using
          PTH. We do observe, however, a reduction of 279K in memory mapped source
          code (3% reduction). The majority of pages from Cocoa.h (and friends) are
          still being pulled in, however, because any literal will cause
          Preprocessor::getSpelling() to be called (causing the source for the file to
          get pulled in). The next possible optimization is to cache literal strings
          in the PTH file to avoid the need for the original header sources entirely.
      
      - Right now there is a preprocessor directive to toggle between "lazy" and
        "eager" creation of MemBuffers. This is not permanent, and is there in the
        short term to just test additional optimizations.
      
      llvm-svn: 61827
      763ea559
    • Ted Kremenek's avatar
      Misc changes to SourceManager::ContentCache: · 12c2af44
      Ted Kremenek authored
      - 'Buffer' is now private and must be accessed via 'getBuffer()'.
         This paves the way for lazily mapping in source files on demand.
      - Added 'getSize()' (which gets the size of the content without
         necessarily accessing the MemBuffer) and 'getSizeBytesMapped()'.
      - Modifed SourceManager to use these new methods.  This reduces the
        number of places that actually access the MemBuffer object for a file
        to those that actually look at the character data.
      
      These changes result in no performance change for -fsyntax-only on Cocoa.h.
      
      llvm-svn: 61782
      12c2af44
  12. Dec 05, 2008
  13. Dec 04, 2008
  14. Nov 27, 2008
  15. Nov 24, 2008
    • Chris Lattner's avatar
      Rename Selector::getName() to Selector::getAsString(), and add · e4b95698
      Chris Lattner authored
      a new NamedDecl::getAsString() method.
      
      Change uses of Selector::getName() to just pass in a Selector 
      where possible (e.g. to diagnostics) instead of going through
      an std::string.
      
      This also adds new formatters for objcinstance and objcclass
      as described in the dox.
      
      llvm-svn: 59933
      e4b95698
  16. Nov 23, 2008
    • Chris Lattner's avatar
      Convert IdentifierInfo's to be printed the same as DeclarationNames · e3d20d95
      Chris Lattner authored
      with implicit quotes around them.  This has a bunch of follow-on 
      effects and requires tweaking to a whole lot of code.  This causes
      a regression in two tests (xfailed) by causing it to emit things like:
      
        Line 10: duplicate interface declaration for category 'MyClass1' ('Category1')
      
      instead of:
      
        Line 10: duplicate interface declaration for category 'MyClass1(Category1)'
      
      I will fix this in a follow-up commit.
      
      As part of this, I had to start switching stuff to use ->getDeclName() instead
      of Decl::getName() for consistency.  This is good, but I was planning to do this
      as an independent patch.  There will be several follow-on patches
      to clean up some of the mess, but this patch is already too big.
      
      llvm-svn: 59917
      e3d20d95
    • Chris Lattner's avatar
      add support for inserting a DeclarationName into a diagnostic directly · f7e69d5a
      Chris Lattner authored
      without calling getAsString().  This implicitly puts quotes around the
      name, so diagnostics need to be tweaked to accommodate this.
      
      llvm-svn: 59916
      f7e69d5a
    • Chris Lattner's avatar
      Genericize the qualtype formating callback to support any diag argument. · 63ecc509
      Chris Lattner authored
      No functionality change.
      
      llvm-svn: 59908
      63ecc509
Loading