tamarin-uninline-fixedmalloc
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 149 13eaa3adde4be1d470346a98e7cc7ab6b2ada1c8
permissions -rw-r--r--
State as of now

diff -r 9595bc5a6fe1 js/tamarin/MMgc/FixedMalloc.cpp
--- a/js/tamarin/MMgc/FixedMalloc.cpp	Wed Jul 02 13:40:02 2008 -0700
+++ b/js/tamarin/MMgc/FixedMalloc.cpp	Wed Jul 02 13:40:28 2008 -0700
@@ -123,6 +123,41 @@ namespace MMgc
 		GCAssert(instance != NULL);
 		delete instance;
 		instance = NULL;
+	}
+
+	void* FixedMalloc::Alloc(size_t size)
+	{
+		void *item;
+		GCAssert(size + 3 > size);
+		// overflow detection
+		if(size+3 < size)
+			return NULL;
+		size = (size+3)&~3;
+		if (size <= (size_t)kLargestAlloc) {
+			item = FindSizeClass(size)->Alloc(size);
+		} else {
+			item = LargeAlloc(size);
+		}
+		VALGRIND_MEMPOOL_ALLOC(this, item, size);
+		VALGRIND_CHECK_MEM_IS_DEFINED(item, size);
+		fprintf(stderr, "FixedMalloc::Alloc = %p\n", item);
+		return item;
+	}
+		
+	void FixedMalloc::Free(void *item)
+	{
+		if(item == 0)
+			return;
+
+		VALGRIND_MEMPOOL_FREE(this, item);
+		
+		// small things are never allocated on the 4K boundary b/c the block
+		// header structure is stored there, large things always are		
+		if(IsLargeAlloc(item)) {
+			LargeFree(item);
+		} else {		
+			FixedAllocSafe::GetFixedAllocSafe(item)->Free(item);
+		}
 	}
 
 	FixedMalloc::FixedMalloc(GCHeap* heap)
diff -r 9595bc5a6fe1 js/tamarin/MMgc/FixedMalloc.h
--- a/js/tamarin/MMgc/FixedMalloc.h	Wed Jul 02 13:40:02 2008 -0700
+++ b/js/tamarin/MMgc/FixedMalloc.h	Wed Jul 02 13:40:28 2008 -0700
@@ -63,40 +63,8 @@ namespace MMgc
 			return instance;
 		}
 
-		inline void* Alloc(size_t size)
-		{
-			void *item;
-			GCAssert(size + 3 > size);
-			// overflow detection
-			if(size+3 < size)
-				return NULL;
-			size = (size+3)&~3;
-			if (size <= (size_t)kLargestAlloc) {
-				item = FindSizeClass(size)->Alloc(size);
-			} else {
-				item = LargeAlloc(size);
-			}
-                        VALGRIND_MEMPOOL_ALLOC(this, item, size);
-			VALGRIND_CHECK_MEM_IS_DEFINED(item, size);
-			fprintf(stderr, "FixedMalloc::Alloc = %p\n", item);
-			return item;
-		}
-
-		inline void Free(void *item)
-		{
-			if(item == 0)
-				return;
-
-			VALGRIND_MEMPOOL_FREE(this, item);
-
-			// small things are never allocated on the 4K boundary b/c the block
-			// header structure is stored there, large things always are		
-			if(IsLargeAlloc(item)) {
-				LargeFree(item);
-			} else {		
-				FixedAllocSafe::GetFixedAllocSafe(item)->Free(item);
-			}
-		}
+		void* Alloc(size_t size);
+		void Free(void *item);
 
 		size_t Size(const void *item)
 		{