Commit 6571df13 by Benjamin Kosnik Committed by Benjamin Kosnik

mt_allocator.h (__common_pool_policy): Add template template parameter for pool class type.


2004-10-28  Benjamin Kosnik  <bkoz@redhat.com>

	* include/ext/mt_allocator.h (__common_pool_policy): Add template
	template parameter for pool class type.
	(__per_type_pool_policy): Same.
	(__mt_allocator): Don't inherit policy. Qualify policy_type calls.
	* testsuite/ext/mt_allocator/check_deallocate_null.cc: Fix.
	* testsuite/ext/mt_allocator/check_deallocate_null_thread.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_global-2.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_global-4.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_global_thread-1.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_global_thread-3.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_local-2.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_local-4.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_local_thread-1.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_local_thread-3.cc: Same.
	* testsuite/ext/mt_allocator/instantiate.cc: Same.
	* testsuite/ext/mt_allocator/tune-1.cc: Same.
	* testsuite/ext/mt_allocator/tune-2.cc: Same.
	* testsuite/ext/mt_allocator/tune-3.cc: Same.
	* testsuite/ext/mt_allocator/tune-4.cc: Same.

From-SVN: r89776
parent a827e21a
2004-10-28 Benjamin Kosnik <bkoz@redhat.com>
* include/ext/mt_allocator.h (__common_pool_policy): Add template
template parameter for pool class type.
(__per_type_pool_policy): Same.
(__mt_allocator): Don't inherit policy. Qualify policy_type calls.
* testsuite/ext/mt_allocator/check_deallocate_null.cc: Fix.
* testsuite/ext/mt_allocator/check_deallocate_null_thread.cc: Same.
* testsuite/ext/mt_allocator/deallocate_global-2.cc: Same.
* testsuite/ext/mt_allocator/deallocate_global-4.cc: Same.
* testsuite/ext/mt_allocator/deallocate_global_thread-1.cc: Same.
* testsuite/ext/mt_allocator/deallocate_global_thread-3.cc: Same.
* testsuite/ext/mt_allocator/deallocate_local-2.cc: Same.
* testsuite/ext/mt_allocator/deallocate_local-4.cc: Same.
* testsuite/ext/mt_allocator/deallocate_local_thread-1.cc: Same.
* testsuite/ext/mt_allocator/deallocate_local_thread-3.cc: Same.
* testsuite/ext/mt_allocator/instantiate.cc: Same.
* testsuite/ext/mt_allocator/tune-1.cc: Same.
* testsuite/ext/mt_allocator/tune-2.cc: Same.
* testsuite/ext/mt_allocator/tune-3.cc: Same.
* testsuite/ext/mt_allocator/tune-4.cc: Same.
2004-10-28 Paolo Carlini <pcarlini@suse.de> 2004-10-28 Paolo Carlini <pcarlini@suse.de>
* include/bits/locale_facets.tcc (num_get<>::_M_extract_float): * include/bits/locale_facets.tcc (num_get<>::_M_extract_float):
......
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
int main() int main()
{ {
typedef int value_type; typedef int value_type;
typedef __gnu_cxx::__common_pool_policy<false> policy_type; using __gnu_cxx::__pool;
typedef __gnu_cxx::__common_pool_policy<__pool, false> policy_type;
typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
__gnu_test::check_deallocate_null<allocator_type>(); __gnu_test::check_deallocate_null<allocator_type>();
return 0; return 0;
......
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
int main() int main()
{ {
typedef int value_type; typedef int value_type;
typedef __gnu_cxx::__common_pool_policy<true> policy_type; using __gnu_cxx::__pool;
typedef __gnu_cxx::__common_pool_policy<__pool, true> policy_type;
typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
__gnu_test::check_deallocate_null<allocator_type>(); __gnu_test::check_deallocate_null<allocator_type>();
return 0; return 0;
......
...@@ -67,7 +67,9 @@ void operator delete(void* p) throw() ...@@ -67,7 +67,9 @@ void operator delete(void* p) throw()
} }
typedef std::string value_type; typedef std::string value_type;
typedef __gnu_cxx::__common_pool_policy<false> policy_type; using __gnu_cxx::__pool;
using __gnu_cxx::__common_pool_policy;
typedef __common_pool_policy<__pool, false> policy_type;
typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
typedef std::char_traits<value_type> traits_type; typedef std::char_traits<value_type> traits_type;
typedef std::list<value_type, allocator_type> list_type; typedef std::list<value_type, allocator_type> list_type;
......
...@@ -67,7 +67,9 @@ void operator delete(void* p) throw() ...@@ -67,7 +67,9 @@ void operator delete(void* p) throw()
} }
typedef std::string value_t; typedef std::string value_t;
typedef __gnu_cxx::__per_type_pool_policy<value_t, false> policy_type; using __gnu_cxx::__pool;
using __gnu_cxx::__per_type_pool_policy;
typedef __per_type_pool_policy<value_t, __pool, false> policy_type;
typedef __gnu_cxx::__mt_alloc<value_t, policy_type> allocator_type; typedef __gnu_cxx::__mt_alloc<value_t, policy_type> allocator_type;
typedef std::char_traits<value_t> traits_type; typedef std::char_traits<value_t> traits_type;
typedef std::list<value_t, allocator_type> list_type; typedef std::list<value_t, allocator_type> list_type;
......
...@@ -67,7 +67,9 @@ void operator delete(void* p) throw() ...@@ -67,7 +67,9 @@ void operator delete(void* p) throw()
} }
typedef std::string value_type; typedef std::string value_type;
typedef __gnu_cxx::__common_pool_policy<true> policy_type; using __gnu_cxx::__pool;
using __gnu_cxx::__common_pool_policy;
typedef __common_pool_policy<__pool, true> policy_type;
typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
typedef std::char_traits<value_type> traits_type; typedef std::char_traits<value_type> traits_type;
typedef std::list<value_type, allocator_type> list_type; typedef std::list<value_type, allocator_type> list_type;
......
...@@ -67,7 +67,9 @@ void operator delete(void* p) throw() ...@@ -67,7 +67,9 @@ void operator delete(void* p) throw()
} }
typedef std::string value_type; typedef std::string value_type;
typedef __gnu_cxx::__per_type_pool_policy<value_type, true> policy_type; using __gnu_cxx::__pool;
using __gnu_cxx::__per_type_pool_policy;
typedef __per_type_pool_policy<value_type, __pool, true> policy_type;
typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
typedef std::char_traits<value_type> traits_type; typedef std::char_traits<value_type> traits_type;
typedef std::list<value_type, allocator_type> list_type; typedef std::list<value_type, allocator_type> list_type;
......
...@@ -66,7 +66,8 @@ void operator delete(void* p) throw() ...@@ -66,7 +66,8 @@ void operator delete(void* p) throw()
typedef char value_type; typedef char value_type;
typedef std::char_traits<value_type> traits_type; typedef std::char_traits<value_type> traits_type;
typedef __gnu_cxx::__common_pool_policy<false> policy_type; using __gnu_cxx::__pool;
typedef __gnu_cxx::__common_pool_policy<__pool, false> policy_type;
typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
typedef std::basic_string<value_type, traits_type, allocator_type> string_type; typedef std::basic_string<value_type, traits_type, allocator_type> string_type;
......
...@@ -66,7 +66,9 @@ void operator delete(void* p) throw() ...@@ -66,7 +66,9 @@ void operator delete(void* p) throw()
typedef char value_type; typedef char value_type;
typedef std::char_traits<value_type> traits_type; typedef std::char_traits<value_type> traits_type;
typedef __gnu_cxx::__per_type_pool_policy<value_type, false> policy_type; using __gnu_cxx::__pool;
using __gnu_cxx::__per_type_pool_policy;
typedef __per_type_pool_policy<value_type, __pool, false> policy_type;
typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
typedef std::basic_string<value_type, traits_type, allocator_type> string_type; typedef std::basic_string<value_type, traits_type, allocator_type> string_type;
......
...@@ -66,7 +66,8 @@ void operator delete(void* p) throw() ...@@ -66,7 +66,8 @@ void operator delete(void* p) throw()
typedef char value_type; typedef char value_type;
typedef std::char_traits<value_type> traits_type; typedef std::char_traits<value_type> traits_type;
typedef __gnu_cxx::__common_pool_policy<true> policy_type; using __gnu_cxx::__pool;
typedef __gnu_cxx::__common_pool_policy<__pool, true> policy_type;
typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
typedef std::basic_string<value_type, traits_type, allocator_type> string_type; typedef std::basic_string<value_type, traits_type, allocator_type> string_type;
......
...@@ -66,7 +66,9 @@ void operator delete(void* p) throw() ...@@ -66,7 +66,9 @@ void operator delete(void* p) throw()
typedef char value_type; typedef char value_type;
typedef std::char_traits<value_type> traits_type; typedef std::char_traits<value_type> traits_type;
typedef __gnu_cxx::__per_type_pool_policy<value_type, true> policy_type; using __gnu_cxx::__pool;
using __gnu_cxx::__per_type_pool_policy;
typedef __per_type_pool_policy<value_type, __pool, true> policy_type;
typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
typedef std::basic_string<value_type, traits_type, allocator_type> string_type; typedef std::basic_string<value_type, traits_type, allocator_type> string_type;
......
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
using namespace __gnu_cxx; using namespace __gnu_cxx;
template class __mt_alloc<int>; template class __mt_alloc<int>;
template class __mt_alloc<short, __common_pool_policy<false> >; template class __mt_alloc<short, __common_pool_policy<__pool, false> >;
template class __mt_alloc<short, __per_type_pool_policy<short, false> >; template class __mt_alloc<short, __per_type_pool_policy<short, __pool, false> >;
#ifdef __GTHREADS #ifdef __GTHREADS
template class __mt_alloc<short, __common_pool_policy<true> >; template class __mt_alloc<short, __common_pool_policy<__pool, true> >;
template class __mt_alloc<short, __per_type_pool_policy<short, true> >; template class __mt_alloc<short, __per_type_pool_policy<short, __pool, true> >;
#endif #endif
...@@ -29,10 +29,14 @@ void test01() ...@@ -29,10 +29,14 @@ void test01()
bool test __attribute__((unused)) = true; bool test __attribute__((unused)) = true;
typedef __gnu_test::pod_int value_type; typedef __gnu_test::pod_int value_type;
using __gnu_cxx::__pool;
using __gnu_cxx::__common_pool_policy;
#ifdef __GTHREADS #ifdef __GTHREADS
typedef __gnu_cxx::__common_pool_policy<true> policy_type; typedef __common_pool_policy<__pool, true> policy_type;
#else #else
typedef __gnu_cxx::__common_pool_policy<false> policy_type; typedef __common_pool_policy<__pool, false> policy_type;
#endif #endif
typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
typedef __gnu_cxx::__pool_base::_Tune tune_type; typedef __gnu_cxx::__pool_base::_Tune tune_type;
......
...@@ -29,10 +29,14 @@ void test02() ...@@ -29,10 +29,14 @@ void test02()
bool test __attribute__((unused)) = true; bool test __attribute__((unused)) = true;
typedef __gnu_test::pod_int value_type; typedef __gnu_test::pod_int value_type;
using __gnu_cxx::__pool;
using __gnu_cxx::__per_type_pool_policy;
#ifdef __GTHREADS #ifdef __GTHREADS
typedef __gnu_cxx::__per_type_pool_policy<value_type, true> policy_type; typedef __per_type_pool_policy<value_type, __pool, true> policy_type;
#else #else
typedef __gnu_cxx::__per_type_pool_policy<value_type, false> policy_type; typedef __per_type_pool_policy<value_type, __pool, false> policy_type;
#endif #endif
typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type; typedef __gnu_cxx::__mt_alloc<value_type, policy_type> allocator_type;
typedef __gnu_cxx::__pool_base::_Tune tune_type; typedef __gnu_cxx::__pool_base::_Tune tune_type;
......
...@@ -27,12 +27,16 @@ template<typename _Tp> ...@@ -27,12 +27,16 @@ template<typename _Tp>
struct test_policy struct test_policy
{ static bool per_type() { return true; } }; { static bool per_type() { return true; } };
template<bool _Thread> using __gnu_cxx::__pool;
struct test_policy<__gnu_cxx::__common_pool_policy<_Thread> > using __gnu_cxx::__common_pool_policy;
{
typedef __gnu_cxx::__common_pool_policy<_Thread> policy_type; template<>
static bool per_type() { return false; } struct test_policy<__common_pool_policy<__pool, true> >
}; { static bool per_type() { return false; } };
template<>
struct test_policy<__common_pool_policy<__pool, false> >
{ static bool per_type() { return false; } };
// Tune characteristics, two of different types // Tune characteristics, two of different types
template<typename _Tp, typename _Cp> template<typename _Tp, typename _Cp>
...@@ -85,12 +89,12 @@ void test03() ...@@ -85,12 +89,12 @@ void test03()
int main() int main()
{ {
#ifdef __GTHREADS #ifdef __GTHREADS
test03<int, __gnu_cxx::__per_type_pool_policy<int, true> >(); test03<int, __gnu_cxx::__per_type_pool_policy<int, __pool, true> >();
test03<int, __gnu_cxx::__common_pool_policy<true> >(); test03<int, __gnu_cxx::__common_pool_policy<__pool, true> >();
#endif #endif
test03<int, __gnu_cxx::__common_pool_policy<false> >(); test03<int, __gnu_cxx::__per_type_pool_policy<int, __pool, false> >();
test03<int, __gnu_cxx::__per_type_pool_policy<int, false> >(); test03<int, __gnu_cxx::__common_pool_policy<__pool, false> >();
return 0; return 0;
} }
...@@ -27,12 +27,16 @@ template<typename _Tp> ...@@ -27,12 +27,16 @@ template<typename _Tp>
struct test_policy struct test_policy
{ static bool per_type() { return true; } }; { static bool per_type() { return true; } };
template<bool _Thread> using __gnu_cxx::__pool;
struct test_policy<__gnu_cxx::__common_pool_policy<_Thread> > using __gnu_cxx::__common_pool_policy;
{
typedef __gnu_cxx::__common_pool_policy<_Thread> policy_type; template<>
static bool per_type() { return false; } struct test_policy<__common_pool_policy<__pool, true> >
}; { static bool per_type() { return false; } };
template<>
struct test_policy<__common_pool_policy<__pool, false> >
{ static bool per_type() { return false; } };
struct pod2 struct pod2
{ {
...@@ -104,11 +108,11 @@ void test04() ...@@ -104,11 +108,11 @@ void test04()
int main() int main()
{ {
#ifdef __GTHREADS #ifdef __GTHREADS
test04<float, __gnu_cxx::__common_pool_policy<true> >(); test04<float, __gnu_cxx::__common_pool_policy<__pool, true> >();
test04<double, __gnu_cxx::__per_type_pool_policy<double, true> >(); test04<double, __gnu_cxx::__per_type_pool_policy<double, __pool, true> >();
#endif #endif
test04<float, __gnu_cxx::__common_pool_policy<false> >(); test04<float, __gnu_cxx::__common_pool_policy<__pool, false> >();
test04<double, __gnu_cxx::__per_type_pool_policy<double, false> >(); test04<double, __gnu_cxx::__per_type_pool_policy<double, __pool, false> >();
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment