]> granicus.if.org Git - clang/commitdiff
Reduce the default alignment for ASTContext and Stmt/Expr allocation
authorDouglas Gregor <dgregor@apple.com>
Wed, 17 Mar 2010 18:46:59 +0000 (18:46 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 17 Mar 2010 18:46:59 +0000 (18:46 +0000)
from 16 bytes to 8 bytes, since we don't ever use those low 4
bits. Should save some storage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98754 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/ASTContext.h
include/clang/AST/Stmt.h

index efd70badc9c7a519ad0a5927de161def9aff754b..78b808c1443f0a350fac9ac868815f151946c3fa 100644 (file)
@@ -1317,10 +1317,10 @@ static inline Selector GetUnarySelector(const char* name, ASTContext& Ctx) {
 /// 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 @@ inline void operator delete(void *Ptr, clang::ASTContext &C, size_t)
 /// 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 @@ inline void operator delete(void *Ptr, clang::ASTContext &C, size_t)
 ///                  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);
 }
 
index 94caa6faad660e8086daa35d481448e345edb521..466848976cb3928ea603f411cb16c87af6bc23d2 100644 (file)
@@ -126,12 +126,12 @@ public:
   // 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);
   }