[llvm-commits] [llvm] r50409 - /llvm/branches/Apple/Tak/lib/Support/Allocator.cpp
Bill Wendling
isanbard at gmail.com
Tue Apr 29 00:25:52 PDT 2008
Author: void
Date: Tue Apr 29 02:25:52 2008
New Revision: 50409
URL: http://llvm.org/viewvc/llvm-project?rev=50409&view=rev
Log:
Reverted r50374. It shouldn't have gone into Tak.
Modified:
llvm/branches/Apple/Tak/lib/Support/Allocator.cpp
Modified: llvm/branches/Apple/Tak/lib/Support/Allocator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Tak/lib/Support/Allocator.cpp?rev=50409&r1=50408&r2=50409&view=diff
==============================================================================
--- llvm/branches/Apple/Tak/lib/Support/Allocator.cpp (original)
+++ llvm/branches/Apple/Tak/lib/Support/Allocator.cpp Tue Apr 29 02:25:52 2008
@@ -46,16 +46,13 @@
/// Allocate - Allocate and return at least the specified number of bytes.
///
void *Allocate(unsigned AllocSize, unsigned Alignment, MemRegion **RegPtr) {
+ // Round size up to an even multiple of the alignment.
+ AllocSize = (AllocSize+Alignment-1) & ~(Alignment-1);
- char* Result = (char*) (((uintptr_t) (NextPtr+Alignment-1))
- & ~((uintptr_t) Alignment-1));
-
- // Speculate the new value of NextPtr.
- char* NextPtrTmp = Result + AllocSize;
-
- // If we are still within the current region, return Result.
- if (unsigned (NextPtrTmp - (char*) this) <= RegionSize) {
- NextPtr = NextPtrTmp;
+ // If there is space in this region, return it.
+ if (unsigned(NextPtr+AllocSize-(char*)this) <= RegionSize) {
+ void *Result = NextPtr;
+ NextPtr += AllocSize;
return Result;
}
More information about the llvm-commits
mailing list