[cfe-commits] r98754 - in /cfe/trunk/include/clang/AST: ASTContext.h Stmt.h

Douglas Gregor dgregor at apple.com
Wed Mar 17 11:46:59 PDT 2010


Author: dgregor
Date: Wed Mar 17 13:46:59 2010
New Revision: 98754

URL: http://llvm.org/viewvc/llvm-project?rev=98754&view=rev
Log:
Reduce the default alignment for ASTContext and Stmt/Expr allocation
from 16 bytes to 8 bytes, since we don't ever use those low 4
bits. Should save some storage.

Modified:
    cfe/trunk/include/clang/AST/ASTContext.h
    cfe/trunk/include/clang/AST/Stmt.h

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=98754&r1=98753&r2=98754&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Wed Mar 17 13:46:59 2010
@@ -1317,10 +1317,10 @@
 /// this ever changes, this operator will have to be changed, too.)
 /// Usage looks like this (assuming there's an ASTContext 'Context' in scope):
 /// @code
-/// // Default alignment (16)
+/// // Default alignment (8)
 /// IntegerLiteral *Ex = new (Context) IntegerLiteral(arguments);
 /// // Specific alignment
-/// IntegerLiteral *Ex2 = new (Context, 8) IntegerLiteral(arguments);
+/// IntegerLiteral *Ex2 = new (Context, 4) IntegerLiteral(arguments);
 /// @endcode
 /// Please note that you cannot use delete on the pointer; it must be
 /// deallocated using an explicit destructor call followed by
@@ -1351,10 +1351,10 @@
 /// null on error.
 /// Usage looks like this (assuming there's an ASTContext 'Context' in scope):
 /// @code
-/// // Default alignment (16)
+/// // Default alignment (8)
 /// char *data = new (Context) char[10];
 /// // Specific alignment
-/// char *data = new (Context, 8) char[10];
+/// char *data = new (Context, 4) char[10];
 /// @endcode
 /// Please note that you cannot use delete on the pointer; it must be
 /// deallocated using an explicit destructor call followed by
@@ -1366,7 +1366,7 @@
 ///                  allocator supports it).
 /// @return The allocated memory. Could be NULL.
 inline void *operator new[](size_t Bytes, clang::ASTContext& C,
-                            size_t Alignment = 16) throw () {
+                            size_t Alignment = 8) throw () {
   return C.Allocate(Bytes, Alignment);
 }
 

Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=98754&r1=98753&r2=98754&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Wed Mar 17 13:46:59 2010
@@ -126,12 +126,12 @@
   // Only allow allocation of Stmts using the allocator in ASTContext
   // or by doing a placement new.
   void* operator new(size_t bytes, ASTContext& C,
-                     unsigned alignment = 16) throw() {
+                     unsigned alignment = 8) throw() {
     return ::operator new(bytes, C, alignment);
   }
 
   void* operator new(size_t bytes, ASTContext* C,
-                     unsigned alignment = 16) throw() {
+                     unsigned alignment = 8) throw() {
     return ::operator new(bytes, *C, alignment);
   }
 





More information about the cfe-commits mailing list