From 375daafd336e7d30887c28b5d0868d9067ebb3a3 Mon Sep 17 00:00:00 2001 From: bkoz Date: Fri, 23 Sep 2005 23:53:07 +0000 Subject: [PATCH] 2005-09-23 Benjamin Kosnik * testsuite/ext/mt_allocator/tune-1.cc: Clarify for single-thread. * testsuite/ext/mt_allocator/tune-2.cc: Same. * testsuite/ext/mt_allocator/tune-3.cc: Same. * testsuite/ext/mt_allocator/tune-4.cc: Same. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104591 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 7 +++++ libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc | 34 ++++++++++----------- libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc | 26 ++++++++-------- libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc | 31 ++++++++----------- libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc | 36 ++++++++++------------- 5 files changed, 66 insertions(+), 68 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 75ac3516c36..60af325a121 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2005-09-23 Benjamin Kosnik + + * testsuite/ext/mt_allocator/tune-1.cc: Clarify for single-thread. + * testsuite/ext/mt_allocator/tune-2.cc: Same. + * testsuite/ext/mt_allocator/tune-3.cc: Same. + * testsuite/ext/mt_allocator/tune-4.cc: Same. + 2005-09-21 Guillaume Melquiond PR libstdc++/23956 diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc b/libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc index 85b07709a77..25d6fdf622c 100644 --- a/libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc +++ b/libstdc++-v3/testsuite/ext/mt_allocator/tune-1.cc @@ -23,42 +23,42 @@ #include #include +#ifdef __GTHREADS +#define __cxxthread true +#else +#define __cxxthread false +#endif + // Tune characteristics. // __common_pool_policy void test01() { bool test __attribute__((unused)) = true; - typedef __gnu_test::pod_int value_type; - using __gnu_cxx::__pool; using __gnu_cxx::__common_pool_policy; -#ifdef __GTHREADS - typedef __common_pool_policy<__pool, true> policy_type; -#else - typedef __common_pool_policy<__pool, false> policy_type; -#endif + typedef __gnu_test::pod_int value_type; + typedef __common_pool_policy<__pool, __cxxthread> policy_type; typedef __gnu_cxx::__mt_alloc allocator_type; typedef __gnu_cxx::__pool_base::_Tune tune_type; - tune_type t_default; - tune_type t_opt(16, 5120, 32, 5120, 20, 10, false); - tune_type t_single(16, 5120, 32, 5120, 1, 10, false); - allocator_type a; - tune_type t1 = a._M_get_options(); - VERIFY( t1._M_align == t_default._M_align ); + tune_type t_default = a._M_get_options(); + tune_type t_opt(32, 5120, 32, 5120, 20, 10, false); + tune_type t_small(16, 1024, 32, 2048, 1, 10, false); + + tune_type t1 = t_default; a._M_set_options(t_opt); tune_type t2 = a._M_get_options(); VERIFY( t1._M_align != t2._M_align ); allocator_type::pointer p1 = a.allocate(128); allocator_type::pointer p2 = a.allocate(5128); - a._M_set_options(t_single); - t1 = a._M_get_options(); - VERIFY( t1._M_max_threads != t_single._M_max_threads ); - VERIFY( t1._M_max_threads == t_opt._M_max_threads ); + a._M_set_options(t_small); + tune_type t3 = a._M_get_options(); + VERIFY( t3._M_chunk_size != t_small._M_chunk_size ); + VERIFY( t3._M_chunk_size == t_opt._M_chunk_size ); a.deallocate(p1, 128); a.deallocate(p2, 5128); diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc b/libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc index d9be879dd77..e4b324ecb17 100644 --- a/libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc +++ b/libstdc++-v3/testsuite/ext/mt_allocator/tune-2.cc @@ -23,6 +23,12 @@ #include #include +#ifdef __GTHREADS +#define __cxxthread true +#else +#define __cxxthread false +#endif + // Tune characteristics. // __per_type_pool_policy void test02() @@ -34,19 +40,15 @@ void test02() using __gnu_cxx::__pool; using __gnu_cxx::__per_type_pool_policy; -#ifdef __GTHREADS - typedef __per_type_pool_policy policy_type; -#else - typedef __per_type_pool_policy policy_type; -#endif + typedef __per_type_pool_policy policy_type; typedef __gnu_cxx::__mt_alloc allocator_type; typedef __gnu_cxx::__pool_base::_Tune tune_type; - tune_type t_opt(16, 5120, 32, 5120, 20, 10, false); - tune_type t_single(16, 5120, 32, 5120, 1, 10, false); - allocator_type a; tune_type t_default = a._M_get_options(); + tune_type t_opt(32, 5120, 32, 5120, 20, 10, false); + tune_type t_small(16, 1024, 32, 2048, 1, 10, false); + tune_type t1 = t_default; a._M_set_options(t_opt); tune_type t2 = a._M_get_options(); @@ -54,10 +56,10 @@ void test02() allocator_type::pointer p1 = a.allocate(128); allocator_type::pointer p2 = a.allocate(5128); - a._M_set_options(t_single); - t1 = a._M_get_options(); - VERIFY( t1._M_max_threads != t_single._M_max_threads ); - VERIFY( t1._M_max_threads == t_opt._M_max_threads ); + a._M_set_options(t_small); + tune_type t3 = a._M_get_options(); + VERIFY( t3._M_chunk_size != t_small._M_chunk_size ); + VERIFY( t3._M_chunk_size == t_opt._M_chunk_size ); a.deallocate(p1, 128); a.deallocate(p2, 5128); diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc b/libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc index 1f83ee101a7..1c749129432 100644 --- a/libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc +++ b/libstdc++-v3/testsuite/ext/mt_allocator/tune-3.cc @@ -1,6 +1,6 @@ // 2004-08-25 Benjamin Kosnik // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -49,38 +49,33 @@ void test03() typedef _Cp policy_type; typedef __gnu_cxx::__mt_alloc allocator_type; - tune_type t_opt(16, 5120, 32, 5120, 20, 10, false); - tune_type t_single(16, 5120, 32, 5120, 1, 10, false); - - // First instances assured. allocator_type a; tune_type t_default = a._M_get_options(); + tune_type t_opt(32, 5120, 32, 5120, 20, 10, false); + tune_type t_small(16, 1024, 32, 2048, 1, 10, false); + + // First instances assured. tune_type t1 = t_default; - tune_type t2; if (test_policy::per_type()) { - VERIFY( t1._M_align == t_default._M_align ); a._M_set_options(t_opt); - t2 = a._M_get_options(); - VERIFY( t1._M_align != t2._M_align ); + t1 = a._M_get_options(); + VERIFY( t1._M_align != t_default._M_align ); } - else - t2 = t1; // Lock tune settings. typename allocator_type::pointer p1 = a.allocate(128); allocator_type a2; - tune_type t3 = a2._M_get_options(); - tune_type t4; - VERIFY( t3._M_max_threads == t2._M_max_threads ); + tune_type t2 = a2._M_get_options(); + VERIFY( t2._M_chunk_size == t1._M_chunk_size ); typename allocator_type::pointer p2 = a2.allocate(5128); - a2._M_set_options(t_single); - t4 = a2._M_get_options(); - VERIFY( t4._M_max_threads != t_single._M_max_threads ); - VERIFY( t4._M_max_threads == t3._M_max_threads ); + a2._M_set_options(t_small); + tune_type t3 = a2._M_get_options(); + VERIFY( t3._M_chunk_size != t_small._M_chunk_size ); + VERIFY( t3._M_chunk_size == t2._M_chunk_size ); a.deallocate(p1, 128); a2.deallocate(p2, 5128); diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc b/libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc index 744429d867a..cbde1992290 100644 --- a/libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc +++ b/libstdc++-v3/testsuite/ext/mt_allocator/tune-4.cc @@ -1,6 +1,6 @@ // 2004-08-25 Benjamin Kosnik // -// Copyright (C) 2004 Free Software Foundation, Inc. +// Copyright (C) 2004, 2005 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -54,52 +54,46 @@ void test04() typedef __gnu_cxx::__pool_base::_Tune tune_type; typedef _Tp value_type; typedef _Cp policy_type; - typedef __gnu_cxx::__mt_alloc allocator_type; - tune_type t_opt(16, 5120, 32, 5120, 20, 10, false); - tune_type t_single(16, 5120, 32, 5120, 1, 10, false); allocator_type a; tune_type t_default = a._M_get_options(); + tune_type t_opt(32, 5120, 32, 5120, 20, 10, false); + tune_type t_small(16, 1024, 32, 2048, 1, 10, false); + + // First instance of local type assured. tune_type t1 = t_default; - tune_type t2; if (test_policy::per_type()) { a._M_set_options(t_opt); - t2 = a._M_get_options(); - VERIFY( t1._M_align != t2._M_align ); + t1 = a._M_get_options(); + VERIFY( t1._M_align != t_default._M_align ); } - else - t2 = t1; // Lock tune settings. typename allocator_type::pointer p1 = a.allocate(128); - // First instance of local type assured. typedef pod2 value2_type; typedef typename allocator_type::template rebind::other rebind_type; rebind_type a2; - tune_type t3 = a2._M_get_options(); - tune_type t4; + tune_type t2 = a2._M_get_options(); // Both policy_type and rebind_type::policy_type have same characteristics. if (test_policy::per_type()) { a2._M_set_options(t_opt); - t4 = a2._M_get_options(); - VERIFY( t3._M_align != t4._M_align ); - t3 = t4; + tune_type t = a2._M_get_options(); + VERIFY( t2._M_align != t._M_align ); + t2 = t; } - else - VERIFY( t3._M_max_threads == t2._M_max_threads ); typename rebind_type::pointer p2 = a2.allocate(5128); - a2._M_set_options(t_single); - t4 = a2._M_get_options(); - VERIFY( t4._M_max_threads != t_single._M_max_threads ); - VERIFY( t4._M_max_threads == t3._M_max_threads ); + a2._M_set_options(t_small); + tune_type t4 = a2._M_get_options(); + VERIFY( t4._M_chunk_size != t_small._M_chunk_size ); + VERIFY( t4._M_chunk_size == t2._M_chunk_size ); a.deallocate(p1, 128); a2.deallocate(p2, 5128); -- 2.11.4.GIT