|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49278 - in sandbox/memory: boost boost/memory boost/memory/future libs/memory/bin/li32 libs/memory/build libs/memory/src
From: xushiweizh_at_[hidden]
Date: 2008-10-11 09:39:17
Author: xushiwei
Date: 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
New Revision: 49278
URL: http://svn.boost.org/trac/boost/changeset/49278
Log:
boost memory refactor
Added:
sandbox/memory/boost/memory/future/gc_alloc.hpp
- copied, changed from r49000, /sandbox/memory/boost/memory/gc_alloc.hpp
sandbox/memory/boost/memory/future/simple_alloc.hpp (contents, props changed)
sandbox/memory/boost/memory/future/tls_gc_alloc.hpp
- copied, changed from r49000, /sandbox/memory/boost/memory/tls_gc_alloc.hpp
sandbox/memory/boost/memory/type_traits.hpp (contents, props changed)
Removed:
sandbox/memory/boost/memory/gc_alloc.hpp
sandbox/memory/boost/memory/policy.hpp
sandbox/memory/boost/memory/system_pool.hpp
sandbox/memory/boost/memory/tls_gc_alloc.hpp
sandbox/memory/libs/memory/src/system_pool.cpp
Binary files modified:
sandbox/memory/libs/memory/bin/li32/libboost-memory.so
Text files modified:
sandbox/memory/boost/memory.hpp | 13 -
sandbox/memory/boost/memory/auto_alloc.hpp | 32 ++---
sandbox/memory/boost/memory/basic.hpp | 228 ++++-----------------------------------
sandbox/memory/boost/memory/future/gc_alloc.hpp | 78 ++++++++----
sandbox/memory/boost/memory/future/tls_gc_alloc.hpp | 30 ++---
sandbox/memory/boost/memory/scoped_alloc.hpp | 45 +++----
sandbox/memory/boost/memory/system_alloc.hpp | 132 +++++-----------------
sandbox/memory/libs/memory/build/Makefile.li32 | 16 --
sandbox/memory/libs/memory/build/Makefile.li64 | 16 --
sandbox/memory/libs/memory/build/_export_.def | 3
sandbox/memory/libs/memory/build/build.def | 4
sandbox/memory/libs/memory/build/build.prj | 2
sandbox/memory/libs/memory/build/vc8-win32.vcproj | 10 -
sandbox/memory/libs/memory/build/vc8-win64.vcproj | 10 -
14 files changed, 168 insertions(+), 451 deletions(-)
Modified: sandbox/memory/boost/memory.hpp
==============================================================================
--- sandbox/memory/boost/memory.hpp (original)
+++ sandbox/memory/boost/memory.hpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -40,14 +40,6 @@
#include "memory/scoped_alloc.hpp"
#endif
-#ifndef BOOST_MEMORY_GC_ALLOC_HPP
-#include "memory/gc_alloc.hpp"
-#endif
-
-#ifndef BOOST_MEMORY_TLS_GC_ALLOC_HPP
-#include "memory/tls_gc_alloc.hpp"
-#endif
-
// -------------------------------------------------------------------------
// function swap_object
@@ -172,7 +164,7 @@
}
};
-#if !defined(BOOST_MEMORY_NO_PARTIAL_SPECIAILIZATION)
+#if !defined(BOOST_MEMORY_NO_PARTIAL_SPECIALIZATION)
template <class AllocT>
class stl_allocator<void, AllocT>
@@ -258,10 +250,9 @@
{
using NS_BOOST_MEMORY::auto_alloc;
using NS_BOOST_MEMORY::scoped_alloc;
- using NS_BOOST_MEMORY::gc_alloc;
using NS_BOOST_MEMORY::stl_allocator;
-
+
using NS_BOOST_MEMORY::enableMemoryLeakCheck;
}
Modified: sandbox/memory/boost/memory/auto_alloc.hpp
==============================================================================
--- sandbox/memory/boost/memory/auto_alloc.hpp (original)
+++ sandbox/memory/boost/memory/auto_alloc.hpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -16,8 +16,8 @@
#include "system_alloc.hpp"
#endif
-#ifndef BOOST_MEMORY_POLICY_HPP
-#include "policy.hpp"
+#if !defined(_GLIBCXX_ALGORITHM) && !defined(_ALGORITHM)
+#include <algorithm>
#endif
NS_BOOST_MEMORY_BEGIN
@@ -29,13 +29,13 @@
class region_alloc
{
private:
- typedef typename PolicyT::allocator_type AllocT;
+ typedef typename PolicyT::alloc_type AllocT;
public:
- enum { MemBlockSize = PolicyT::MemBlockSize };
- enum { IsGCAllocator = TRUE };
+ enum { MemBlockSize = PolicyT::MemBlockBytes - AllocT::Padding };
+ enum { IsGCAllocator = 1 };
- typedef AllocT allocator_type;
+ typedef AllocT alloc_type;
private:
enum { HeaderSize = sizeof(void*) };
@@ -164,6 +164,7 @@
return _do_allocate(cb);
}
+#if defined(BOOST_MEMORY_NO_STRICT_EXCEPTION_SEMANTICS)
__forceinline void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero)
{
return allocate(cb);
@@ -177,7 +178,8 @@
m_destroyChain = pNode;
return pNode + 1;
}
-
+#endif
+
__forceinline void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cb, destructor_t fn)
{
DestroyNode* pNode = (DestroyNode*)allocate(sizeof(DestroyNode) + cb);
@@ -185,14 +187,13 @@
return pNode + 1;
}
- __forceinline void* BOOST_MEMORY_CALL manage(void* p, destructor_t fn)
+ __forceinline void BOOST_MEMORY_CALL manage(void* p, destructor_t fn)
{
DestroyNode* pNode = (DestroyNode*)p - 1;
BOOST_MEMORY_ASSERT(pNode->fnDestroy == fn);
pNode->pPrev = m_destroyChain;
m_destroyChain = pNode;
- return p;
}
__forceinline void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cb, int fnZero)
@@ -200,9 +201,9 @@
return allocate(cb);
}
- __forceinline void* BOOST_MEMORY_CALL manage(void* p, int fnZero)
+ __forceinline void BOOST_MEMORY_CALL manage(void* p, int fnZero)
{
- return p;
+ // no action
}
void* BOOST_MEMORY_CALL reallocate(void* p, size_t oldSize, size_t newSize)
@@ -226,19 +227,10 @@
}
template <class Type>
- Type* BOOST_MEMORY_CALL newArray(size_t count, Type* zero)
- {
- Type* array = (Type*)destructor_traits<Type>::allocArray(*this, count);
- return constructor_traits<Type>::constructArray(array, count);
- }
-
- template <class Type>
void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count)
{
// no action
}
-
- BOOST_MEMORY_FAKE_DBG_ALLOCATE_();
};
// -------------------------------------------------------------------------
Modified: sandbox/memory/boost/memory/basic.hpp
==============================================================================
--- sandbox/memory/boost/memory/basic.hpp (original)
+++ sandbox/memory/boost/memory/basic.hpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -58,11 +58,19 @@
// -------------------------------------------------------------------------
-#if defined(BOOST_NO_PARTIAL_SPECIAILIZATION)
- #define BOOST_MEMORY_NO_PARTIAL_SPECIAILIZATION
+#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
+ #define BOOST_MEMORY_NO_PARTIAL_SPECIALIZATION
#elif defined(_MSC_VER)
#if (_MSC_VER <= 1200)
- #define BOOST_MEMORY_NO_PARTIAL_SPECIAILIZATION
+ #define BOOST_MEMORY_NO_PARTIAL_SPECIALIZATION
+ #endif
+#endif
+
+#if defined(BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS)
+ #define BOOST_MEMORY_NO_FUNCTION_TYPE_SPECIALIZATIONS
+#elif defined(_MSC_VER)
+ #if (_MSC_VER <= 1200)
+ #define BOOST_MEMORY_NO_FUNCTION_TYPE_SPECIALIZATIONS
#endif
#endif
@@ -78,183 +86,11 @@
#endif
// =========================================================================
-// Configurations
-
-#ifndef BOOST_MEMORY_ALLOC_PADDING
-#define BOOST_MEMORY_ALLOC_PADDING 32
-#endif
-
-#ifndef BOOST_MEMORY_BLOCK_TOTAL
-#define BOOST_MEMORY_BLOCK_TOTAL 16384 // 16k
-#endif
-
-#ifndef BOOST_MEMORY_BLOCK_SIZE
-#define BOOST_MEMORY_BLOCK_SIZE (BOOST_MEMORY_BLOCK_TOTAL - BOOST_MEMORY_ALLOC_PADDING)
-#endif
-
-// =========================================================================
// constructor_traits, destructor_traits
-NS_BOOST_MEMORY_BEGIN
-
-typedef void BOOST_MEMORY_CALL BOOST_FnDestructor(void* data);
-typedef BOOST_FnDestructor* destructor_t;
-
-template <class Type>
-struct constructor_traits
-{
- static Type* BOOST_MEMORY_CALL construct(void* data)
- {
- return new(data) Type;
- }
-
- static Type* BOOST_MEMORY_CALL constructArray(Type* array, size_t count)
- {
- for (size_t i = 0; i < count; ++i)
- new(array + i) Type;
- return array;
- }
-};
-
-template <class Type>
-struct destructor_traits
-{
- enum { HasDestructor = 1 };
-
- typedef destructor_t destructor_type;
-
- struct array_destructor_header
- {
- size_t count;
- };
-
- static void BOOST_MEMORY_CALL destruct(void* data)
- {
- ((Type*)data)->~Type();
- }
-
- static void BOOST_MEMORY_CALL destructArrayN(Type* array, size_t count)
- {
- for (size_t i = 0; i < count; ++i)
- array[i].~Type();
- }
-
- static void BOOST_MEMORY_CALL destructArray(void* data)
- {
- array_destructor_header* hdr = (array_destructor_header*)data;
- destructArrayN((Type*)(hdr + 1), hdr->count);
- }
-
- static size_t BOOST_MEMORY_CALL getArrayAllocSize(size_t count)
- {
- return sizeof(array_destructor_header) + sizeof(Type)*count;
- }
-
- template <class AllocT>
- static void* BOOST_MEMORY_CALL allocArray(AllocT& alloc, size_t count)
- {
- array_destructor_header* hdr =
- (array_destructor_header*)alloc.allocate(
- sizeof(array_destructor_header)+sizeof(Type)*count, destructArray);
- hdr->count = count;
- return hdr + 1;
- }
-
- static char* BOOST_MEMORY_CALL getArrayBuffer(void* array)
- {
- return (char*)array - sizeof(array_destructor_header);
- }
-
- static size_t BOOST_MEMORY_CALL getArraySize(void* array)
- {
- return ((array_destructor_header*)array - 1)->count;
- }
-};
-
-template <class Type>
-inline void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count)
-{
- destructor_traits<Type>::destructArrayN(array, count);
-}
-
-NS_BOOST_MEMORY_END
-
-// =========================================================================
-// BOOST_MEMORY_NO_DESTRUCTOR
-
-#define BOOST_MEMORY_NO_DESTRUCTOR(Type) \
-NS_BOOST_MEMORY_BEGIN \
-template <> \
-struct destructor_traits< Type > \
-{ \
- enum { HasDestructor = 0 }; \
- \
- typedef int destructor_type; \
- \
- enum { destruct = 0 }; \
- enum { destructArray = 0 }; \
- \
- static void BOOST_MEMORY_CALL destructArrayN(Type* array, size_t count) {} \
- \
- static size_t BOOST_MEMORY_CALL getArrayAllocSize(size_t count) { \
- return sizeof(Type)*count; \
- } \
- \
- template <class AllocT> \
- static void* BOOST_MEMORY_CALL allocArray(AllocT& alloc, size_t count) {\
- return alloc.allocate(sizeof(Type)*count); \
- } \
- \
- static char* BOOST_MEMORY_CALL getArrayBuffer(void* array) { \
- return (char*)array; \
- } \
- \
- static size_t BOOST_MEMORY_CALL getArraySize(void* array) { \
- BOOST_MEMORY_ASSERT( !"Don't call me!!!" ); \
- return 0; \
- } \
-}; \
-NS_BOOST_MEMORY_END
-
-// -------------------------------------------------------------------------
-// BOOST_MEMORY_NO_CONSTRUCTOR
-
-#define BOOST_MEMORY_NO_CONSTRUCTOR(Type) \
-NS_BOOST_MEMORY_BEGIN \
-template <> \
-struct constructor_traits< Type > \
-{ \
- static Type* BOOST_MEMORY_CALL construct(void* data) { \
- return (Type*)data; \
- } \
- static Type* BOOST_MEMORY_CALL constructArray(Type* array, size_t count) { \
- return array; \
- } \
-}; \
-NS_BOOST_MEMORY_END
-
-// -------------------------------------------------------------------------
-// C Standard Types Support
-
-#define BOOST_MEMORY_DECL_CTYPE(Type) \
- BOOST_MEMORY_NO_CONSTRUCTOR(Type); \
- BOOST_MEMORY_NO_DESTRUCTOR(Type)
-
-BOOST_MEMORY_DECL_CTYPE(bool);
-BOOST_MEMORY_DECL_CTYPE(float);
-BOOST_MEMORY_DECL_CTYPE(double);
-
-BOOST_MEMORY_DECL_CTYPE(int);
-BOOST_MEMORY_DECL_CTYPE(unsigned int);
-
-BOOST_MEMORY_DECL_CTYPE(char);
-BOOST_MEMORY_DECL_CTYPE(unsigned char);
-
-BOOST_MEMORY_DECL_CTYPE(short);
-BOOST_MEMORY_DECL_CTYPE(unsigned short);
-
-BOOST_MEMORY_DECL_CTYPE(long);
-BOOST_MEMORY_DECL_CTYPE(unsigned long);
+#ifndef BOOST_MEMORY_TYPE_TRAITS_HPP
+#include "type_traits.hpp"
+#endif
// =========================================================================
// NEW, NEW_ARRAY, ALLOC, ALLOC_ARRAY
@@ -283,7 +119,8 @@
template <class Type>
__forceinline Type* BOOST_MEMORY_CALL operator->*(Type* p) const
{
- return (Type*)m_alloc.manage(p, destructor_traits<Type>::destruct);
+ m_alloc.manage(p, destructor_traits<Type>::destruct);
+ return p;
}
};
@@ -302,22 +139,11 @@
NS_BOOST_MEMORY_END
-#if defined(_DEBUG)
-#define BOOST_MEMORY_FILE_LINE_ARG , __FILE__, __LINE__
-#else
-#define BOOST_MEMORY_FILE_LINE_ARG
-#endif
-
-#define BOOST_MEMORY_NEW_ARG(Type) sizeof(Type), NS_BOOST_MEMORY::destructor_traits<Type>::destruct
-#define BOOST_MEMORY_DBG_NEW_ARG(Type) BOOST_MEMORY_NEW_ARG(Type) BOOST_MEMORY_FILE_LINE_ARG
+#define BOOST_MEMORY_ALLOC(alloc, Type) ((Type*)(alloc).allocate(sizeof(Type)))
+#define BOOST_MEMORY_ALLOC_ARRAY(alloc, Type, count) ((Type*)(alloc).allocate(sizeof(Type)*(count)))
-#define BOOST_MEMORY_DBG_NEW_ARRAY_ARG(Type, count) (count), (Type*)0 BOOST_MEMORY_FILE_LINE_ARG
-#define BOOST_MEMORY_DBG_ALLOC_ARG(Type) sizeof(Type) BOOST_MEMORY_FILE_LINE_ARG
-#define BOOST_MEMORY_DBG_ALLOC_ARRAY_ARG(Type, count) sizeof(Type)*(count) BOOST_MEMORY_FILE_LINE_ARG
-
-#define BOOST_MEMORY_ALLOC(alloc, Type) ((Type*)(alloc).allocate(BOOST_MEMORY_DBG_ALLOC_ARG(Type)))
-#define BOOST_MEMORY_ALLOC_ARRAY(alloc, Type, count) ((Type*)(alloc).allocate(BOOST_MEMORY_DBG_ALLOC_ARRAY_ARG(Type, count)))
-#define BOOST_MEMORY_NEW_ARRAY(alloc, Type, count) (alloc).newArray(BOOST_MEMORY_DBG_NEW_ARRAY_ARG(Type, count))
+#define BOOST_MEMORY_NEW_ARRAY(alloc, Type, count) NS_BOOST_MEMORY::array_factory<Type>::create(alloc, count)
+#define BOOST_MEMORY_DESTRUCTOR(Type) NS_BOOST_MEMORY::destructor_traits<Type>::destruct
#if defined(BOOST_MEMORY_NO_STRICT_EXCEPTION_SEMANTICS)
//
@@ -325,21 +151,24 @@
// not strict in accord with normal C++ semantics but a bit faster
//
#define BOOST_MEMORY_NEW(alloc, Type) \
- ::new((alloc).allocate(BOOST_MEMORY_DBG_NEW_ARG(Type))) Type
+ ::new((alloc).allocate(sizeof(Type), BOOST_MEMORY_DESTRUCTOR(Type))) Type
#else
-#define BOOST_MEMORY_UNMANAGED_NEW_(alloc, Type) \
- ::new((alloc).unmanaged_alloc(BOOST_MEMORY_NEW_ARG(Type))) Type
+#define BOOST_MEMORY_UNMANAGED_ALLOC_(alloc, Type) \
+ ::new((alloc).unmanaged_alloc(sizeof(Type), BOOST_MEMORY_DESTRUCTOR(Type))) Type
#define BOOST_MEMORY_GET_MANAGED_(alloc, Type) \
- NS_BOOST_MEMORY::_get_managed(alloc, NS_BOOST_MEMORY::destructor_traits<Type>::destruct)
+ NS_BOOST_MEMORY::_get_managed(alloc, BOOST_MEMORY_DESTRUCTOR(Type))
#define BOOST_MEMORY_NEW(alloc, Type) \
- BOOST_MEMORY_GET_MANAGED_(alloc, Type) ->* BOOST_MEMORY_UNMANAGED_NEW_(alloc, Type)
+ BOOST_MEMORY_GET_MANAGED_(alloc, Type) ->* BOOST_MEMORY_UNMANAGED_ALLOC_(alloc, Type)
#endif
+#define BOOST_MEMORY_UNMANAGED_NEW(alloc, Type) \
+ ::new((alloc).allocate(sizeof(Type))) Type
+
// =========================================================================
NS_BOOST_MEMORY_BEGIN
@@ -357,4 +186,3 @@
// $Log: basic.hpp,v $
#endif /* BOOST_MEMORY_BASIC_HPP */
-
Copied: sandbox/memory/boost/memory/future/gc_alloc.hpp (from r49000, /sandbox/memory/boost/memory/gc_alloc.hpp)
==============================================================================
--- /sandbox/memory/boost/memory/gc_alloc.hpp (original)
+++ sandbox/memory/boost/memory/future/gc_alloc.hpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -20,6 +20,10 @@
#include "scoped_alloc.hpp"
#endif
+#ifndef BOOST_MEMORY_SIMPLE_ALLOC_HPP
+#include "simple_alloc.hpp"
+#endif
+
#ifndef BOOST_MEMORY_STL_QUEUE_HPP
#include "stl/queue.hpp" // NS_BOOST_MEMORY::ext_priority_queue
#endif
@@ -31,6 +35,27 @@
NS_BOOST_MEMORY_BEGIN
// -------------------------------------------------------------------------
+// Configuration
+
+NS_BOOST_MEMORY_POLICY_BEGIN
+
+class pool2 : public pool
+{
+private:
+ enum { Default = 0 };
+
+public:
+ enum { RecycleSizeMin = 256 };
+ enum { AllocSizeBig = Default };
+ enum { AllocSizeHuge = 1024*1024 };
+ enum { GCLimitSizeDef = 1024*1024 };
+
+ typedef simple_alloc<system_alloc> huge_gc_alloc;
+};
+
+NS_BOOST_MEMORY_POLICY_END
+
+// -------------------------------------------------------------------------
// class gen_alloc
#if defined(_DEBUG) && !defined(BOOST_MEMORY_TRACE_GC)
@@ -48,18 +73,18 @@
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
-
+
template <class PolicyT>
class gen_alloc
{
private:
- typedef typename PolicyT::allocator_type AllocT;
- typedef typename PolicyT::huge_gc_allocator HugeGCAllocT;
+ typedef typename PolicyT::alloc_type AllocT;
+ typedef typename PolicyT::huge_gc_alloc HugeGCAllocT;
typedef unsigned HeaderSizeT;
public:
- enum { MemBlockSize = PolicyT::MemBlockSize };
- enum { IsGCAllocator = TRUE };
+ enum { MemBlockSize = PolicyT::MemBlockBytes - AllocT::Padding };
+ enum { IsGCAllocator = 1 };
typedef AllocT allocator_type;
typedef HugeGCAllocT huge_gc_allocator;
@@ -228,17 +253,17 @@
template <class Type>
static bool BOOST_MEMORY_CALL _isValidArray(Type* array, size_t count)
{
- void* buf = destructor_traits<Type>::getArrayBuffer(array);
- size_t cb = destructor_traits<Type>::getArrayAllocSize(count);
+ void* buf = array_factory<Type>::buffer(array);
+ size_t cb = array_factory<Type>::alloc_size(count);
if (buf == array)
{
return _isValid(buf, cb, 0);
}
else
{
- size_t count1 = destructor_traits<Type>::getArraySize(array);
+ size_t count1 = array_factory<Type>::size(array);
BOOST_MEMORY_ASSERT(count1 == count);
- bool fValid = _isValid(buf, cb, destructor_traits<Type>::destructArray);
+ bool fValid = _isValid(buf, cb, array_factory<Type>::destruct);
return count1 == count && fValid;
}
}
@@ -432,9 +457,10 @@
{
if (cb >= BlockSize)
{
- if (cb >= AllocSizeHuge)
- return m_hugeAlloc.allocate(cbData);
-
+ if (cb >= AllocSizeHuge) {
+ m_hugeAlloc.allocate(cb);
+ }
+
MemHeader* pAlloc = (MemHeader*)_newBlock(cb + HeaderSize);
pAlloc->dataMemHeader |= nodeAlloced;
return pAlloc + 1;
@@ -475,6 +501,7 @@
return _do_allocate(cb, cbData);
}
+#if defined(BOOST_MEMORY_NO_STRICT_EXCEPTION_SEMANTICS)
void* BOOST_MEMORY_CALL allocate(const size_t cbData0, destructor_t fn)
{
const size_t cbData = sizeof(DestroyInfo) + cbData0;
@@ -494,6 +521,7 @@
{
return allocate(cb);
}
+#endif
void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cbData0, destructor_t fn)
{
@@ -507,7 +535,7 @@
return pInfo + 1;
}
- void* BOOST_MEMORY_CALL manage(void* p, destructor_t fn)
+ void BOOST_MEMORY_CALL manage(void* p, destructor_t fn)
{
MemHeaderEx* pNode = (MemHeaderEx*)p - 1;
BOOST_MEMORY_ASSERT(pNode->fnDestroy == fn);
@@ -516,7 +544,6 @@
pNode->pPrev = m_destroyChain;
pNode->dataMemHeader |= nodeAllocedWithDestructor;
m_destroyChain = pNode;
- return p;
}
void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cb, int fnZero)
@@ -524,9 +551,8 @@
return allocate(cb);
}
- void* BOOST_MEMORY_CALL manage(void* p, int fnZero)
+ void BOOST_MEMORY_CALL manage(void* p, int fnZero)
{
- return p;
}
__forceinline void BOOST_MEMORY_CALL deallocate(void* pData, const size_t cbData)
@@ -586,12 +612,10 @@
template <class Type>
void BOOST_MEMORY_CALL _destroyArray(Type* array, size_t count, destructor_t)
{
- typedef destructor_traits<Type> Traits;
-
- const size_t cb = Traits::getArrayAllocSize(count) + sizeof(MemHeaderEx);
+ const size_t cb = array_factory<Type>::alloc_size(count) + sizeof(MemHeaderEx);
- Traits::destructArrayN(array, count);
- void* pData = Traits::getArrayBuffer(array);
+ destructor_traits<Type>::destructArray(array, count);
+ void* pData = array_factory<Type>::buffer(array);
MemHeaderEx* p = (MemHeaderEx*)pData - 1;
p->freeNode();
@@ -622,13 +646,13 @@
Type* BOOST_MEMORY_CALL newArray(size_t count, Type* zero)
{
const size_t cb = sizeof(MemHeader) +
- destructor_traits<Type>::HasDestructor * sizeof(DestroyInfo) +
- destructor_traits<Type>::getArrayAllocSize(count);
+ destructor_traits<Type>::hasDestructor * sizeof(DestroyInfo) +
+ array_factory<Type>::alloc_size(count);
if (BOOST_MEMORY_ALIGN(cb, AlignSize) >= AllocSizeHuge)
return m_hugeAlloc.newArray(count, zero);
- Type* array = (Type*)destructor_traits<Type>::allocArray(*this, count);
+ Type* array = (Type*)array_factory<Type>::allocate(*this, count);
return constructor_traits<Type>::constructArray(array, count);
}
@@ -638,7 +662,7 @@
BOOST_MEMORY_ASSERT( _isValidArray(array, count) );
const size_t cb = sizeof(MemHeader) +
- destructor_traits<Type>::HasDestructor * sizeof(DestroyInfo) +
+ destructor_traits<Type>::hasDestructor * sizeof(DestroyInfo) +
destructor_traits<Type>::getArrayAllocSize(count);
if (BOOST_MEMORY_ALIGN(cb, AlignSize) >= AllocSizeHuge)
@@ -650,8 +674,6 @@
_destroyArray(array, count, destructor_traits<Type>::destruct);
}
}
-
- BOOST_MEMORY_FAKE_DBG_ALLOCATE_();
};
template <class PolicyT>
@@ -660,7 +682,7 @@
// -------------------------------------------------------------------------
// class gc_alloc
-typedef gen_alloc<NS_BOOST_MEMORY_POLICY::pool> gc_alloc;
+typedef gen_alloc<NS_BOOST_MEMORY_POLICY::pool2> gc_alloc;
// -------------------------------------------------------------------------
// $Log: gc_alloc.hpp,v $
Added: sandbox/memory/boost/memory/future/simple_alloc.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/future/simple_alloc.hpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -0,0 +1,145 @@
+//
+// boost/memory/simple_alloc.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef BOOST_MEMORY_SIMPLE_ALLOC_HPP
+#define BOOST_MEMORY_SIMPLE_ALLOC_HPP
+
+#ifndef BOOST_MEMORY_BASIC_HPP
+#include "basic.hpp"
+#endif
+
+NS_BOOST_MEMORY_BEGIN
+
+// =========================================================================
+// class simple_alloc
+
+template <class SysAllocT>
+class simple_alloc
+{
+#pragma pack(1)
+private:
+ struct DestroyNode
+ {
+ DestroyNode* pPrev;
+ destructor_t fnDestroy;
+ };
+ struct MemBlock
+ {
+ MemBlock* pPrev;
+ };
+#pragma pack()
+
+ MemBlock* m_memChain;
+ DestroyNode* m_destroyChain;
+
+public:
+ simple_alloc()
+ : m_memChain(NULL), m_destroyChain(NULL)
+ {
+ }
+
+ void BOOST_MEMORY_CALL swap(simple_alloc& o)
+ {
+ std::swap(m_memChain, o.m_memChain);
+ std::swap(m_destroyChain, o.m_destroyChain);
+ }
+
+ void BOOST_MEMORY_CALL clear()
+ {
+ while (m_destroyChain)
+ {
+ DestroyNode* curr = m_destroyChain;
+ m_destroyChain = m_destroyChain->pPrev;
+ curr->fnDestroy(curr + 1);
+ }
+ while (m_memChain)
+ {
+ MemBlock* curr = m_memChain;
+ m_memChain = m_memChain->pPrev;
+ SysAllocT::deallocate(curr);
+ }
+ }
+
+ void* BOOST_MEMORY_CALL allocate(size_t cb)
+ {
+ MemBlock* p = (MemBlock*)SysAllocT::allocate(cb + sizeof(MemBlock));
+ p->pPrev = m_memChain;
+ m_memChain = p;
+ return p + 1;
+ }
+
+#if defined(BOOST_MEMORY_NO_STRICT_EXCEPTION_SEMANTICS)
+ void* BOOST_MEMORY_CALL allocate(size_t cb, destructor_t fn)
+ {
+ DestroyNode* pNode = (DestroyNode*)allocate(cb + sizeof(DestroyNode));
+ pNode->fnDestroy = fn;
+ pNode->pPrev = m_destroyChain;
+ m_destroyChain = pNode;
+ return pNode + 1;
+ }
+
+ void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero)
+ {
+ return allocate(cb);
+ }
+#endif
+
+ void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cb, destructor_t fn)
+ {
+ DestroyNode* pNode = (DestroyNode*)allocate(cb + sizeof(DestroyNode));
+ pNode->fnDestroy = fn;
+ return pNode + 1;
+ }
+
+ void BOOST_MEMORY_CALL manage(void* p, destructor_t fn)
+ {
+ DestroyNode* pNode = (DestroyNode*)p - 1;
+ BOOST_MEMORY_ASSERT(pNode->fnDestroy == fn);
+
+ pNode->pPrev = m_destroyChain;
+ m_destroyChain = pNode;
+ }
+
+ void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cb, int fnZero)
+ {
+ return allocate(cb);
+ }
+
+ void BOOST_MEMORY_CALL manage(void* p, int fnZero)
+ {
+ // no action
+ }
+
+ void BOOST_MEMORY_CALL deallocate(void* p, size_t cb)
+ {
+ // no action
+ }
+
+ template <class Type>
+ void BOOST_MEMORY_CALL destroy(Type* obj)
+ {
+ // no action
+ }
+
+ template <class Type>
+ void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count)
+ {
+ // no action
+ }
+};
+
+// =========================================================================
+// $Log: policy.hpp,v $
+
+NS_BOOST_MEMORY_END
+
+#endif /* BOOST_MEMORY_SIMPLE_ALLOC_HPP */
+
Copied: sandbox/memory/boost/memory/future/tls_gc_alloc.hpp (from r49000, /sandbox/memory/boost/memory/tls_gc_alloc.hpp)
==============================================================================
--- /sandbox/memory/boost/memory/tls_gc_alloc.hpp (original)
+++ sandbox/memory/boost/memory/future/tls_gc_alloc.hpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -26,18 +26,18 @@
STDAPI_(tls_gc_alloc_t*) _boost_TlsGcAlloc();
template <class Unused>
-class tls_gc_alloc_imp
+class tls_gc_alloc_
{
private:
static tls_gc_alloc_t* _tls_gcAlloc;
public:
- typedef gc_alloc allocator_type;
+ typedef gc_alloc alloc_type;
- tls_gc_alloc_imp() {
+ tls_gc_alloc_() {
_tls_gcAlloc->init();
}
- ~tls_gc_alloc_imp() {
+ ~tls_gc_alloc_() {
_tls_gcAlloc->term();
}
@@ -56,6 +56,7 @@
return _tls_gcAlloc->get().allocate(cbData);
}
+#if defined(BOOST_MEMORY_NO_STRICT_EXCEPTION_SEMANTICS)
static void* BOOST_MEMORY_CALL allocate(const size_t cbData0, destructor_t fn)
{
return _tls_gcAlloc->get().allocate(cbData0, fn);
@@ -65,15 +66,16 @@
{
return _tls_gcAlloc->get().allocate(cb);
}
+#endif
static void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cbData0, destructor_t fn)
{
return _tls_gcAlloc->get().unmanaged_alloc(cbData0, fn);
}
- static void* BOOST_MEMORY_CALL manage(void* p, destructor_t fn)
+ static void BOOST_MEMORY_CALL manage(void* p, destructor_t fn)
{
- return _tls_gcAlloc->get().manage(p, fn);
+ _tls_gcAlloc->get().manage(p, fn);
}
static void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cb, int fnZero)
@@ -81,9 +83,8 @@
return _tls_gcAlloc->get().allocate(cb);
}
- static void* BOOST_MEMORY_CALL manage(void* p, int fnZero)
+ static void BOOST_MEMORY_CALL manage(void* p, int fnZero)
{
- return p;
}
static void BOOST_MEMORY_CALL deallocate(void* pData, const size_t cbData)
@@ -103,24 +104,16 @@
}
template <class Type>
- static Type* BOOST_MEMORY_CALL newArray(size_t count, Type* zero)
- {
- return _tls_gcAlloc->get().newArray(count, zero);
- }
-
- template <class Type>
static void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count)
{
return _tls_gcAlloc->get().destroyArray(array, count);
}
-
- BOOST_MEMORY_FAKE_DBG_ALLOCATE_();
};
template <class Unused>
-tls_gc_alloc_t* tls_gc_alloc_imp<Unused>::_tls_gcAlloc = _boost_TlsGcAlloc();
+tls_gc_alloc_t* tls_gc_alloc_<Unused>::_tls_gcAlloc = _boost_TlsGcAlloc();
-typedef tls_gc_alloc_imp<int> tls_gc_alloc;
+typedef tls_gc_alloc_<int> tls_gc_alloc;
// -------------------------------------------------------------------------
// $Log: tls_gc_alloc.hpp,v $
@@ -128,3 +121,4 @@
NS_BOOST_MEMORY_END
#endif /* BOOST_MEMORY_TLS_GC_ALLOC_HPP */
+
Deleted: sandbox/memory/boost/memory/gc_alloc.hpp
==============================================================================
--- sandbox/memory/boost/memory/gc_alloc.hpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
+++ (empty file)
@@ -1,670 +0,0 @@
-//
-// boost/memory/gc_alloc.hpp
-//
-// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/memory/index.htm for documentation.
-//
-#ifndef BOOST_MEMORY_GC_ALLOC_HPP
-#define BOOST_MEMORY_GC_ALLOC_HPP
-
-#if defined(_MSC_VER)
-#pragma warning(disable:4786)
-#endif
-
-#ifndef BOOST_MEMORY_SCOPED_ALLOC_HPP
-#include "scoped_alloc.hpp"
-#endif
-
-#ifndef BOOST_MEMORY_STL_QUEUE_HPP
-#include "stl/queue.hpp" // NS_BOOST_MEMORY::ext_priority_queue
-#endif
-
-#if !defined(_VECTOR_) && !defined(_VECTOR)
-#include <vector> // std::vector
-#endif
-
-NS_BOOST_MEMORY_BEGIN
-
-// -------------------------------------------------------------------------
-// class gen_alloc
-
-#if defined(_DEBUG) && !defined(BOOST_MEMORY_TRACE_GC)
-#define BOOST_MEMORY_TRACE_GC
-#endif
-
-#ifndef BOOST_MEMORY_ALIGN
-#define BOOST_MEMORY_ALIGN(x, y) (((x)+((y)-1)) & ~((y)-1))
-#endif
-
-#ifndef MAX
-#define MAX(a, b) ((a) < (b) ? (b) : (a))
-#endif
-
-#ifndef MIN
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#endif
-
-template <class PolicyT>
-class gen_alloc
-{
-private:
- typedef typename PolicyT::allocator_type AllocT;
- typedef typename PolicyT::huge_gc_allocator HugeGCAllocT;
- typedef unsigned HeaderSizeT;
-
-public:
- enum { MemBlockSize = PolicyT::MemBlockSize };
- enum { IsGCAllocator = TRUE };
-
- typedef AllocT allocator_type;
- typedef HugeGCAllocT huge_gc_allocator;
-
-#pragma pack(1)
-private:
- enum { NodeSizeBits = 30 };
- enum MemNodeType {
- nodeFree = 0 << NodeSizeBits,
- nodeAlloced = 1 << NodeSizeBits,
- nodeAllocedWithDestructor = 3 << NodeSizeBits,
- };
- enum {
- NodeTypeMask = 3 << NodeSizeBits,
- NodeSizeMask = (1 << NodeSizeBits) - 1,
- };
-
- struct MemHeader
- {
- HeaderSizeT dataMemHeader;
- // HeaderSizeT cbNodeSize : 30; // cbNodeSize = cbSize + sizeof(MemHeader)
- // HeaderSizeT nodeType : 2; // enum MemNodeType
-
- int BOOST_MEMORY_CALL getNodeType() const {
- return NodeTypeMask & dataMemHeader;
- }
- HeaderSizeT BOOST_MEMORY_CALL getNodeSize() const {
- return NodeSizeMask & dataMemHeader;
- }
- char* BOOST_MEMORY_CALL begin() const {
- return (char*)this + sizeof(MemHeader);
- }
- char* BOOST_MEMORY_CALL end() const {
- BOOST_MEMORY_ASSERT(getNodeType() == nodeFree);
- return (char*)this + dataMemHeader;
- }
- void BOOST_MEMORY_CALL freeNode() {
- dataMemHeader &= ~NodeTypeMask;
- }
- };
-
- typedef MemHeader FreeMemHeader;
-
- struct MemHeaderEx;
- struct DestroyInfo
- {
- MemHeaderEx* pPrev;
- destructor_t fnDestroy;
- };
-
- struct MemHeaderEx : public MemHeader
- {
- MemHeaderEx* pPrev;
- destructor_t fnDestroy;
-
- void BOOST_MEMORY_CALL destruct() {
- if (this->getNodeType() == nodeAllocedWithDestructor) {
- this->freeNode();
- fnDestroy(this + 1);
- }
- }
- };
-
- friend struct MemHeader;
- friend struct MemHeaderEx;
-
- struct MemBlock
- {
- MemBlock* pPrev;
- char buffer[1];
-
- class Enumerator
- {
- private:
- char* m_start;
- char* m_last;
-
- public:
- Enumerator(AllocT& alloc, MemBlock* block) {
- m_start = block->buffer;
- m_last = (char*)block + alloc.alloc_size(block);
- }
- MemHeader* BOOST_MEMORY_CALL first() const {
- return (MemHeader*)m_start;
- }
- MemHeader* BOOST_MEMORY_CALL current() const {
- return (MemHeader*)m_start;
- }
- MemHeader* BOOST_MEMORY_CALL next() {
- BOOST_MEMORY_ASSERT(!done());
- m_start += ((MemHeader*)m_start)->getNodeSize();
- return (MemHeader*)m_start;
- }
- bool BOOST_MEMORY_CALL done() const {
- return m_start >= m_last;
- }
- };
- };
-#pragma pack()
-
- struct Pred : std::binary_function<FreeMemHeader*, FreeMemHeader*, bool>
- {
- bool operator()(FreeMemHeader* a, FreeMemHeader* b) const {
- return a->dataMemHeader < b->dataMemHeader;
- }
- };
- typedef std::vector<FreeMemHeader*> Container;
- typedef NS_BOOST_MEMORY::ext_priority_queue<FreeMemHeader*, Container, Pred> PriorityQ;
-
- char* m_begin;
- char* m_end;
- AllocT m_alloc;
- MemHeaderEx* m_destroyChain;
- MemBlock* m_blockList;
- PriorityQ m_freeList;
- HugeGCAllocT m_hugeAlloc;
- size_t m_destroyCount, m_freeSize, m_GCLimitSize;
- static FreeMemHeader _null;
-
-private:
- enum { HeaderSize = sizeof(void*) };
- enum { AlignSize = sizeof(HeaderSizeT) };
- enum { BlockSize = MemBlockSize - HeaderSize };
- enum { AllocSizeBigDef_ = MAX(PolicyT::AllocSizeBig, BlockSize/4) };
- enum { AllocSizeHugeDef_ = MAX(PolicyT::AllocSizeHuge, 64*1024) };
- enum { GCLimitSizeDef_ = MAX(PolicyT::GCLimitSizeDef, 64*1024) };
- enum { AllocSizeBig = MIN(AllocSizeBigDef_, BlockSize/2) };
- enum { AllocSizeHuge = MIN(AllocSizeHugeDef_, (1 << 29)) };
- enum { GCLimitSizeDef = MIN(GCLimitSizeDef_, (1 << 29)) };
- enum { RecycleSizeMin = MAX(PolicyT::RecycleSizeMin, 128) };
-
-private:
- const gen_alloc& operator=(const gen_alloc&);
-
- static bool BOOST_MEMORY_CALL _isEqual(size_t cbAlloc, size_t cb)
- {
- return cbAlloc >= cb && cb + 64 > cbAlloc;
- }
-
- static bool BOOST_MEMORY_CALL _isValid(void* obj, size_t cb, destructor_t fn)
- {
- MemHeaderEx* node = (MemHeaderEx*)obj - 1;
- BOOST_MEMORY_ASSERT(node->fnDestroy == fn);
- BOOST_MEMORY_ASSERT(_isEqual(node->getNodeSize(), cb + sizeof(MemHeaderEx)));
- BOOST_MEMORY_ASSERT(node->getNodeType() == nodeAllocedWithDestructor);
- return node->fnDestroy == fn &&
- _isEqual(node->getNodeSize(), cb + sizeof(MemHeaderEx)) &&
- node->getNodeType() == nodeAllocedWithDestructor;
- }
-
- static bool BOOST_MEMORY_CALL _isValid(void* obj, size_t cb, int fnZero)
- {
- MemHeader* node = (MemHeader*)obj - 1;
- BOOST_MEMORY_ASSERT(_isEqual(node->getNodeSize(), sizeof(MemHeader) + cb));
- BOOST_MEMORY_ASSERT(node->getNodeType() == nodeAlloced);
- return _isEqual(node->getNodeSize(), sizeof(MemHeader) + cb) &&
- node->getNodeType() == nodeAlloced;
- }
-
- template <class Type>
- static bool BOOST_MEMORY_CALL _isValid(Type* obj)
- {
- return _isValid(obj, sizeof(Type), destructor_traits<Type>::destruct);
- }
-
- template <class Type>
- static bool BOOST_MEMORY_CALL _isValidArray(Type* array, size_t count)
- {
- void* buf = destructor_traits<Type>::getArrayBuffer(array);
- size_t cb = destructor_traits<Type>::getArrayAllocSize(count);
- if (buf == array)
- {
- return _isValid(buf, cb, 0);
- }
- else
- {
- size_t count1 = destructor_traits<Type>::getArraySize(array);
- BOOST_MEMORY_ASSERT(count1 == count);
- bool fValid = _isValid(buf, cb, destructor_traits<Type>::destructArray);
- return count1 == count && fValid;
- }
- }
-
-public:
- void BOOST_MEMORY_CALL force_gc()
- {
-#if defined(BOOST_MEMORY_TRACE_GC)
- printf("boost::gc_alloc - starting to gc...\n");
-#endif
- // 0. Prepare
-
- // 0.1. Commit current block:
- _commitCurrentNode();
- m_begin = m_end = _null.begin();
-
- // 0.2. Reduce destroy chain
- _reduceDestroyChain();
-
- // 0.3. Clear free list
- m_freeList.clear();
- m_freeSize = 0;
-
- // 1. Collect free nodes
- MemBlock* pHeader = m_blockList;
- while (pHeader)
- {
- typename MemBlock::Enumerator coll(m_alloc, pHeader);
- pHeader = pHeader->pPrev;
- for (;;)
- {
- if (coll.done())
- break;
- FreeMemHeader* it = (FreeMemHeader*)coll.current();
- if (it->getNodeType() == nodeFree)
- {
- // merge nodes marked with nodeFree
- for (;;) {
- FreeMemHeader* it2 = (FreeMemHeader*)coll.next();
- if (coll.done() || it2->getNodeType() != nodeFree)
- break;
- it->dataMemHeader += it2->dataMemHeader;
- }
- if (it->dataMemHeader >= RecycleSizeMin)
- m_freeList.push(it);
- if (coll.done())
- break;
- }
- // skip nodes marked with nodeAlloced
- coll.next();
- }
- }
- }
-
- void BOOST_MEMORY_CALL try_gc()
- {
-#if !defined(BOOST_MEMORY_DEBUG_GC)
- if (m_freeSize >= m_GCLimitSize)
-#endif
- force_gc();
- }
-
- size_t BOOST_MEMORY_CALL get_free_size() const
- {
- return m_freeSize;
- }
-
- void BOOST_MEMORY_CALL set_gclim(size_t gcLimit)
- {
- m_GCLimitSize = gcLimit;
- }
-
-private:
- void BOOST_MEMORY_CALL _reduceDestroyChain()
- {
- MemHeaderEx** pp = &m_destroyChain;
- while (m_destroyCount)
- {
- MemHeaderEx* curr = *pp;
- if (curr->getNodeType() == nodeFree) {
- *pp = curr->pPrev;
- --m_destroyCount;
- }
- else {
- pp = &curr->pPrev;
- }
- }
- }
-
- void BOOST_MEMORY_CALL _commitCurrentNode()
- {
- FreeMemHeader* pNode = (FreeMemHeader*)m_begin - 1;
- BOOST_MEMORY_ASSERT(
- pNode->getNodeType() == nodeFree ||
- pNode->getNodeType() == nodeAlloced &&
- _null.begin() == m_begin && m_begin == m_end);
-
- pNode->dataMemHeader = sizeof(FreeMemHeader) + (HeaderSizeT)(m_end - m_begin);
- }
-
- FreeMemHeader* BOOST_MEMORY_CALL _newBlock(size_t cbBlock)
- {
- MemBlock* pBlock = (MemBlock*)m_alloc.allocate(cbBlock);
- pBlock->pPrev = m_blockList;
- m_blockList = pBlock;
-
- FreeMemHeader* pNew = (FreeMemHeader*)pBlock->buffer;
- pNew->dataMemHeader = (HeaderSizeT)(m_alloc.alloc_size(pBlock) - HeaderSize);
- return pNew;
- }
-
- void BOOST_MEMORY_CALL _init()
- {
- m_blockList = NULL;
- m_destroyChain = NULL;
- m_freeSize = 0;
- m_destroyCount = 0;
- m_GCLimitSize = GCLimitSizeDef;
-
- FreeMemHeader* pNew = _newBlock(MemBlockSize);
- m_begin = pNew->begin();
- m_end = pNew->end();
- }
-
-public:
- gen_alloc() {
- _init();
- }
- explicit gen_alloc(AllocT alloc) : m_alloc(alloc) {
- _init();
- }
- explicit gen_alloc(gen_alloc& owner) : m_alloc(owner.m_alloc) {
- _init();
- }
-
- ~gen_alloc()
- {
- clear();
- }
-
- void BOOST_MEMORY_CALL swap(gen_alloc& o)
- {
- std::swap(m_begin, o.m_begin);
- std::swap(m_end, o.m_end);
- std::swap(m_blockList, o.m_blockList);
- std::swap(m_destroyChain, o.m_destroyChain);
- std::swap(m_freeSize, o.m_freeSize);
- std::swap(m_destroyCount, o.m_destroyCount);
- std::swap(m_GCLimitSize, o.m_GCLimitSize);
- m_alloc.swap(o.m_alloc);
- m_freeList.swap(o.m_freeList);
- m_hugeAlloc.swap(o.m_hugeAlloc);
- }
-
- void BOOST_MEMORY_CALL clear()
- {
- m_hugeAlloc.clear();
- while (m_destroyChain)
- {
- MemHeaderEx* curr = m_destroyChain;
- m_destroyChain = m_destroyChain->pPrev;
- curr->destruct();
- }
- MemBlock* pHeader = m_blockList;
- while (pHeader)
- {
- MemBlock* curr = pHeader;
- pHeader = pHeader->pPrev;
- m_alloc.deallocate(curr);
- }
- m_begin = m_end = _null.begin();
- m_blockList = NULL;
- m_freeList.clear();
- m_freeSize = 0;
- m_destroyCount = 0;
- }
-
-private:
- void* BOOST_MEMORY_CALL _do_allocate(const size_t cb, const size_t cbData)
- {
- if ((size_t)(m_end - m_begin) >= cbData)
- {
- MemHeader* pAlloc = (MemHeader*)m_begin - 1;
- pAlloc->dataMemHeader = (nodeAlloced | (HeaderSizeT)(m_end - (char*)pAlloc));
- m_begin = m_end = _null.begin();
- return pAlloc + 1;
- }
-
- FreeMemHeader* pNew;
- if (cb >= AllocSizeBig)
- {
- if (cb >= BlockSize)
- {
- if (cb >= AllocSizeHuge)
- return m_hugeAlloc.allocate(cbData);
-
- MemHeader* pAlloc = (MemHeader*)_newBlock(cb + HeaderSize);
- pAlloc->dataMemHeader |= nodeAlloced;
- return pAlloc + 1;
- }
- pNew = _newBlock(MemBlockSize);
- }
- else
- {
- try_gc();
- if (m_freeList.empty() || (pNew = m_freeList.top())->getNodeSize() < cb) {
- pNew = _newBlock(MemBlockSize);
- }
- else {
- m_freeList.pop();
- }
- }
- _commitCurrentNode();
- m_begin = pNew->begin();
- m_end = pNew->end();
-
- BOOST_MEMORY_ASSERT((size_t)(m_end - m_begin) >= cb);
-
- MemHeader* pAlloc = (MemHeader*)(m_end -= cb);
- pAlloc->dataMemHeader = (nodeAlloced | (HeaderSizeT)cb);
- return pAlloc + 1;
- }
-
-public:
- __forceinline void* BOOST_MEMORY_CALL allocate(const size_t cbData)
- {
- const size_t cb = BOOST_MEMORY_ALIGN(cbData, AlignSize) + sizeof(MemHeader);
- if ((size_t)(m_end - m_begin) >= cb)
- {
- MemHeader* pAlloc = (MemHeader*)(m_end -= cb);
- pAlloc->dataMemHeader = (nodeAlloced | (HeaderSizeT)cb);
- return pAlloc + 1;
- }
- return _do_allocate(cb, cbData);
- }
-
- void* BOOST_MEMORY_CALL allocate(const size_t cbData0, destructor_t fn)
- {
- const size_t cbData = sizeof(DestroyInfo) + cbData0;
- const size_t cbAlloc = BOOST_MEMORY_ALIGN(cbData, AlignSize) + sizeof(MemHeader);
- if (cbAlloc >= AllocSizeHuge)
- return m_hugeAlloc.allocate(cbData0, fn);
-
- MemHeaderEx* pNode = (MemHeaderEx*)((char*)allocate(cbData) - sizeof(MemHeader));
- pNode->fnDestroy = fn;
- pNode->pPrev = m_destroyChain;
- pNode->dataMemHeader |= nodeAllocedWithDestructor;
- m_destroyChain = pNode;
- return pNode + 1;
- }
-
- void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero)
- {
- return allocate(cb);
- }
-
- void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cbData0, destructor_t fn)
- {
- const size_t cbData = sizeof(DestroyInfo) + cbData0;
-
- BOOST_MEMORY_ASSERT(
- BOOST_MEMORY_ALIGN(cbData, AlignSize) + sizeof(MemHeader) < AllocSizeHuge);
-
- DestroyInfo* pInfo = (DestroyInfo*)allocate(cbData);
- pInfo->fnDestroy = fn;
- return pInfo + 1;
- }
-
- void* BOOST_MEMORY_CALL manage(void* p, destructor_t fn)
- {
- MemHeaderEx* pNode = (MemHeaderEx*)p - 1;
- BOOST_MEMORY_ASSERT(pNode->fnDestroy == fn);
- BOOST_MEMORY_ASSERT(pNode->getNodeType() == nodeAlloced);
-
- pNode->pPrev = m_destroyChain;
- pNode->dataMemHeader |= nodeAllocedWithDestructor;
- m_destroyChain = pNode;
- return p;
- }
-
- void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cb, int fnZero)
- {
- return allocate(cb);
- }
-
- void* BOOST_MEMORY_CALL manage(void* p, int fnZero)
- {
- return p;
- }
-
- __forceinline void BOOST_MEMORY_CALL deallocate(void* pData, const size_t cbData)
- {
- const size_t cb = BOOST_MEMORY_ALIGN(cbData, AlignSize) + sizeof(MemHeader);
-
- if (cb < AllocSizeHuge)
- {
- MemHeader* p = (MemHeader*)pData - 1;
- BOOST_MEMORY_ASSERT(p->getNodeSize() >= cb);
- BOOST_MEMORY_ASSERT(p->getNodeType() == nodeAlloced);
-
- p->freeNode();
- m_freeSize += cb;
- }
- else
- {
- m_hugeAlloc.deallocate(pData, cbData);
- }
- }
-
- void* BOOST_MEMORY_CALL reallocate(void* p, size_t oldSize, size_t newSize)
- {
- void* p2 = allocate(newSize);
- memcpy(p2, p, oldSize);
- deallocate(p, oldSize);
- return p2;
- }
-
-private:
- template <class Type>
- void BOOST_MEMORY_CALL _destroy(Type* obj, destructor_t)
- {
- const size_t cb = sizeof(Type) + sizeof(MemHeaderEx);
- BOOST_MEMORY_ASSERT( BOOST_MEMORY_ALIGN(cb, AlignSize) < AllocSizeHuge );
-
- obj->~Type();
- MemHeaderEx* p = (MemHeaderEx*)obj - 1;
-
- p->freeNode();
- m_freeSize += cb;
- ++m_destroyCount;
- }
-
- template <class Type>
- void BOOST_MEMORY_CALL _destroy(Type* obj, int)
- {
- const size_t cb = sizeof(Type) + sizeof(MemHeader);
- BOOST_MEMORY_ASSERT( BOOST_MEMORY_ALIGN(cb, AlignSize) < AllocSizeHuge );
-
- MemHeader* p = (MemHeader*)obj - 1;
-
- p->freeNode();
- m_freeSize += cb;
- }
-
- template <class Type>
- void BOOST_MEMORY_CALL _destroyArray(Type* array, size_t count, destructor_t)
- {
- typedef destructor_traits<Type> Traits;
-
- const size_t cb = Traits::getArrayAllocSize(count) + sizeof(MemHeaderEx);
-
- Traits::destructArrayN(array, count);
- void* pData = Traits::getArrayBuffer(array);
- MemHeaderEx* p = (MemHeaderEx*)pData - 1;
-
- p->freeNode();
- m_freeSize += cb;
- ++m_destroyCount;
- }
-
- template <class Type>
- void BOOST_MEMORY_CALL _destroyArray(Type* array, size_t count, int)
- {
- const size_t cb = sizeof(Type) * count + sizeof(MemHeader);
-
- MemHeader* p = (MemHeader*)array - 1;
-
- p->freeNode();
- m_freeSize += cb;
- }
-
-public:
- template <class Type>
- void BOOST_MEMORY_CALL destroy(Type* obj)
- {
- BOOST_MEMORY_ASSERT( _isValid(obj) );
- _destroy(obj, destructor_traits<Type>::destruct);
- }
-
- template <class Type>
- Type* BOOST_MEMORY_CALL newArray(size_t count, Type* zero)
- {
- const size_t cb = sizeof(MemHeader) +
- destructor_traits<Type>::HasDestructor * sizeof(DestroyInfo) +
- destructor_traits<Type>::getArrayAllocSize(count);
-
- if (BOOST_MEMORY_ALIGN(cb, AlignSize) >= AllocSizeHuge)
- return m_hugeAlloc.newArray(count, zero);
-
- Type* array = (Type*)destructor_traits<Type>::allocArray(*this, count);
- return constructor_traits<Type>::constructArray(array, count);
- }
-
- template <class Type>
- void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count)
- {
- BOOST_MEMORY_ASSERT( _isValidArray(array, count) );
-
- const size_t cb = sizeof(MemHeader) +
- destructor_traits<Type>::HasDestructor * sizeof(DestroyInfo) +
- destructor_traits<Type>::getArrayAllocSize(count);
-
- if (BOOST_MEMORY_ALIGN(cb, AlignSize) >= AllocSizeHuge)
- {
- m_hugeAlloc.destroyArray(array, count);
- }
- else
- {
- _destroyArray(array, count, destructor_traits<Type>::destruct);
- }
- }
-
- BOOST_MEMORY_FAKE_DBG_ALLOCATE_();
-};
-
-template <class PolicyT>
-typename gen_alloc<PolicyT>::FreeMemHeader gen_alloc<PolicyT>::_null;
-
-// -------------------------------------------------------------------------
-// class gc_alloc
-
-typedef gen_alloc<NS_BOOST_MEMORY_POLICY::pool> gc_alloc;
-
-// -------------------------------------------------------------------------
-// $Log: gc_alloc.hpp,v $
-
-NS_BOOST_MEMORY_END
-
-#endif /* BOOST_MEMORY_GC_ALLOC_HPP */
Deleted: sandbox/memory/boost/memory/policy.hpp
==============================================================================
--- sandbox/memory/boost/memory/policy.hpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
+++ (empty file)
@@ -1,159 +0,0 @@
-//
-// boost/memory/policy.hpp
-//
-// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/memory/index.htm for documentation.
-//
-#ifndef BOOST_MEMORY_POLICY_HPP
-#define BOOST_MEMORY_POLICY_HPP
-
-#ifndef BOOST_MEMORY_SYSTEM_ALLOC_HPP
-#include "system_alloc.hpp"
-#endif
-
-NS_BOOST_MEMORY_BEGIN
-
-// -------------------------------------------------------------------------
-// class simple_gc_alloc
-
-template <class SysAllocT>
-class simple_gc_alloc
-{
-#pragma pack(1)
-private:
- struct DestroyNode
- {
- DestroyNode* pPrev;
- destructor_t fnDestroy;
- };
- struct MemBlock
- {
- MemBlock* pPrev;
- };
-#pragma pack()
-
- MemBlock* m_memChain;
- DestroyNode* m_destroyChain;
-
-public:
- simple_gc_alloc()
- : m_memChain(NULL), m_destroyChain(NULL)
- {
- }
-
- void BOOST_MEMORY_CALL swap(simple_gc_alloc& o)
- {
- std::swap(m_memChain, o.m_memChain);
- std::swap(m_destroyChain, o.m_destroyChain);
- }
-
- void BOOST_MEMORY_CALL clear()
- {
- while (m_destroyChain)
- {
- DestroyNode* curr = m_destroyChain;
- m_destroyChain = m_destroyChain->pPrev;
- curr->fnDestroy(curr + 1);
- }
- while (m_memChain)
- {
- MemBlock* curr = m_memChain;
- m_memChain = m_memChain->pPrev;
- SysAllocT::deallocate(curr);
- }
- }
-
- template <class Type>
- void BOOST_MEMORY_CALL destroy(Type* obj)
- {
- // no action
- }
-
- template <class Type>
- Type* BOOST_MEMORY_CALL newArray(size_t count, Type* zero)
- {
- Type* array = (Type*)destructor_traits<Type>::allocArray(*this, count);
- return constructor_traits<Type>::constructArray(array, count);
- }
-
- template <class Type>
- void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count)
- {
- // no action
- }
-
- void* BOOST_MEMORY_CALL allocate(size_t cb)
- {
- MemBlock* p = (MemBlock*)SysAllocT::allocate(cb + sizeof(MemBlock));
- p->pPrev = m_memChain;
- m_memChain = p;
- return p + 1;
- }
-
- void* BOOST_MEMORY_CALL allocate(size_t cb, destructor_t fn)
- {
- DestroyNode* pNode = (DestroyNode*)allocate(cb + sizeof(DestroyNode));
- pNode->fnDestroy = fn;
- pNode->pPrev = m_destroyChain;
- m_destroyChain = pNode;
- return pNode + 1;
- }
-
- void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero)
- {
- return allocate(cb);
- }
-
- void BOOST_MEMORY_CALL deallocate(void* p, size_t cb)
- {
- // no action
- }
-};
-
-// -------------------------------------------------------------------------
-
-#ifndef NS_BOOST_MEMORY_POLICY_BEGIN
-#define NS_BOOST_MEMORY_POLICY_BEGIN namespace policy {
-#define NS_BOOST_MEMORY_POLICY_END }
-#define NS_BOOST_MEMORY_POLICY boost::memory::policy
-#endif
-
-NS_BOOST_MEMORY_POLICY_BEGIN
-
-class sys
-{
-private:
- enum { Default = 0 };
-
-public:
- enum { MemBlockSize = BOOST_MEMORY_BLOCK_SIZE };
- typedef system_alloc allocator_type;
- typedef NS_BOOST_DETAIL::default_threadmodel threadmodel_type;
-
- enum { RecycleSizeMin = 256 };
- enum { AllocSizeBig = Default };
- enum { AllocSizeHuge = 1024*1024 };
- enum { GCLimitSizeDef = 1024*1024 };
-
- typedef simple_gc_alloc<system_alloc> huge_gc_allocator;
-};
-
-class stdlib : public sys
-{
-public:
- typedef stdlib_alloc allocator_type;
-};
-
-NS_BOOST_MEMORY_POLICY_END
-
-// -------------------------------------------------------------------------
-// $Log: policy.hpp,v $
-
-NS_BOOST_MEMORY_END
-
-#endif /* BOOST_MEMORY_POLICY_HPP */
Modified: sandbox/memory/boost/memory/scoped_alloc.hpp
==============================================================================
--- sandbox/memory/boost/memory/scoped_alloc.hpp (original)
+++ sandbox/memory/boost/memory/scoped_alloc.hpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -44,6 +44,9 @@
proxy_alloc() : m_alloc(&TlsAllocT::instance()) {}
public:
+ enum { Padding = AllocT::Padding };
+
+public:
void* BOOST_MEMORY_CALL allocate(size_t cb) { return m_alloc->allocate(cb); }
void BOOST_MEMORY_CALL deallocate(void* p) { m_alloc->deallocate(p); }
void BOOST_MEMORY_CALL swap(proxy_alloc& o) { std::swap(m_alloc, o.m_alloc); }
@@ -54,11 +57,11 @@
// class block_pool
template <class PolicyT>
-class block_pool_imp
+class block_pool_
{
private:
- typedef typename PolicyT::allocator_type AllocT;
- enum { m_cbBlock = PolicyT::MemBlockSize };
+ typedef typename PolicyT::alloc_type AllocT;
+ enum { m_cbBlock = PolicyT::MemBlockBytes - AllocT::Padding };
#pragma pack(1)
struct Block {
@@ -72,21 +75,24 @@
const int m_nFreeLimit;
private:
- block_pool_imp(const block_pool_imp&);
- void operator=(const block_pool_imp&);
+ block_pool_(const block_pool_&);
+ void operator=(const block_pool_&);
public:
- block_pool_imp(int cbFreeLimit = INT_MAX)
+ block_pool_(int cbFreeLimit = INT_MAX)
: m_freeList(NULL), m_nFree(0),
m_nFreeLimit(cbFreeLimit / m_cbBlock + 1)
{
}
- ~block_pool_imp()
+ ~block_pool_()
{
clear();
}
public:
+ enum { Padding = AllocT::Padding };
+
+public:
void* BOOST_MEMORY_CALL allocate(size_t cb)
{
BOOST_MEMORY_ASSERT(cb >= (size_t)m_cbBlock);
@@ -137,47 +143,38 @@
}
};
-typedef block_pool_imp<NS_BOOST_MEMORY_POLICY::sys> block_pool;
+typedef block_pool_<NS_BOOST_MEMORY_POLICY::sys> block_pool;
// -------------------------------------------------------------------------
// class tls_block_pool
-#if !defined(BOOST_MEMORY_NO_SYSTEM_POOL_DYN_)
-
typedef tls_object<block_pool> tls_block_pool_t;
STDAPI_(tls_block_pool_t*) _boost_TlsBlockPool();
template <class Unused>
-class tls_block_pool_imp
+class tls_block_pool_
{
private:
static tls_block_pool_t* _tls_blockPool;
public:
- tls_block_pool_imp() {
+ tls_block_pool_() {
_tls_blockPool->init();
}
- ~tls_block_pool_imp() {
+ ~tls_block_pool_() {
_tls_blockPool->term();
}
- static block_pool& BOOST_MEMORY_CALL instance()
- {
+ static block_pool& BOOST_MEMORY_CALL instance() {
return _tls_blockPool->get();
}
};
template <class Unused>
-tls_block_pool_t* tls_block_pool_imp<Unused>::_tls_blockPool = _boost_TlsBlockPool();
-
-typedef tls_block_pool_imp<int> tls_block_pool;
-
-#else
-
-class tls_block_pool {};
+tls_block_pool_t* tls_block_pool_<Unused>::_tls_blockPool = _boost_TlsBlockPool();
-#endif
+typedef tls_block_pool_<int> tls_block_pool;
// -------------------------------------------------------------------------
// class scoped_alloc
@@ -189,7 +186,7 @@
class pool : public sys
{
public:
- typedef proxy_block_pool allocator_type;
+ typedef proxy_block_pool alloc_type;
};
NS_BOOST_MEMORY_POLICY_END
Modified: sandbox/memory/boost/memory/system_alloc.hpp
==============================================================================
--- sandbox/memory/boost/memory/system_alloc.hpp (original)
+++ sandbox/memory/boost/memory/system_alloc.hpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -16,45 +16,13 @@
#include "basic.hpp"
#endif
-#ifndef BOOST_DETAIL_THREADMODEL_HPP
-#include <boost/detail/threadmodel.hpp>
-#endif
-
-#if !defined(_ALGORITHM_) && !defined(_ALGORITHM)
-#include <algorithm> // std::swap
-#endif
-
-#if !defined(_CSTDLIB_) && !defined(_CSTDLIB)
+#if !defined(_GLIBCXX_CSTDLIB) && !defined(_CSTDLIB)
#include <cstdlib> // malloc, free
#endif
NS_BOOST_MEMORY_BEGIN
-// -------------------------------------------------------------------------
-// BOOST_MEMORY_FAKE_DBG_ALLOCATE_
-
-#if defined(_DEBUG)
-
-#define BOOST_MEMORY_FAKE_DBG_ALLOCATE_() \
- void* BOOST_MEMORY_CALL allocate(size_t cb, LPCSTR szFile, int nLine) \
- { return allocate(cb); } \
- void* BOOST_MEMORY_CALL allocate(size_t cb, destructor_t fn, LPCSTR szFile, int nLine) \
- { return allocate(cb, fn); } \
- void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero, LPCSTR szFile, int nLine) \
- { return allocate(cb); } \
- void* BOOST_MEMORY_CALL reallocate(void* p, size_t oldSize, size_t newSize, \
- LPCSTR szFile, int nLine) { return reallocate(p, oldSize, newSize); } \
- template <class Type> \
- Type* BOOST_MEMORY_CALL newArray(size_t count, Type* zero, LPCSTR szFile, int nLine)\
- { return newArray(count, zero); }
-
-#else
-
-#define BOOST_MEMORY_FAKE_DBG_ALLOCATE_()
-
-#endif
-
-// -------------------------------------------------------------------------
+// =========================================================================
// class stdlib_alloc
#if defined(__GNUG__)
@@ -64,9 +32,11 @@
class stdlib_alloc
{
public:
- static void* BOOST_MEMORY_CALL allocate(size_t cb) { return malloc(cb); }
- static void* BOOST_MEMORY_CALL allocate(size_t cb, destructor_t fn) { return malloc(cb); }
- static void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero) { return malloc(cb); }
+ enum { Padding = 32 /* must >= sizeof(AllocateHeader) */ };
+
+ static void* BOOST_MEMORY_CALL allocate(size_t cb) {
+ return malloc(cb);
+ }
static void* BOOST_MEMORY_CALL reallocate(void* p, size_t oldSize, size_t newSize) {
return realloc(p, newSize);
@@ -74,89 +44,49 @@
static void BOOST_MEMORY_CALL deallocate(void* p) { free(p); }
static void BOOST_MEMORY_CALL deallocate(void* p, size_t) { free(p); }
- static void BOOST_MEMORY_CALL swap(stdlib_alloc& o) {}
+
+ static void BOOST_MEMORY_CALL swap(stdlib_alloc& o) {}
static size_t BOOST_MEMORY_CALL alloc_size(void* p)
{
return _msize(p);
}
+};
- template <class Type>
- static void BOOST_MEMORY_CALL destroy(Type* obj)
- {
- obj->~Type();
- free(obj);
- }
+// -------------------------------------------------------------------------
+// class system_alloc
- template <class Type>
- static Type* BOOST_MEMORY_CALL newArray(size_t count, Type* zero)
- {
- Type* array = (Type*)malloc(sizeof(Type) * count);
- return constructor_traits<Type>::constructArray(array, count);
- }
+typedef stdlib_alloc system_alloc;
- template <class Type>
- static void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count)
- {
- destructor_traits<Type>::destructArrayN(array, count);
- free(array);
- }
+// =========================================================================
+// Configurations
-#if defined(_malloc_dbg)
- static void* BOOST_MEMORY_CALL allocate(size_t cb, LPCSTR szFile, int nLine)
- { return _malloc_dbg(cb, _NORMAL_BLOCK, szFile, nLine); }
+#ifndef NS_BOOST_MEMORY_POLICY_BEGIN
+#define NS_BOOST_MEMORY_POLICY_BEGIN namespace policy {
+#define NS_BOOST_MEMORY_POLICY_END }
+#define NS_BOOST_MEMORY_POLICY boost::memory::policy
+#endif
- static void* BOOST_MEMORY_CALL allocate(size_t cb, destructor_t fn, LPCSTR szFile, int nLine)
- { return _malloc_dbg(cb, _NORMAL_BLOCK, szFile, nLine); }
-
- static void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero, LPCSTR szFile, int nLine)
- { return _malloc_dbg(cb, _NORMAL_BLOCK, szFile, nLine); }
+NS_BOOST_MEMORY_POLICY_BEGIN
- static void* BOOST_MEMORY_CALL reallocate(void* p, size_t oldSize, size_t newSize, LPCSTR szFile, int nLine)
- { return _realloc_dbg(p, newSize, _NORMAL_BLOCK, szFile, nLine); }
+class sys
+{
+public:
+ enum { MemBlockBytes = 16384 /* 16k */ };
- template <class Type>
- static Type* BOOST_MEMORY_CALL newArray(size_t count, Type* zero, LPCSTR szFile, int nLine)
- {
- Type* array = (Type*)_malloc_dbg(sizeof(Type) * count, _NORMAL_BLOCK, szFile, nLine);
- return constructor_traits<Type>::constructArray(array, count);
- }
-#else
- BOOST_MEMORY_FAKE_DBG_ALLOCATE_()
-#endif
+public:
+ typedef system_alloc alloc_type;
};
-// -------------------------------------------------------------------------
-// class system_pool_dyn
-
-STDAPI_(void*) _boost_SystemPoolAlloc(size_t cb);
-STDAPI_(void) _boost_SystemPoolFree(void* p);
-STDAPI_(size_t) _boost_SystemPoolSize(void* p);
-
-class system_pool_dyn
+class stdlib : public sys
{
public:
- static void* BOOST_MEMORY_CALL allocate(size_t cb) { return _boost_SystemPoolAlloc(cb); }
- static void BOOST_MEMORY_CALL deallocate(void* p) { _boost_SystemPoolFree(p); }
- static size_t BOOST_MEMORY_CALL alloc_size(void* p) {
- return _boost_SystemPoolSize(p);
- }
+ typedef stdlib_alloc alloc_type;
};
-// -------------------------------------------------------------------------
-// class system_alloc
+NS_BOOST_MEMORY_POLICY_END
-#if defined(BOOST_MEMORY_NO_SYSTEM_POOL)
-#define BOOST_MEMORY_NO_SYSTEM_POOL_DYN_
-#endif
-
-#if !defined(BOOST_MEMORY_NO_SYSTEM_POOL)
-typedef system_pool_dyn system_alloc;
-#else
-typedef stdlib_alloc system_alloc;
-#endif
-
-// -------------------------------------------------------------------------
+// =========================================================================
// $Log: $
NS_BOOST_MEMORY_END
Deleted: sandbox/memory/boost/memory/system_pool.hpp
==============================================================================
--- sandbox/memory/boost/memory/system_pool.hpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
+++ (empty file)
@@ -1,204 +0,0 @@
-//
-// boost/memory/system_pool.hpp
-//
-// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/memory/index.htm for documentation.
-//
-#ifndef __BOOST_MEMORY_SYSTEM_POOL_HPP__
-#define __BOOST_MEMORY_SYSTEM_POOL_HPP__
-
-#ifndef BOOST_MEMORY_BASIC_HPP
-#include "basic.hpp"
-#endif
-
-#ifndef BOOST_MEMORY_POLICY_HPP
-#include "policy.hpp"
-#endif
-
-#ifndef BOOST_DETAIL_WINAPI_WINBASE_H
-#include <boost/detail/winapi/winbase.h>
-#endif
-
-#ifndef BOOST_DETAIL_THREADMODEL_HPP
-#include <boost/detail/threadmodel.hpp>
-#endif
-
-#if 1 // defined(BOOST_DETAIL_NO_TAGGED_COMPARE_AND_SWAP_POINTER)
-#define BOOST_MEMORY_NO_LOCKFREE
-#else
-#ifndef BOOST_LOCKFREE_STACK_HPP
-#include <boost/lockfree/stack.hpp>
-#endif
-#endif
-
-NS_BOOST_MEMORY_BEGIN
-
-// -------------------------------------------------------------------------
-// class normal_stack
-
-class normal_stack
-{
-private:
- normal_stack(const normal_stack&);
- void operator=(const normal_stack&);
-
- typedef NS_BOOST_DETAIL::default_threadmodel::cs cs;
- typedef cs::scoped_lock cslock;
-
-public:
- class node
- {
- public:
- node* _m_prev;
- node* prev() const { return _m_prev; }
-#if defined(_DEBUG)
- node() : _m_prev(NULL) {}
- void prev(node* p) { _m_prev = p; }
-#endif
- };
-
-private:
- node* m_top;
- cs m_cs;
-
-public:
- normal_stack() : m_top(NULL) {}
-
- void BOOST_MEMORY_CALL push(node* val)
- {
- cslock aLock(m_cs);
- val->_m_prev = m_top;
- m_top = val;
- }
-
- node* BOOST_MEMORY_CALL clear()
- {
- cslock aLock(m_cs);
- node* the_top = m_top;
- m_top = NULL;
- return the_top;
- }
-
- node* BOOST_MEMORY_CALL pop()
- {
- cslock aLock(m_cs);
- node* the_top = m_top;
- if (the_top == NULL)
- return NULL;
- m_top = m_top->_m_prev;
- return the_top;
- }
-};
-
-#if defined(BOOST_MEMORY_NO_LOCKFREE)
-typedef normal_stack default_stack;
-#else
-typedef NS_BOOST_LOCKFREE::stack default_stack;
-#endif
-
-// -------------------------------------------------------------------------
-// class system_pool_imp
-
-template <class PolicyT, class StackT = default_stack>
-class system_pool_imp
-{
-private:
- typedef typename PolicyT::allocator_type AllocT;
- enum { cbBlock = PolicyT::MemBlockSize };
-
- typedef typename StackT::node Block;
- StackT m_freeList;
-
-private:
- system_pool_imp(const system_pool_imp&);
- void operator=(const system_pool_imp&);
-
-public:
- system_pool_imp()
- {
- }
- ~system_pool_imp()
- {
- clear();
- }
-
-public:
- void* BOOST_MEMORY_CALL allocate(size_t cb)
- {
- BOOST_MEMORY_ASSERT(cb >= (size_t)cbBlock);
-
- if (cb > (size_t)cbBlock)
- return AllocT::allocate(cb);
- {
- Block* blk = m_freeList.pop();
- if (blk)
- {
- BOOST_MEMORY_ASSERT(AllocT::alloc_size(blk) >= cb);
- return blk;
- }
- }
- return AllocT::allocate(cbBlock);
- }
-
- void BOOST_MEMORY_CALL deallocate(void* p)
- {
-#if defined(_DEBUG)
- ((Block*)p)->prev(NULL);
-#endif
- m_freeList.push((Block*)p);
- }
-
- static size_t BOOST_MEMORY_CALL alloc_size(void* p)
- {
- return AllocT::alloc_size(p);
- }
-
- void BOOST_MEMORY_CALL clear()
- {
- Block* freeList = m_freeList.clear();
- while (freeList)
- {
- Block* blk = freeList;
- freeList = freeList->prev();
- AllocT::deallocate(blk);
- }
- }
-};
-
-// -------------------------------------------------------------------------
-// class system_pool_s
-
-template <class PolicyT, class StackT = default_stack>
-class system_pool_s
-{
-private:
- typedef system_pool_imp<PolicyT, StackT> SystemPoolImpl;
-
- static SystemPoolImpl s_impl;
-
-public:
- static void* BOOST_MEMORY_CALL allocate(size_t cb) { return s_impl.allocate(cb); }
- static void BOOST_MEMORY_CALL deallocate(void* p) { s_impl.deallocate(p); }
- static size_t BOOST_MEMORY_CALL alloc_size(void* p) {
- return s_impl.alloc_size(p);
- }
-};
-
-template <class PolicyT, class StackT>
-system_pool_imp<PolicyT, StackT> system_pool_s<PolicyT, StackT>::s_impl;
-
-// -------------------------------------------------------------------------
-
-typedef system_pool_s<NS_BOOST_MEMORY_POLICY::stdlib, default_stack> system_pool;
-
-// -------------------------------------------------------------------------
-// $Log: $
-
-NS_BOOST_MEMORY_END
-
-#endif /* __BOOST_MEMORY_SYSTEM_POOL_HPP__ */
Deleted: sandbox/memory/boost/memory/tls_gc_alloc.hpp
==============================================================================
--- sandbox/memory/boost/memory/tls_gc_alloc.hpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
+++ (empty file)
@@ -1,130 +0,0 @@
-//
-// boost/memory/gc_alloc.hpp
-//
-// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/memory/index.htm for documentation.
-//
-#ifndef BOOST_MEMORY_TLS_GC_ALLOC_HPP
-#define BOOST_MEMORY_TLS_GC_ALLOC_HPP
-
-#ifndef BOOST_MEMORY_GC_ALLOC_HPP
-#include "gc_alloc.hpp"
-#endif
-
-NS_BOOST_MEMORY_BEGIN
-
-// -------------------------------------------------------------------------
-// class tls_gc_alloc
-
-typedef tls_object<gc_alloc> tls_gc_alloc_t;
-
-STDAPI_(tls_gc_alloc_t*) _boost_TlsGcAlloc();
-
-template <class Unused>
-class tls_gc_alloc_imp
-{
-private:
- static tls_gc_alloc_t* _tls_gcAlloc;
-
-public:
- typedef gc_alloc allocator_type;
-
- tls_gc_alloc_imp() {
- _tls_gcAlloc->init();
- }
- ~tls_gc_alloc_imp() {
- _tls_gcAlloc->term();
- }
-
- static allocator_type& BOOST_MEMORY_CALL instance()
- {
- return _tls_gcAlloc->get();
- }
-
- static void BOOST_MEMORY_CALL clear()
- {
- _tls_gcAlloc->get().clear();
- }
-
- static void* BOOST_MEMORY_CALL allocate(const size_t cbData)
- {
- return _tls_gcAlloc->get().allocate(cbData);
- }
-
- static void* BOOST_MEMORY_CALL allocate(const size_t cbData0, destructor_t fn)
- {
- return _tls_gcAlloc->get().allocate(cbData0, fn);
- }
-
- static void* BOOST_MEMORY_CALL allocate(size_t cb, int fnZero)
- {
- return _tls_gcAlloc->get().allocate(cb);
- }
-
- static void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cbData0, destructor_t fn)
- {
- return _tls_gcAlloc->get().unmanaged_alloc(cbData0, fn);
- }
-
- static void* BOOST_MEMORY_CALL manage(void* p, destructor_t fn)
- {
- return _tls_gcAlloc->get().manage(p, fn);
- }
-
- static void* BOOST_MEMORY_CALL unmanaged_alloc(size_t cb, int fnZero)
- {
- return _tls_gcAlloc->get().allocate(cb);
- }
-
- static void* BOOST_MEMORY_CALL manage(void* p, int fnZero)
- {
- return p;
- }
-
- static void BOOST_MEMORY_CALL deallocate(void* pData, const size_t cbData)
- {
- _tls_gcAlloc->get().deallocate(pData, cbData);
- }
-
- static void* BOOST_MEMORY_CALL reallocate(void* p, size_t oldSize, size_t newSize)
- {
- return _tls_gcAlloc->get().reallocate(p, oldSize, newSize);
- }
-
- template <class Type>
- static void BOOST_MEMORY_CALL destroy(Type* obj)
- {
- _tls_gcAlloc->get().destroy(obj);
- }
-
- template <class Type>
- static Type* BOOST_MEMORY_CALL newArray(size_t count, Type* zero)
- {
- return _tls_gcAlloc->get().newArray(count, zero);
- }
-
- template <class Type>
- static void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count)
- {
- return _tls_gcAlloc->get().destroyArray(array, count);
- }
-
- BOOST_MEMORY_FAKE_DBG_ALLOCATE_();
-};
-
-template <class Unused>
-tls_gc_alloc_t* tls_gc_alloc_imp<Unused>::_tls_gcAlloc = _boost_TlsGcAlloc();
-
-typedef tls_gc_alloc_imp<int> tls_gc_alloc;
-
-// -------------------------------------------------------------------------
-// $Log: tls_gc_alloc.hpp,v $
-
-NS_BOOST_MEMORY_END
-
-#endif /* BOOST_MEMORY_TLS_GC_ALLOC_HPP */
Added: sandbox/memory/boost/memory/type_traits.hpp
==============================================================================
--- (empty file)
+++ sandbox/memory/boost/memory/type_traits.hpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -0,0 +1,259 @@
+//
+// boost/memory/type_traits.hpp
+//
+// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/memory/index.htm for documentation.
+//
+#ifndef BOOST_MEMORY_TYPE_TRAITS_HPP
+#define BOOST_MEMORY_TYPE_TRAITS_HPP
+
+#ifndef BOOST_MEMORY_BASIC_HPP
+#include "basic.hpp"
+#endif
+
+NS_BOOST_MEMORY_BEGIN
+
+// =========================================================================
+// class constructor_traits
+
+template <class Type>
+struct constructor_traits
+{
+ static void BOOST_MEMORY_CALL construct(void* data)
+ {
+ new(data) Type;
+ }
+
+ static void BOOST_MEMORY_CALL constructArray(Type* array, size_t count)
+ {
+ for (size_t i = 0; i < count; ++i)
+ new(array + i) Type;
+ }
+};
+
+// -------------------------------------------------------------------------
+// BOOST_MEMORY_NO_CONSTRUCTOR
+
+#define BOOST_MEMORY_NO_CONSTRUCTOR_(Type) \
+template <> \
+struct constructor_traits< Type > \
+{ \
+ static void BOOST_MEMORY_CALL construct(void* data) {} \
+ static void BOOST_MEMORY_CALL constructArray(Type*, size_t) {} \
+};
+
+#define BOOST_MEMORY_NO_CONSTRUCTOR(Type) \
+ NS_BOOST_MEMORY_BEGIN \
+ BOOST_MEMORY_NO_CONSTRUCTOR_(Type) \
+ NS_BOOST_MEMORY_END
+
+// =========================================================================
+// class destructor_traits
+
+typedef void BOOST_MEMORY_CALL BOOST_FnDestructor(void* data);
+typedef BOOST_FnDestructor* destructor_t;
+
+template <class Type>
+struct destructor_traits
+{
+ enum { hasDestructor = 1 };
+
+ typedef destructor_t destructor_type;
+
+ static void BOOST_MEMORY_CALL destruct(void* data)
+ {
+ ((Type*)data)->~Type();
+ }
+
+ static void BOOST_MEMORY_CALL destructArray(Type* array, size_t count)
+ {
+ for (size_t i = 0; i < count; ++i)
+ array[i].~Type();
+ }
+};
+
+template <class Type>
+inline void BOOST_MEMORY_CALL destroyArray(Type* array, size_t count)
+{
+ destructor_traits<Type>::destructArray(array, count);
+}
+
+// -------------------------------------------------------------------------
+// BOOST_MEMORY_NO_DESTRUCTOR
+
+#define BOOST_MEMORY_NO_DESTRUCTOR_(Type) \
+template <> \
+struct destructor_traits< Type > \
+{ \
+ typedef int destructor_type; \
+ \
+ enum { hasDestructor = 0 }; \
+ enum { destruct = 0 }; \
+ \
+ static void BOOST_MEMORY_CALL destructArray(Type*, size_t) {} \
+};
+
+#define BOOST_MEMORY_NO_DESTRUCTOR(Type) \
+ NS_BOOST_MEMORY_BEGIN \
+ BOOST_MEMORY_NO_DESTRUCTOR_(Type) \
+ NS_BOOST_MEMORY_END
+
+// =========================================================================
+// class array_factory
+
+template <class Type>
+struct array_factory_has_destructor
+{
+ struct destructor_header {
+ size_t count;
+ };
+
+ static size_t BOOST_MEMORY_CALL alloc_size(size_t count)
+ {
+ return sizeof(destructor_header) + sizeof(Type)*count;
+ }
+
+ static void BOOST_MEMORY_CALL destruct(void* data)
+ {
+ destructor_header* hdr = (destructor_header*)data;
+ destructor_traits<Type>::destructArray((Type*)(hdr + 1), hdr->count);
+ }
+
+#if defined(BOOST_MEMORY_NO_STRICT_EXCEPTION_SEMANTICS)
+ template <class AllocT>
+ static Type* BOOST_MEMORY_CALL create(AllocT& alloc, size_t count)
+ {
+ destructor_header* hdr =
+ (destructor_header*)alloc.allocate(
+ sizeof(destructor_header) + sizeof(Type)*count, destruct);
+ Type* array = (Type*)hdr + 1;
+ hdr->count = count;
+ constructor_traits<Type>::constructArray(array, count);
+ return array;
+ }
+#else
+ template <class AllocT>
+ static Type* BOOST_MEMORY_CALL create(AllocT& alloc, size_t count)
+ {
+ destructor_header* hdr =
+ (destructor_header*)alloc.unmanaged_alloc(
+ sizeof(destructor_header) + sizeof(Type)*count, destruct);
+ Type* array = (Type*)hdr + 1;
+ hdr->count = count;
+ constructor_traits<Type>::constructArray(array, count);
+ return (Type*)alloc.manage(array, destruct);
+ }
+#endif
+
+ static char* BOOST_MEMORY_CALL buffer(Type* array)
+ {
+ return (char*)array - sizeof(destructor_header);
+ }
+
+ static size_t BOOST_MEMORY_CALL size(Type* array)
+ {
+ return ((destructor_header*)array - 1)->count;
+ }
+};
+
+template <class Type>
+struct array_factory_no_destructor
+{
+ enum { destruct = 0 };
+
+ typedef void destructor_header;
+
+ static size_t BOOST_MEMORY_CALL alloc_size(size_t count)
+ {
+ return sizeof(Type)*count;
+ }
+
+ template <class AllocT>
+ static Type* BOOST_MEMORY_CALL create(AllocT& alloc, size_t count)
+ {
+ Type* array = (Type*)alloc.allocate(sizeof(Type)*count);
+ constructor_traits<Type>::constructArray(array, count);
+ return array;
+ }
+
+ static char* BOOST_MEMORY_CALL buffer(Type* array)
+ {
+ return (char*)array;
+ }
+
+ static size_t BOOST_MEMORY_CALL size(Type* array)
+ {
+ BOOST_MEMORY_ASSERT( !"Don't call me!!!" );
+ return 0;
+ }
+};
+
+#if defined(BOOST_MEMORY_NO_PARTIAL_SPECIALIZATION)
+
+template <class Type>
+struct array_factory_impl_
+{
+ template <int hasDestructor>
+ struct traits_ : array_factory_has_destructor<Type> {};
+
+ template <>
+ struct traits_<0> : array_factory_no_destructor<Type> {};
+
+ typedef traits_<destructor_traits<Type>::hasDestructor> traits;
+};
+
+template <class Type>
+struct array_factory : array_factory_impl_<Type>::traits
+{
+};
+
+#else
+
+template <class Type, int hasDestructor = destructor_traits<Type>::hasDestructor>
+struct array_factory : array_factory_has_destructor<Type> {};
+
+template <class Type>
+struct array_factory<Type, 0> : array_factory_no_destructor<Type> {};
+
+#endif
+
+// =========================================================================
+// C Standard Types Support
+
+#define BOOST_MEMORY_DECL_CTYPE_(Type) \
+ BOOST_MEMORY_NO_CONSTRUCTOR_(Type); \
+ BOOST_MEMORY_NO_DESTRUCTOR_(Type)
+
+#define BOOST_MEMORY_DECL_CTYPE(Type) \
+ BOOST_MEMORY_NO_CONSTRUCTOR(Type); \
+ BOOST_MEMORY_NO_DESTRUCTOR(Type)
+
+// -------------------------------------------------------------------------
+
+BOOST_MEMORY_DECL_CTYPE_(bool);
+BOOST_MEMORY_DECL_CTYPE_(float);
+BOOST_MEMORY_DECL_CTYPE_(double);
+
+BOOST_MEMORY_DECL_CTYPE_(int);
+BOOST_MEMORY_DECL_CTYPE_(unsigned int);
+
+BOOST_MEMORY_DECL_CTYPE_(char);
+BOOST_MEMORY_DECL_CTYPE_(unsigned char);
+
+BOOST_MEMORY_DECL_CTYPE_(short);
+BOOST_MEMORY_DECL_CTYPE_(unsigned short);
+
+BOOST_MEMORY_DECL_CTYPE_(long);
+BOOST_MEMORY_DECL_CTYPE_(unsigned long);
+
+// =========================================================================
+// $Log: $
+
+NS_BOOST_MEMORY_END
+
+#endif /* BOOST_MEMORY_TYPE_TRAITS_HPP */
Modified: sandbox/memory/libs/memory/bin/li32/libboost-memory.so
==============================================================================
Binary files. No diff available.
Modified: sandbox/memory/libs/memory/build/Makefile.li32
==============================================================================
--- sandbox/memory/libs/memory/build/Makefile.li32 (original)
+++ sandbox/memory/libs/memory/build/Makefile.li32 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -19,7 +19,7 @@
ProductDir = ../bin/$(Platform)
ObjectDir = LRelease
Product = ../bin/$(Platform)/libboost-memory.so
- CFlags = $(Defines) -fPIC -D__32BIT__ -D__INTEL__ -D__LINUX__ -DLINUX -DNDEBUG -O2 -D_MT -fexceptions -Wall
+ CFlags = $(Defines) -fPIC -D__32BIT__ -D__INTEL__ -D__LINUX__ -DLINUX -DNDEBUG -O2 -D_MT -fexceptions -Wall
CXXFlags = $(CFlags) -fno-rtti
CompileC = @gcc -c $(IncludeDir) $(CFlags) -o $@ $<
CompileCXX = @g++ -c $(IncludeDir) $(CXXFlags) -o $@ $<
@@ -37,7 +37,7 @@
ProductDir = ../bin/$(Platform)
ObjectDir = LReleaseCS
Product = ../bin/$(Platform)/libboost-memory-cs.so
- CFlags = $(Defines) -fPIC -D__32BIT__ -D__INTEL__ -D__LINUX__ -DLINUX -DNDEBUG -O2 -D_MT -fexceptions -Wall
+ CFlags = $(Defines) -fPIC -D__32BIT__ -D__INTEL__ -D__LINUX__ -DLINUX -DNDEBUG -O2 -D_MT -fexceptions -Wall
CXXFlags = $(CFlags) -fno-rtti
CompileC = @gcc -c $(IncludeDir) $(CFlags) -o $@ $<
CompileCXX = @g++ -c $(IncludeDir) $(CXXFlags) -o $@ $<
@@ -54,7 +54,7 @@
ProductDir = Debug
ObjectDir = LDebug
Product = Debug/libboost-memory.so
- CFlags = $(Defines) -fPIC -D__32BIT__ -D__INTEL__ -D__LINUX__ -DLINUX -D_DEBUG -g3 -D_MT -fexceptions -Wall
+ CFlags = $(Defines) -fPIC -D__32BIT__ -D__INTEL__ -D__LINUX__ -DLINUX -D_DEBUG -g3 -D_MT -fexceptions -Wall
CXXFlags = $(CFlags) -fno-rtti
CompileC = @gcc -c $(IncludeDir) $(CFlags) -o $@ $<
CompileCXX = @g++ -c $(IncludeDir) $(CXXFlags) -o $@ $<
@@ -96,16 +96,8 @@
../src/block_pool.cpp
@echo "---> Compiling" $< "..."
$(CompileCXX)
-$(ObjectDir)/gc_alloc.o : \
- ../src/gc_alloc.cpp
- @echo "---> Compiling" $< "..."
- $(CompileCXX)
-$(ObjectDir)/system_pool.o : \
- ../src/system_pool.cpp
- @echo "---> Compiling" $< "..."
- $(CompileCXX)
-Objects = $(ObjectDir)/block_pool.o $(ObjectDir)/gc_alloc.o $(ObjectDir)/system_pool.o
+Objects = $(ObjectDir)/block_pool.o
$(Product) : $(Objects)
@echo "---> Creating" $@ "..."
Modified: sandbox/memory/libs/memory/build/Makefile.li64
==============================================================================
--- sandbox/memory/libs/memory/build/Makefile.li64 (original)
+++ sandbox/memory/libs/memory/build/Makefile.li64 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -19,7 +19,7 @@
ProductDir = ../bin/$(Platform)
ObjectDir = LRelease
Product = ../bin/$(Platform)/libboost-memory.so
- CFlags = $(Defines) -fPIC -D__64BIT__ -D__INTEL__ -D__LINUX__ -DLINUX -DNDEBUG -O2 -D_MT -fexceptions -Wall
+ CFlags = $(Defines) -fPIC -D__64BIT__ -D__INTEL__ -D__LINUX__ -DLINUX -DNDEBUG -O2 -D_MT -fexceptions -Wall
CXXFlags = $(CFlags) -fno-rtti
CompileC = @gcc -c $(IncludeDir) $(CFlags) -o $@ $<
CompileCXX = @g++ -c $(IncludeDir) $(CXXFlags) -o $@ $<
@@ -37,7 +37,7 @@
ProductDir = ../bin/$(Platform)
ObjectDir = LReleaseCS
Product = ../bin/$(Platform)/libboost-memory-cs.so
- CFlags = $(Defines) -fPIC -D__64BIT__ -D__INTEL__ -D__LINUX__ -DLINUX -DNDEBUG -O2 -D_MT -fexceptions -Wall
+ CFlags = $(Defines) -fPIC -D__64BIT__ -D__INTEL__ -D__LINUX__ -DLINUX -DNDEBUG -O2 -D_MT -fexceptions -Wall
CXXFlags = $(CFlags) -fno-rtti
CompileC = @gcc -c $(IncludeDir) $(CFlags) -o $@ $<
CompileCXX = @g++ -c $(IncludeDir) $(CXXFlags) -o $@ $<
@@ -54,7 +54,7 @@
ProductDir = Debug
ObjectDir = LDebug
Product = Debug/libboost-memory.so
- CFlags = $(Defines) -fPIC -D__64BIT__ -D__INTEL__ -D__LINUX__ -DLINUX -D_DEBUG -g3 -D_MT -fexceptions -Wall
+ CFlags = $(Defines) -fPIC -D__64BIT__ -D__INTEL__ -D__LINUX__ -DLINUX -D_DEBUG -g3 -D_MT -fexceptions -Wall
CXXFlags = $(CFlags) -fno-rtti
CompileC = @gcc -c $(IncludeDir) $(CFlags) -o $@ $<
CompileCXX = @g++ -c $(IncludeDir) $(CXXFlags) -o $@ $<
@@ -96,16 +96,8 @@
../src/block_pool.cpp
@echo "---> Compiling" $< "..."
$(CompileCXX)
-$(ObjectDir)/gc_alloc.o : \
- ../src/gc_alloc.cpp
- @echo "---> Compiling" $< "..."
- $(CompileCXX)
-$(ObjectDir)/system_pool.o : \
- ../src/system_pool.cpp
- @echo "---> Compiling" $< "..."
- $(CompileCXX)
-Objects = $(ObjectDir)/block_pool.o $(ObjectDir)/gc_alloc.o $(ObjectDir)/system_pool.o
+Objects = $(ObjectDir)/block_pool.o
$(Product) : $(Objects)
@echo "---> Creating" $@ "..."
Modified: sandbox/memory/libs/memory/build/_export_.def
==============================================================================
--- sandbox/memory/libs/memory/build/_export_.def (original)
+++ sandbox/memory/libs/memory/build/_export_.def 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -1,8 +1,5 @@
EXPORTED {
global:
_boost_TlsBlockPool;
- _boost_SystemPoolAlloc;
- _boost_SystemPoolFree;
- _boost_SystemPoolSize;
local: *;
};
Modified: sandbox/memory/libs/memory/build/build.def
==============================================================================
--- sandbox/memory/libs/memory/build/build.def (original)
+++ sandbox/memory/libs/memory/build/build.def 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -1,5 +1,3 @@
EXPORTS
_boost_TlsBlockPool
- _boost_SystemPoolAlloc
- _boost_SystemPoolFree
- _boost_SystemPoolSize
+
Modified: sandbox/memory/libs/memory/build/build.prj
==============================================================================
--- sandbox/memory/libs/memory/build/build.prj (original)
+++ sandbox/memory/libs/memory/build/build.prj 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -25,5 +25,5 @@
Libraries pthread
[Source]
-../src/*.cpp
+../src/block_pool.cpp
Modified: sandbox/memory/libs/memory/build/vc8-win32.vcproj
==============================================================================
--- sandbox/memory/libs/memory/build/vc8-win32.vcproj (original)
+++ sandbox/memory/libs/memory/build/vc8-win32.vcproj 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="8.00"
Name="boost-memory"
- ProjectGUID="{E936205C-025A-B3AF-F648-B8515ABF7672}"
+ ProjectGUID="{D8CD4A70-DA98-5617-A10A-1F2E662215FE}"
>
<Platforms>
<Platform
@@ -294,14 +294,6 @@
RelativePath="..\src\block_pool.cpp"
>
</File>
- <File
- RelativePath="..\src\gc_alloc.cpp"
- >
- </File>
- <File
- RelativePath="..\src\system_pool.cpp"
- >
- </File>
</Files>
<Globals>
</Globals>
Modified: sandbox/memory/libs/memory/build/vc8-win64.vcproj
==============================================================================
--- sandbox/memory/libs/memory/build/vc8-win64.vcproj (original)
+++ sandbox/memory/libs/memory/build/vc8-win64.vcproj 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="8.00"
Name="boost-memory"
- ProjectGUID="{5590DF14-0A33-2F4C-BBD0-E7B868CA555C}"
+ ProjectGUID="{7E5E522C-4C36-9DFC-8036-BAB397B16671}"
>
<Platforms>
<Platform
@@ -294,14 +294,6 @@
RelativePath="..\src\block_pool.cpp"
>
</File>
- <File
- RelativePath="..\src\gc_alloc.cpp"
- >
- </File>
- <File
- RelativePath="..\src\system_pool.cpp"
- >
- </File>
</Files>
<Globals>
</Globals>
Deleted: sandbox/memory/libs/memory/src/system_pool.cpp
==============================================================================
--- sandbox/memory/libs/memory/src/system_pool.cpp 2008-10-11 09:39:15 EDT (Sat, 11 Oct 2008)
+++ (empty file)
@@ -1,40 +0,0 @@
-//
-// boost/memory/system_pool.cpp
-//
-// Copyright (c) 2004 - 2008 xushiwei (xushiweizh_at_[hidden])
-//
-// Distributed under the Boost Software License, Version 1.0. (See
-// accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/memory/index.htm for documentation.
-//
-#include "stdafx.h"
-
-// -------------------------------------------------------------------------
-
-#if 1 // defined(_WIN32)
-
-#include <boost/memory/system_pool.hpp>
-
-using namespace NS_BOOST_MEMORY;
-
-STDAPI_(void*) _boost_SystemPoolAlloc(size_t cb)
-{
- return system_pool::allocate(cb);
-}
-
-STDAPI_(void) _boost_SystemPoolFree(void* p)
-{
- system_pool::deallocate(p);
-}
-
-STDAPI_(size_t) _boost_SystemPoolSize(void* p)
-{
- return system_pool::alloc_size(p);
-}
-
-#endif
-
-// -------------------------------------------------------------------------
-// $Log: $
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk