[cfe-commits] r43975 - /cfe/trunk/Basic/IdentifierTable.cpp

Ted Kremenek kremenek at apple.com
Fri Nov 9 18:11:55 PST 2007


Author: kremenek
Date: Fri Nov  9 20:11:55 2007
New Revision: 43975

URL: http://llvm.org/viewvc/llvm-project?rev=43975&view=rev
Log:
Changed the serialization of IdentifierTable to only serialize out entries
that are referenced in the ASTs. This assumes that we serialize out the
decls/stmts first, and use the pointer-tracking logic in the Serializer to
determine if an IdentifierInfo (or its string key) is ever referenced.

This is a significant space optimization for serialized ASTs.

Consider the following program:

void foo(int x,int y) {
  return x > y ? x : y+1;
}

Here are the sizes of the files for the serialized ASTs:

        Full IdentifierTable: 23676 bytes
 Only-referenced Identifiers:   304 bytes.

For this simple program, this is a 77% reduction in the file size of the
serialized ASTs.

Modified:
    cfe/trunk/Basic/IdentifierTable.cpp

Modified: cfe/trunk/Basic/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Basic/IdentifierTable.cpp?rev=43975&r1=43974&r2=43975&view=diff

==============================================================================
--- cfe/trunk/Basic/IdentifierTable.cpp (original)
+++ cfe/trunk/Basic/IdentifierTable.cpp Fri Nov  9 20:11:55 2007
@@ -415,8 +415,8 @@
     const char* Key = I->getKeyData();
     const IdentifierInfo* Info = &I->getValue();
     
-    bool KeyRegistered = true; // FIXME: S.isRegistered(Key);
-    bool InfoRegistered = true; // FIXME: S.isRegistered(Info);
+    bool KeyRegistered = S.isRegistered(Key);
+    bool InfoRegistered = S.isRegistered(Info);
     
     if (KeyRegistered || InfoRegistered) {
       // These acrobatics are so that we don't incur the cost of registering





More information about the cfe-commits mailing list