From f4e689b8528770001f4792f1f4ebdfb09d859e3d Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 17 Mar 2010 18:46:59 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98754 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/ASTContext.h | 10 +++++----- include/clang/AST/Stmt.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index efd70badc9..78b808c144 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -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); } diff --git a/include/clang/AST/Stmt.h b/include/clang/AST/Stmt.h index 94caa6faad..466848976c 100644 --- a/include/clang/AST/Stmt.h +++ b/include/clang/AST/Stmt.h @@ -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); } -- 2.40.0