summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorlixialiu <lixialiu@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-15 18:26:53 +0000
committerlixialiu <lixialiu@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-15 18:26:53 +0000
commit21eaaf01b77d1b55bc3a689a665bcfe4b7b7a4ae (patch)
tree910b561a06edcf161d179f7d5f1a503142c71270 /libstdc++-v3
parentdf61432e374b997ae649d7efd14aaf3e866d0b52 (diff)
downloadgcc-21eaaf01b77d1b55bc3a689a665bcfe4b7b7a4ae.tar.gz
This patch has implemented an tool to advise programmers to use
standard c++ library efficiently. The patch includes instrumentation in standard c++ library, profiling runtime library and wrapper of profile mode. The patch also includes modification in GCC driver to turn on tool with option -fprofile-stdlib. Current version contains four diagnostics: HASHTABLE_TOO_SMALL, HASHTABLE_TOO_LARGE, VECTOR_TOO_SMALL and VECTOR_TOO_LARGE. The details can be referred to the design document of profile mode in manual. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/profile-stdlib@139134 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/Makefile.am2
-rw-r--r--libstdc++-v3/Makefile.in4
-rw-r--r--libstdc++-v3/acinclude.m46
-rwxr-xr-xlibstdc++-v3/configure8
-rw-r--r--libstdc++-v3/include/Makefile.am31
-rw-r--r--libstdc++-v3/include/Makefile.in31
-rw-r--r--libstdc++-v3/include/backward/hash_map4
-rw-r--r--libstdc++-v3/include/backward/hash_set4
-rw-r--r--libstdc++-v3/include/bits/c++config41
-rw-r--r--libstdc++-v3/include/profile/base.h68
-rw-r--r--libstdc++-v3/include/profile/bitset124
-rw-r--r--libstdc++-v3/include/profile/deque171
-rw-r--r--libstdc++-v3/include/profile/hashtable.h1135
-rw-r--r--libstdc++-v3/include/profile/list189
-rw-r--r--libstdc++-v3/include/profile/map42
-rw-r--r--libstdc++-v3/include/profile/map.h178
-rw-r--r--libstdc++-v3/include/profile/multimap.h177
-rw-r--r--libstdc++-v3/include/profile/multiset.h168
-rw-r--r--libstdc++-v3/include/profile/set42
-rw-r--r--libstdc++-v3/include/profile/set.h156
-rw-r--r--libstdc++-v3/include/profile/unordered_map416
-rw-r--r--libstdc++-v3/include/profile/unordered_set374
-rw-r--r--libstdc++-v3/include/profile/vector339
-rw-r--r--libstdc++-v3/include/std/bitset4
-rw-r--r--libstdc++-v3/include/std/deque4
-rw-r--r--libstdc++-v3/include/std/list4
-rw-r--r--libstdc++-v3/include/std/map4
-rw-r--r--libstdc++-v3/include/std/set4
-rw-r--r--libstdc++-v3/include/std/unordered_map6
-rw-r--r--libstdc++-v3/include/std/unordered_set5
-rw-r--r--libstdc++-v3/include/std/vector6
-rw-r--r--libstdc++-v3/include/tr1_impl/hashtable3
-rw-r--r--libstdc++-v3/libprofc++/Makefile.am45
-rw-r--r--libstdc++-v3/libprofc++/Makefile.in726
-rw-r--r--libstdc++-v3/libprofc++/profiler.h97
-rw-r--r--libstdc++-v3/libprofc++/profiler_container_size.cc148
-rw-r--r--libstdc++-v3/libprofc++/profiler_container_size.h87
-rw-r--r--libstdc++-v3/libprofc++/profiler_hashtable_size.cc95
-rw-r--r--libstdc++-v3/libprofc++/profiler_node.cc82
-rw-r--r--libstdc++-v3/libprofc++/profiler_node.h158
-rw-r--r--libstdc++-v3/libprofc++/profiler_state.cc44
-rw-r--r--libstdc++-v3/libprofc++/profiler_state.h94
-rw-r--r--libstdc++-v3/libprofc++/profiler_trace.cc119
-rw-r--r--libstdc++-v3/libprofc++/profiler_trace.h146
-rw-r--r--libstdc++-v3/libprofc++/profiler_vector_size.cc94
-rw-r--r--libstdc++-v3/src/Makefile.am3
-rw-r--r--libstdc++-v3/src/Makefile.in3
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc8
-rw-r--r--libstdc++-v3/testsuite/31_profile/hash_map.cc22
-rw-r--r--libstdc++-v3/testsuite/31_profile/unordered.cc47
-rw-r--r--libstdc++-v3/testsuite/31_profile/vector.cc18
-rw-r--r--libstdc++-v3/testsuite/Makefile.am25
-rw-r--r--libstdc++-v3/testsuite/Makefile.in24
53 files changed, 5810 insertions, 25 deletions
diff --git a/libstdc++-v3/Makefile.am b/libstdc++-v3/Makefile.am
index 7ab27f0344d..5b77d8c1956 100644
--- a/libstdc++-v3/Makefile.am
+++ b/libstdc++-v3/Makefile.am
@@ -28,7 +28,7 @@ if GLIBCXX_HOSTED
hosted_source = libmath doc src po testsuite
endif
## Keep this list sync'd with acinclude.m4:GLIBCXX_CONFIGURE.
-SUBDIRS = include libsupc++ $(hosted_source)
+SUBDIRS = include libsupc++ libprofc++ $(hosted_source)
ACLOCAL_AMFLAGS = -I . -I .. -I ../config
diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in
index 4835d08349f..6a272b975e9 100644
--- a/libstdc++-v3/Makefile.in
+++ b/libstdc++-v3/Makefile.in
@@ -87,7 +87,7 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
uninstall-recursive
ETAGS = etags
CTAGS = ctags
-DIST_SUBDIRS = include libsupc++ libmath doc src po testsuite
+DIST_SUBDIRS = include libsupc++ libprofc++ libmath doc src po testsuite
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -309,7 +309,7 @@ WARN_CXXFLAGS = \
# -I/-D flags to pass when compiling.
AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
@GLIBCXX_HOSTED_TRUE@hosted_source = libmath doc src po testsuite
-SUBDIRS = include libsupc++ $(hosted_source)
+SUBDIRS = include libsupc++ libprofc++ $(hosted_source)
ACLOCAL_AMFLAGS = -I . -I .. -I ../config
# Multilib support.
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index a68ab9be2a8..6d2f4c0c691 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -49,7 +49,7 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [
# Keep these sync'd with the list in Makefile.am. The first provides an
# expandable list at autoconf time; the second provides an expandable list
# (i.e., shell variable) at configure time.
- m4_define([glibcxx_SUBDIRS],[include libmath libsupc++ src doc po testsuite])
+ m4_define([glibcxx_SUBDIRS],[include libmath libsupc++ libprofc++ src doc po testsuite])
SUBDIRS='glibcxx_SUBDIRS'
# These need to be absolute paths, yet at the same time need to
@@ -591,7 +591,9 @@ AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [
GLIBCXX_INCLUDES="\
-I$glibcxx_builddir/include/$host_alias \
-I$glibcxx_builddir/include \
--I$glibcxx_srcdir/libsupc++"
+-I$glibcxx_srcdir/libsupc++ \
+-I$glibcxx_srcdir/libprofc++"
+
# For Canadian crosses, pick this up too.
if test $CANADIAN = yes; then
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 5a960cd2561..fb1bacb1481 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -2450,7 +2450,7 @@ echo "${ECHO_T}$ac_cv_prog_egrep" >&6
# expandable list at autoconf time; the second provides an expandable list
# (i.e., shell variable) at configure time.
- SUBDIRS='include libmath libsupc++ src doc po testsuite'
+ SUBDIRS='include libmath libsupc++ libprofc++ src doc po testsuite'
# These need to be absolute paths, yet at the same time need to
# canonicalize only relative paths, because then amd will not unmount
@@ -120695,7 +120695,8 @@ echo "${ECHO_T}$gxx_include_dir" >&6
GLIBCXX_INCLUDES="\
-I$glibcxx_builddir/include/$host_alias \
-I$glibcxx_builddir/include \
--I$glibcxx_srcdir/libsupc++"
+-I$glibcxx_srcdir/libsupc++ \
+-I$glibcxx_srcdir/libprofc++"
# For Canadian crosses, pick this up too.
if test $CANADIAN = yes; then
@@ -120729,7 +120730,7 @@ else
fi
- ac_config_files="$ac_config_files Makefile include/Makefile libmath/Makefile libsupc++/Makefile src/Makefile doc/Makefile po/Makefile testsuite/Makefile"
+ ac_config_files="$ac_config_files Makefile include/Makefile libmath/Makefile libsupc++/Makefile libprofc++/Makefile src/Makefile doc/Makefile po/Makefile testsuite/Makefile"
ac_config_files="$ac_config_files scripts/testsuite_flags"
@@ -121754,6 +121755,7 @@ do
"include/Makefile" ) CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
"libmath/Makefile" ) CONFIG_FILES="$CONFIG_FILES libmath/Makefile" ;;
"libsupc++/Makefile" ) CONFIG_FILES="$CONFIG_FILES libsupc++/Makefile" ;;
+ "libprofc++/Makefile" ) CONFIG_FILES="$CONFIG_FILES libprofc++/Makefile" ;;
"src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
"po/Makefile" ) CONFIG_FILES="$CONFIG_FILES po/Makefile" ;;
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 5d8358b42eb..11f03ef1707 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -1,4 +1,4 @@
-## Makefile for the include subdirectory of the GNU C++ Standard library.
+#o# Makefile for the include subdirectory of the GNU C++ Standard library.
##
## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
## Free Software Foundation, Inc.
@@ -759,6 +759,24 @@ else
parallel_headers =
endif
+# Profile mode headers
+profile_srcdir = ${glibcxx_srcdir}/include/profile
+profile_builddir = ./profile
+profile_headers = \
+ ${profile_srcdir}/base.h \
+ ${profile_srcdir}/unordered_map \
+ ${profile_srcdir}/unordered_set \
+ ${profile_srcdir}/vector \
+ ${profile_srcdir}/bitset \
+ ${profile_srcdir}/deque \
+ ${profile_srcdir}/list \
+ ${profile_srcdir}/map \
+ ${profile_srcdir}/map.h \
+ ${profile_srcdir}/multimap.h \
+ ${profile_srcdir}/multiset.h \
+ ${profile_srcdir}/set \
+ ${profile_srcdir}/set.h \
+ ${profile_srcdir}/hashtable.h
# Some of the different "C" header models need extra files.
# Some "C" header schemes require the "C" compatibility headers.
@@ -853,7 +871,8 @@ endif
allstamped = \
stamp-std stamp-bits stamp-c_base stamp-c_base_extra \
stamp-c_compatibility stamp-backward stamp-ext stamp-pb \
- stamp-tr1 stamp-tr1-impl stamp-debug stamp-parallel stamp-host
+ stamp-tr1 stamp-tr1-impl stamp-debug stamp-parallel stamp-host \
+ stamp-profile
# List of all files that are created by explicit building, editing, or
# catenation.
@@ -977,6 +996,11 @@ stamp-parallel: ${parallel_headers}
@-cd ${parallel_builddir} && $(LN_S) $? . 2>/dev/null
@$(STAMP) stamp-parallel
+stamp-profile: ${profile_headers}
+ @-mkdir -p ${profile_builddir}
+ @-cd ${profile_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-profile
+
stamp-${host_alias}:
@-mkdir -p ${host_builddir}
@$(STAMP) stamp-${host_alias}
@@ -1204,6 +1228,9 @@ install-headers:
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${parallel_builddir};\
for file in $$parallel_headers_install; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${parallel_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${profile_builddir}
+ for file in ${profile_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${profile_builddir}; done
$(mkinstalldirs) $(DESTDIR)${host_installdir}
for file in ${host_headers} ${host_headers_extra} \
${thread_host_headers}; do \
diff --git a/libstdc++-v3/include/Makefile.in b/libstdc++-v3/include/Makefile.in
index 5820f2612a4..20550e4147e 100644
--- a/libstdc++-v3/include/Makefile.in
+++ b/libstdc++-v3/include/Makefile.in
@@ -1001,6 +1001,26 @@ parallel_builddir = ./parallel
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/unique_copy.h \
@ENABLE_PARALLEL_TRUE@ ${parallel_srcdir}/workstealing.h
+
+# Profile mode headers
+profile_srcdir = ${glibcxx_srcdir}/include/profile
+profile_builddir = ./profile
+profile_headers = \
+ ${profile_srcdir}/base.h \
+ ${profile_srcdir}/unordered_map \
+ ${profile_srcdir}/unordered_set \
+ ${profile_srcdir}/vector \
+ ${profile_srcdir}/bitset \
+ ${profile_srcdir}/deque \
+ ${profile_srcdir}/list \
+ ${profile_srcdir}/map \
+ ${profile_srcdir}/map.h \
+ ${profile_srcdir}/multimap.h \
+ ${profile_srcdir}/multiset.h \
+ ${profile_srcdir}/set \
+ ${profile_srcdir}/set.h \
+ ${profile_srcdir}/hashtable.h
+
@GLIBCXX_C_HEADERS_EXTRA_FALSE@c_base_headers_extra =
# Some of the different "C" header models need extra files.
@@ -1083,7 +1103,8 @@ PCHFLAGS = -Winvalid-pch -x c++-header $(CXXFLAGS)
allstamped = \
stamp-std stamp-bits stamp-c_base stamp-c_base_extra \
stamp-c_compatibility stamp-backward stamp-ext stamp-pb \
- stamp-tr1 stamp-tr1-impl stamp-debug stamp-parallel stamp-host
+ stamp-tr1 stamp-tr1-impl stamp-debug stamp-parallel stamp-host \
+ stamp-profile
# List of all files that are created by explicit building, editing, or
@@ -1377,6 +1398,11 @@ stamp-parallel: ${parallel_headers}
@-cd ${parallel_builddir} && $(LN_S) $? . 2>/dev/null
@$(STAMP) stamp-parallel
+stamp-profile: ${profile_headers}
+ @-mkdir -p ${profile_builddir}
+ @-cd ${profile_builddir} && $(LN_S) $? . 2>/dev/null
+ @$(STAMP) stamp-profile
+
stamp-${host_alias}:
@-mkdir -p ${host_builddir}
@$(STAMP) stamp-${host_alias}
@@ -1592,6 +1618,9 @@ install-headers:
$(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${parallel_builddir};\
for file in $$parallel_headers_install; do \
$(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${parallel_builddir}; done
+ $(mkinstalldirs) $(DESTDIR)${gxx_include_dir}/${profile_builddir}
+ for file in ${profile_headers}; do \
+ $(INSTALL_DATA) $${file} $(DESTDIR)${gxx_include_dir}/${profile_builddir}; done
$(mkinstalldirs) $(DESTDIR)${host_installdir}
for file in ${host_headers} ${host_headers_extra} \
${thread_host_headers}; do \
diff --git a/libstdc++-v3/include/backward/hash_map b/libstdc++-v3/include/backward/hash_map
index 6b10cda6e3f..ce3c158f4fa 100644
--- a/libstdc++-v3/include/backward/hash_map
+++ b/libstdc++-v3/include/backward/hash_map
@@ -63,7 +63,11 @@
#include "backward_warning.h"
#include <bits/c++config.h>
+#ifdef _GLIBCXX_PROFILE
+#include <profile/hashtable.h>
+#else
#include <backward/hashtable.h>
+#endif
#include <bits/concept_check.h>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
diff --git a/libstdc++-v3/include/backward/hash_set b/libstdc++-v3/include/backward/hash_set
index 59c88c9e30a..fa0256bb7df 100644
--- a/libstdc++-v3/include/backward/hash_set
+++ b/libstdc++-v3/include/backward/hash_set
@@ -63,7 +63,11 @@
#include "backward_warning.h"
#include <bits/c++config.h>
+#ifdef _GLIBCXX_PROFILE
+#include <profile/hashtable.h>
+#else
#include <backward/hashtable.h>
+#endif
#include <bits/concept_check.h>
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
index f4029b26665..8f98caddbec 100644
--- a/libstdc++-v3/include/bits/c++config
+++ b/libstdc++-v3/include/bits/c++config
@@ -90,11 +90,17 @@
# define _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL 1
#endif
+// Namespace association for profile
+#ifdef _GLIBCXX_PROFILE
+# define _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE 1
+#endif
+
#define _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
// Defined if any namespace association modes are active.
#if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG \
|| _GLIBCXX_NAMESPACE_ASSOCIATION_PARALLEL \
+ || _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE \
|| _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
# define _GLIBCXX_USE_NAMESPACE_ASSOCIATION 1
#endif
@@ -113,6 +119,7 @@
#ifndef _GLIBCXX_USE_NAMESPACE_ASSOCIATION
# define _GLIBCXX_STD_D _GLIBCXX_STD
# define _GLIBCXX_STD_P _GLIBCXX_STD
+# define _GLIBCXX_STD_PR _GLIBCXX_STD
# define _GLIBCXX_STD std
# define _GLIBCXX_BEGIN_NESTED_NAMESPACE(X, Y) _GLIBCXX_BEGIN_NAMESPACE(X)
# define _GLIBCXX_END_NESTED_NAMESPACE _GLIBCXX_END_NAMESPACE
@@ -158,6 +165,28 @@
# define _GLIBCXX_EXTERN_TEMPLATE 0
# endif
+// profile
+# if _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE && !_GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
+# define _GLIBCXX_STD_D __norm
+# define _GLIBCXX_STD_P _GLIBCXX_STD
+# define _GLIBCXX_STD_PR __norm
+# define _GLIBCXX_STD __cxx1998
+# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
+# define _GLIBCXX_END_NAMESPACE }
+# define _GLIBCXX_EXTERN_TEMPLATE 0
+# endif
+
+// profile + debug
+# if _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE and _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
+# define _GLIBCXX_STD_D __norm
+# define _GLIBCXX_STD_P _GLIBCXX_STD
+# define _GLIBCXX_STD_PR __norm
+# define _GLIBCXX_STD __cxx1998
+# define _GLIBCXX_BEGIN_NAMESPACE(X) namespace X _GLIBCXX_VISIBILITY_ATTR(default) {
+# define _GLIBCXX_END_NAMESPACE }
+# define _GLIBCXX_EXTERN_TEMPLATE 0
+# endif
+
# if __NO_INLINE__ && !__GXX_WEAK__
# warning currently using namespace associated mode which may fail \
without inlining due to lack of weak symbols
@@ -168,7 +197,7 @@
#endif
// Namespace associations for debug mode.
-#if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG
+#if _GLIBCXX_NAMESPACE_ASSOCIATION_DEBUG && !_GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
namespace std
{
namespace __norm { }
@@ -187,6 +216,16 @@ namespace std
}
#endif
+// Namespace associations for profile mode
+#if _GLIBCXX_NAMESPACE_ASSOCIATION_PROFILE
+namespace std
+{
+ namespace __norm { }
+ inline namespace __profile { }
+ inline namespace __cxx1998 { }
+}
+#endif
+
// Namespace associations for versioning mode.
#if _GLIBCXX_NAMESPACE_ASSOCIATION_VERSION
namespace std
diff --git a/libstdc++-v3/include/profile/base.h b/libstdc++-v3/include/profile/base.h
new file mode 100644
index 00000000000..7c1f66a8db7
--- /dev/null
+++ b/libstdc++-v3/include/profile/base.h
@@ -0,0 +1,68 @@
+// -*- C++ -*-
+
+// Copyright (C) 2007, 2008 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 terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file profile/base.h
+ * @brief Sequential helper functions.
+ * This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+// Written by Johannes Singler.
+
+#ifndef _GLIBCXX_PROFILE_BASE_H
+#define _GLIBCXX_PROFILE_BASE_H 1
+
+#include <cstdio>
+#include <functional>
+#include <bits/c++config.h>
+#include <profiler.h>
+
+// Profiling mode namespaces.
+
+/**
+ * @namespace std::__profile
+ * @brief GNU profile code, replaces standard behavior with profile behavior.
+ */
+namespace std
+{
+ namespace __profile { }
+}
+
+/**
+ * @namespace __gnu_profile
+ * @brief GNU profile code for public use.
+ */
+namespace __gnu_profile
+{
+ // Import all the profile versions of components in namespace std.
+ using namespace std::__profile;
+}
+
+
+#endif /* _GLIBCXX_PROFILE_BASE_H */
diff --git a/libstdc++-v3/include/profile/bitset b/libstdc++-v3/include/profile/bitset
new file mode 100644
index 00000000000..66c611c1df7
--- /dev/null
+++ b/libstdc++-v3/include/profile/bitset
@@ -0,0 +1,124 @@
+// Profiling bitset implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/bitset
+ * This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_BITSET
+#define _GLIBCXX_PROFILE_BITSET
+
+#include <bitset>
+
+namespace std
+{
+namespace __profile
+{
+ template<size_t _Nb>
+ class bitset
+ : public _GLIBCXX_STD_PR::bitset<_Nb>
+ {
+ typedef _GLIBCXX_STD_PR::bitset<_Nb> _Base;
+
+ public:
+ bitset() : _Base() { }
+
+ bitset(unsigned long __val) : _Base(__val) { }
+
+ template<typename _CharT, typename _Traits, typename _Allocator>
+ explicit
+ bitset(const std::basic_string<_CharT,_Traits,_Allocator>& __str,
+ typename std::basic_string<_CharT,_Traits,_Allocator>::size_type
+ __pos = 0,
+ typename std::basic_string<_CharT,_Traits,_Allocator>::size_type
+ __n = (std::basic_string<_CharT,_Traits,_Allocator>::npos))
+ : _Base(__str, __pos, __n) { }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 778. std::bitset does not have any constructor taking a string literal
+ explicit
+ bitset(const char* __s)
+ : _Base(__s) { }
+
+ bitset(const _Base& __x) : _Base(__x) { }
+
+ bool
+ operator==(const bitset<_Nb>& __rhs) const
+ { return _M_base() == __rhs; }
+
+ bool
+ operator!=(const bitset<_Nb>& __rhs) const
+ { return _M_base() != __rhs; }
+
+ bitset<_Nb>
+ operator<<(size_t __pos) const
+ { return bitset<_Nb>(_M_base() << __pos); }
+
+ bitset<_Nb>
+ operator>>(size_t __pos) const
+ { return bitset<_Nb>(_M_base() >> __pos); }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ };
+
+ template<size_t _Nb>
+ bitset<_Nb>
+ operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ { return bitset<_Nb>(__x) &= __y; }
+
+ template<size_t _Nb>
+ bitset<_Nb>
+ operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ { return bitset<_Nb>(__x) |= __y; }
+
+ template<size_t _Nb>
+ bitset<_Nb>
+ operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
+ { return bitset<_Nb>(__x) ^= __y; }
+
+ template<typename _CharT, typename _Traits, size_t _Nb>
+ std::basic_istream<_CharT, _Traits>&
+ operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x)
+ { return __is >> __x._M_base(); }
+
+ template<typename _CharT, typename _Traits, size_t _Nb>
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __os,
+ const bitset<_Nb>& __x)
+ { return __os << __x._M_base(); }
+
+} // namespace __profile
+} // namespace std
+
+#endif
diff --git a/libstdc++-v3/include/profile/deque b/libstdc++-v3/include/profile/deque
new file mode 100644
index 00000000000..4b0c3b4bfb3
--- /dev/null
+++ b/libstdc++-v3/include/profile/deque
@@ -0,0 +1,171 @@
+// Profiling deque implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/deque
+ * This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_DEQUE
+#define _GLIBCXX_PROFILE_DEQUE 1
+
+#include <deque>
+
+namespace std
+{
+namespace __profile
+{
+ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
+ class deque
+ : public _GLIBCXX_STD_PR::deque<_Tp, _Allocator>
+ {
+ typedef _GLIBCXX_STD_D::deque<_Tp, _Allocator> _Base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+ // 23.2.1.1 construct/copy/destroy:
+ explicit deque(const _Allocator& __a = _Allocator())
+ : _Base(__a) { }
+
+ explicit deque(size_type __n, const _Tp& __value = _Tp(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__n, __value, __a) { }
+
+ template<class _InputIterator>
+ deque(_InputIterator __first, _InputIterator __last,
+ const _Allocator& __a = _Allocator())
+ : _Base(__first, __last, __a)
+ { }
+
+ deque(const deque& __x)
+ : _Base(__x) { }
+
+ deque(const _Base& __x)
+ : _Base(__x) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ deque(deque&& __x)
+ : _Base(std::forward<deque>(__x))
+ { }
+#endif
+
+ ~deque() { }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(deque&& __x)
+#else
+ swap(deque& __x)
+#endif
+ {
+ _Base::swap(__x);
+ }
+
+ deque&
+ operator=(const deque& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ deque&
+ operator=(deque&& __x)
+ {
+ _Base::clear();
+ swap(__x);
+ return *this;
+ }
+#endif
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ };
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator==(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator!=(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<=(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>=(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>(const deque<_Tp, _Alloc>& __lhs,
+ const deque<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(deque<_Tp, _Alloc>&& __lhs, deque<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+
+} // namespace __profile
+} // namespace std
+
+#endif
diff --git a/libstdc++-v3/include/profile/hashtable.h b/libstdc++-v3/include/profile/hashtable.h
new file mode 100644
index 00000000000..35e4d06dc22
--- /dev/null
+++ b/libstdc++-v3/include/profile/hashtable.h
@@ -0,0 +1,1135 @@
+// Hashtable implementation used by containers -*- C++ -*-
+
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/*
+ * Copyright (c) 1996,1997
+ * Silicon Graphics Computer Systems, Inc.
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Silicon Graphics makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ *
+ * Copyright (c) 1994
+ * Hewlett-Packard Company
+ *
+ * Permission to use, copy, modify, distribute and sell this software
+ * and its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and
+ * that both that copyright notice and this permission notice appear
+ * in supporting documentation. Hewlett-Packard Company makes no
+ * representations about the suitability of this software for any
+ * purpose. It is provided "as is" without express or implied warranty.
+ *
+ */
+
+/** @file profile/hashtable.h copied from backward/hashtable.h
+ * This file is a GNU extension to the Standard C++ Library (possibly
+ * containing extensions from the HP/SGI STL subset).
+ */
+
+#ifndef _HASHTABLE_H
+#define _HASHTABLE_H 1
+
+// Hashtable class, used to implement the hashed associative containers
+// hash_set, hash_map, hash_multiset, and hash_multimap.
+// Skip instrumentation on vector.
+#include <vector>
+#include <iterator>
+#include <algorithm>
+#include <bits/stl_function.h>
+#include <backward/hash_fun.h>
+#include <profiler.h>
+
+_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+
+ using std::size_t;
+ using std::ptrdiff_t;
+ using std::forward_iterator_tag;
+ using std::input_iterator_tag;
+ using std::_Construct;
+ using std::_Destroy;
+ using std::distance;
+ using std::_GLIBCXX_STD_D::vector;
+ using std::pair;
+ using std::__iterator_category;
+
+ template<class _Val>
+ struct _Hashtable_node
+ {
+ _Hashtable_node* _M_next;
+ _Val _M_val;
+ };
+
+ template<class _Val, class _Key, class _HashFcn, class _ExtractKey,
+ class _EqualKey, class _Alloc = std::allocator<_Val> >
+ class hashtable;
+
+ template<class _Val, class _Key, class _HashFcn,
+ class _ExtractKey, class _EqualKey, class _Alloc>
+ struct _Hashtable_iterator;
+
+ template<class _Val, class _Key, class _HashFcn,
+ class _ExtractKey, class _EqualKey, class _Alloc>
+ struct _Hashtable_const_iterator;
+
+ template<class _Val, class _Key, class _HashFcn,
+ class _ExtractKey, class _EqualKey, class _Alloc>
+ struct _Hashtable_iterator
+ {
+ typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>
+ _Hashtable;
+ typedef _Hashtable_iterator<_Val, _Key, _HashFcn,
+ _ExtractKey, _EqualKey, _Alloc>
+ iterator;
+ typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
+ _ExtractKey, _EqualKey, _Alloc>
+ const_iterator;
+ typedef _Hashtable_node<_Val> _Node;
+ typedef forward_iterator_tag iterator_category;
+ typedef _Val value_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef _Val& reference;
+ typedef _Val* pointer;
+
+ _Node* _M_cur;
+ _Hashtable* _M_ht;
+
+ _Hashtable_iterator(_Node* __n, _Hashtable* __tab)
+ : _M_cur(__n), _M_ht(__tab) { }
+
+ _Hashtable_iterator() { }
+
+ reference
+ operator*() const
+ { return _M_cur->_M_val; }
+
+ pointer
+ operator->() const
+ { return &(operator*()); }
+
+ iterator&
+ operator++();
+
+ iterator
+ operator++(int);
+
+ bool
+ operator==(const iterator& __it) const
+ { return _M_cur == __it._M_cur; }
+
+ bool
+ operator!=(const iterator& __it) const
+ { return _M_cur != __it._M_cur; }
+ };
+
+ template<class _Val, class _Key, class _HashFcn,
+ class _ExtractKey, class _EqualKey, class _Alloc>
+ struct _Hashtable_const_iterator
+ {
+ typedef hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>
+ _Hashtable;
+ typedef _Hashtable_iterator<_Val,_Key,_HashFcn,
+ _ExtractKey,_EqualKey,_Alloc>
+ iterator;
+ typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
+ _ExtractKey, _EqualKey, _Alloc>
+ const_iterator;
+ typedef _Hashtable_node<_Val> _Node;
+
+ typedef forward_iterator_tag iterator_category;
+ typedef _Val value_type;
+ typedef ptrdiff_t difference_type;
+ typedef size_t size_type;
+ typedef const _Val& reference;
+ typedef const _Val* pointer;
+
+ const _Node* _M_cur;
+ const _Hashtable* _M_ht;
+
+ _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab)
+ : _M_cur(__n), _M_ht(__tab) { }
+
+ _Hashtable_const_iterator() { }
+
+ _Hashtable_const_iterator(const iterator& __it)
+ : _M_cur(__it._M_cur), _M_ht(__it._M_ht) { }
+
+ reference
+ operator*() const
+ { return _M_cur->_M_val; }
+
+ pointer
+ operator->() const
+ { return &(operator*()); }
+
+ const_iterator&
+ operator++();
+
+ const_iterator
+ operator++(int);
+
+ bool
+ operator==(const const_iterator& __it) const
+ { return _M_cur == __it._M_cur; }
+
+ bool
+ operator!=(const const_iterator& __it) const
+ { return _M_cur != __it._M_cur; }
+ };
+
+ // Note: assumes long is at least 32 bits.
+ enum { _S_num_primes = 28 };
+
+ static const unsigned long __stl_prime_list[_S_num_primes] =
+ {
+ 53ul, 97ul, 193ul, 389ul, 769ul,
+ 1543ul, 3079ul, 6151ul, 12289ul, 24593ul,
+ 49157ul, 98317ul, 196613ul, 393241ul, 786433ul,
+ 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul,
+ 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,
+ 1610612741ul, 3221225473ul, 4294967291ul
+ };
+
+ inline unsigned long
+ __stl_next_prime(unsigned long __n)
+ {
+ const unsigned long* __first = __stl_prime_list;
+ const unsigned long* __last = __stl_prime_list + (int)_S_num_primes;
+ const unsigned long* pos = std::lower_bound(__first, __last, __n);
+ return pos == __last ? *(__last - 1) : *pos;
+ }
+
+ // Forward declaration of operator==.
+ template<class _Val, class _Key, class _HF, class _Ex,
+ class _Eq, class _All>
+ class hashtable;
+
+ template<class _Val, class _Key, class _HF, class _Ex,
+ class _Eq, class _All>
+ bool
+ operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,
+ const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2);
+
+ // Hashtables handle allocators a bit differently than other
+ // containers do. If we're using standard-conforming allocators, then
+ // a hashtable unconditionally has a member variable to hold its
+ // allocator, even if it so happens that all instances of the
+ // allocator type are identical. This is because, for hashtables,
+ // this extra storage is negligible. Additionally, a base class
+ // wouldn't serve any other purposes; it wouldn't, for example,
+ // simplify the exception-handling code.
+ template<class _Val, class _Key, class _HashFcn,
+ class _ExtractKey, class _EqualKey, class _Alloc>
+ class hashtable
+ {
+ public:
+ typedef _Key key_type;
+ typedef _Val value_type;
+ typedef _HashFcn hasher;
+ typedef _EqualKey key_equal;
+
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef value_type* pointer;
+ typedef const value_type* const_pointer;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ hasher
+ hash_funct() const
+ { return _M_hash; }
+
+ key_equal
+ key_eq() const
+ { return _M_equals; }
+
+ private:
+ typedef _Hashtable_node<_Val> _Node;
+
+ public:
+ typedef typename _Alloc::template rebind<value_type>::other allocator_type;
+ allocator_type
+ get_allocator() const
+ { return _M_node_allocator; }
+
+ private:
+ typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc;
+ typedef typename _Alloc::template rebind<_Node*>::other _Nodeptr_Alloc;
+ typedef vector<_Node*, _Nodeptr_Alloc> _Vector_type;
+
+ _Node_Alloc _M_node_allocator;
+
+ _Node*
+ _M_get_node()
+ { return _M_node_allocator.allocate(1); }
+
+ void
+ _M_put_node(_Node* __p)
+ { _M_node_allocator.deallocate(__p, 1); }
+
+ private:
+ hasher _M_hash;
+ key_equal _M_equals;
+ _ExtractKey _M_get_key;
+ _Vector_type _M_buckets;
+ size_type _M_num_elements;
+
+ public:
+ typedef _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey,
+ _EqualKey, _Alloc>
+ iterator;
+ typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey,
+ _EqualKey, _Alloc>
+ const_iterator;
+
+ friend struct
+ _Hashtable_iterator<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>;
+
+ friend struct
+ _Hashtable_const_iterator<_Val, _Key, _HashFcn, _ExtractKey,
+ _EqualKey, _Alloc>;
+
+ public:
+ hashtable(size_type __n, const _HashFcn& __hf,
+ const _EqualKey& __eql, const _ExtractKey& __ext,
+ const allocator_type& __a = allocator_type())
+ : _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql),
+ _M_get_key(__ext), _M_buckets(__a), _M_num_elements(0)
+ { _M_initialize_buckets(__n); }
+
+ hashtable(size_type __n, const _HashFcn& __hf,
+ const _EqualKey& __eql,
+ const allocator_type& __a = allocator_type())
+ : _M_node_allocator(__a), _M_hash(__hf), _M_equals(__eql),
+ _M_get_key(_ExtractKey()), _M_buckets(__a), _M_num_elements(0)
+ { _M_initialize_buckets(__n); }
+
+ hashtable(const hashtable& __ht)
+ : _M_node_allocator(__ht.get_allocator()), _M_hash(__ht._M_hash),
+ _M_equals(__ht._M_equals), _M_get_key(__ht._M_get_key),
+ _M_buckets(__ht.get_allocator()), _M_num_elements(0)
+ { _M_copy_from(__ht); }
+
+ hashtable&
+ operator= (const hashtable& __ht)
+ {
+ if (&__ht != this)
+ {
+ clear();
+ _M_hash = __ht._M_hash;
+ _M_equals = __ht._M_equals;
+ _M_get_key = __ht._M_get_key;
+ _M_copy_from(__ht);
+ }
+ return *this;
+ }
+
+ ~hashtable()
+ { clear(); }
+
+ size_type
+ size() const
+ { return _M_num_elements; }
+
+ size_type
+ max_size() const
+ { return size_type(-1); }
+
+ bool
+ empty() const
+ { return size() == 0; }
+
+ void
+ swap(hashtable& __ht)
+ {
+ std::swap(_M_hash, __ht._M_hash);
+ std::swap(_M_equals, __ht._M_equals);
+ std::swap(_M_get_key, __ht._M_get_key);
+ _M_buckets.swap(__ht._M_buckets);
+ std::swap(_M_num_elements, __ht._M_num_elements);
+ }
+
+ iterator
+ begin()
+ {
+ for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
+ if (_M_buckets[__n])
+ return iterator(_M_buckets[__n], this);
+ return end();
+ }
+
+ iterator
+ end()
+ { return iterator(0, this); }
+
+ const_iterator
+ begin() const
+ {
+ for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
+ if (_M_buckets[__n])
+ return const_iterator(_M_buckets[__n], this);
+ return end();
+ }
+
+ const_iterator
+ end() const
+ { return const_iterator(0, this); }
+
+ template<class _Vl, class _Ky, class _HF, class _Ex, class _Eq,
+ class _Al>
+ friend bool
+ operator==(const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&,
+ const hashtable<_Vl, _Ky, _HF, _Ex, _Eq, _Al>&);
+
+ public:
+ size_type
+ bucket_count() const
+ { return _M_buckets.size(); }
+
+ size_type
+ max_bucket_count() const
+ { return __stl_prime_list[(int)_S_num_primes - 1]; }
+
+ size_type
+ elems_in_bucket(size_type __bucket) const
+ {
+ size_type __result = 0;
+ for (_Node* __n = _M_buckets[__bucket]; __n; __n = __n->_M_next)
+ __result += 1;
+ return __result;
+ }
+
+ pair<iterator, bool>
+ insert_unique(const value_type& __obj)
+ {
+ resize(_M_num_elements + 1);
+ return insert_unique_noresize(__obj);
+ }
+
+ iterator
+ insert_equal(const value_type& __obj)
+ {
+ resize(_M_num_elements + 1);
+ return insert_equal_noresize(__obj);
+ }
+
+ pair<iterator, bool>
+ insert_unique_noresize(const value_type& __obj);
+
+ iterator
+ insert_equal_noresize(const value_type& __obj);
+
+ template<class _InputIterator>
+ void
+ insert_unique(_InputIterator __f, _InputIterator __l)
+ { insert_unique(__f, __l, __iterator_category(__f)); }
+
+ template<class _InputIterator>
+ void
+ insert_equal(_InputIterator __f, _InputIterator __l)
+ { insert_equal(__f, __l, __iterator_category(__f)); }
+
+ template<class _InputIterator>
+ void
+ insert_unique(_InputIterator __f, _InputIterator __l,
+ input_iterator_tag)
+ {
+ for ( ; __f != __l; ++__f)
+ insert_unique(*__f);
+ }
+
+ template<class _InputIterator>
+ void
+ insert_equal(_InputIterator __f, _InputIterator __l,
+ input_iterator_tag)
+ {
+ for ( ; __f != __l; ++__f)
+ insert_equal(*__f);
+ }
+
+ template<class _ForwardIterator>
+ void
+ insert_unique(_ForwardIterator __f, _ForwardIterator __l,
+ forward_iterator_tag)
+ {
+ size_type __n = distance(__f, __l);
+ resize(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_unique_noresize(*__f);
+ }
+
+ template<class _ForwardIterator>
+ void
+ insert_equal(_ForwardIterator __f, _ForwardIterator __l,
+ forward_iterator_tag)
+ {
+ size_type __n = distance(__f, __l);
+ resize(_M_num_elements + __n);
+ for ( ; __n > 0; --__n, ++__f)
+ insert_equal_noresize(*__f);
+ }
+
+ reference
+ find_or_insert(const value_type& __obj);
+
+ iterator
+ find(const key_type& __key)
+ {
+ size_type __n = _M_bkt_num_key(__key);
+ _Node* __first;
+ for (__first = _M_buckets[__n];
+ __first && !_M_equals(_M_get_key(__first->_M_val), __key);
+ __first = __first->_M_next)
+ { }
+ return iterator(__first, this);
+ }
+
+ const_iterator
+ find(const key_type& __key) const
+ {
+ size_type __n = _M_bkt_num_key(__key);
+ const _Node* __first;
+ for (__first = _M_buckets[__n];
+ __first && !_M_equals(_M_get_key(__first->_M_val), __key);
+ __first = __first->_M_next)
+ { }
+ return const_iterator(__first, this);
+ }
+
+ size_type
+ count(const key_type& __key) const
+ {
+ const size_type __n = _M_bkt_num_key(__key);
+ size_type __result = 0;
+
+ for (const _Node* __cur = _M_buckets[__n]; __cur;
+ __cur = __cur->_M_next)
+ if (_M_equals(_M_get_key(__cur->_M_val), __key))
+ ++__result;
+ return __result;
+ }
+
+ pair<iterator, iterator>
+ equal_range(const key_type& __key);
+
+ pair<const_iterator, const_iterator>
+ equal_range(const key_type& __key) const;
+
+ size_type
+ erase(const key_type& __key);
+
+ void
+ erase(const iterator& __it);
+
+ void
+ erase(iterator __first, iterator __last);
+
+ void
+ erase(const const_iterator& __it);
+
+ void
+ erase(const_iterator __first, const_iterator __last);
+
+ void
+ resize(size_type __num_elements_hint);
+
+ void
+ clear();
+
+ private:
+ size_type
+ _M_next_size(size_type __n) const
+ { return __stl_next_prime(__n); }
+
+ void
+ _M_initialize_buckets(size_type __n)
+ {
+ const size_type __n_buckets = _M_next_size(__n);
+ _M_buckets.reserve(__n_buckets);
+ _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0);
+ _M_num_elements = 0;
+ __profcxx_hashtable_construct(this, __n_buckets);
+ }
+
+ size_type
+ _M_bkt_num_key(const key_type& __key) const
+ { return _M_bkt_num_key(__key, _M_buckets.size()); }
+
+ size_type
+ _M_bkt_num(const value_type& __obj) const
+ { return _M_bkt_num_key(_M_get_key(__obj)); }
+
+ size_type
+ _M_bkt_num_key(const key_type& __key, size_t __n) const
+ { return _M_hash(__key) % __n; }
+
+ size_type
+ _M_bkt_num(const value_type& __obj, size_t __n) const
+ { return _M_bkt_num_key(_M_get_key(__obj), __n); }
+
+ _Node*
+ _M_new_node(const value_type& __obj)
+ {
+ _Node* __n = _M_get_node();
+ __n->_M_next = 0;
+ try
+ {
+ this->get_allocator().construct(&__n->_M_val, __obj);
+ return __n;
+ }
+ catch(...)
+ {
+ _M_put_node(__n);
+ __throw_exception_again;
+ }
+ }
+
+ void
+ _M_delete_node(_Node* __n)
+ {
+ this->get_allocator().destroy(&__n->_M_val);
+ _M_put_node(__n);
+ }
+
+ void
+ _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last);
+
+ void
+ _M_erase_bucket(const size_type __n, _Node* __last);
+
+ void
+ _M_copy_from(const hashtable& __ht);
+ };
+
+ template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
+ class _All>
+ _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>&
+ _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
+ operator++()
+ {
+ const _Node* __old = _M_cur;
+ _M_cur = _M_cur->_M_next;
+ if (!_M_cur)
+ {
+ size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
+ while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
+ _M_cur = _M_ht->_M_buckets[__bucket];
+ }
+ return *this;
+ }
+
+ template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
+ class _All>
+ inline _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>
+ _Hashtable_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
+ operator++(int)
+ {
+ iterator __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
+ class _All>
+ _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>&
+ _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
+ operator++()
+ {
+ const _Node* __old = _M_cur;
+ _M_cur = _M_cur->_M_next;
+ if (!_M_cur)
+ {
+ size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
+ while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
+ _M_cur = _M_ht->_M_buckets[__bucket];
+ }
+ return *this;
+ }
+
+ template<class _Val, class _Key, class _HF, class _ExK, class _EqK,
+ class _All>
+ inline _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>
+ _Hashtable_const_iterator<_Val, _Key, _HF, _ExK, _EqK, _All>::
+ operator++(int)
+ {
+ const_iterator __tmp = *this;
+ ++*this;
+ return __tmp;
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ bool
+ operator==(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,
+ const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2)
+ {
+ typedef typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::_Node _Node;
+
+ if (__ht1._M_buckets.size() != __ht2._M_buckets.size())
+ return false;
+
+ for (size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n)
+ {
+ _Node* __cur1 = __ht1._M_buckets[__n];
+ _Node* __cur2 = __ht2._M_buckets[__n];
+ // Check same length of lists
+ for (; __cur1 && __cur2;
+ __cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next)
+ { }
+ if (__cur1 || __cur2)
+ return false;
+ // Now check one's elements are in the other
+ for (__cur1 = __ht1._M_buckets[__n] ; __cur1;
+ __cur1 = __cur1->_M_next)
+ {
+ bool _found__cur1 = false;
+ for (__cur2 = __ht2._M_buckets[__n];
+ __cur2; __cur2 = __cur2->_M_next)
+ {
+ if (__cur1->_M_val == __cur2->_M_val)
+ {
+ _found__cur1 = true;
+ break;
+ }
+ }
+ if (!_found__cur1)
+ return false;
+ }
+ }
+ return true;
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ inline bool
+ operator!=(const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht1,
+ const hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>& __ht2)
+ { return !(__ht1 == __ht2); }
+
+ template<class _Val, class _Key, class _HF, class _Extract, class _EqKey,
+ class _All>
+ inline void
+ swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1,
+ hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2)
+ { __ht1.swap(__ht2); }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator, bool>
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ insert_unique_noresize(const value_type& __obj)
+ {
+ const size_type __n = _M_bkt_num(__obj);
+ _Node* __first = _M_buckets[__n];
+
+ for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
+ if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
+ return pair<iterator, bool>(iterator(__cur, this), false);
+
+ _Node* __tmp = _M_new_node(__obj);
+ __tmp->_M_next = __first;
+ _M_buckets[__n] = __tmp;
+ ++_M_num_elements;
+ return pair<iterator, bool>(iterator(__tmp, this), true);
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ insert_equal_noresize(const value_type& __obj)
+ {
+ const size_type __n = _M_bkt_num(__obj);
+ _Node* __first = _M_buckets[__n];
+
+ for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
+ if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
+ {
+ _Node* __tmp = _M_new_node(__obj);
+ __tmp->_M_next = __cur->_M_next;
+ __cur->_M_next = __tmp;
+ ++_M_num_elements;
+ return iterator(__tmp, this);
+ }
+
+ _Node* __tmp = _M_new_node(__obj);
+ __tmp->_M_next = __first;
+ _M_buckets[__n] = __tmp;
+ ++_M_num_elements;
+ return iterator(__tmp, this);
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::reference
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ find_or_insert(const value_type& __obj)
+ {
+ resize(_M_num_elements + 1);
+
+ size_type __n = _M_bkt_num(__obj);
+ _Node* __first = _M_buckets[__n];
+
+ for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
+ if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
+ return __cur->_M_val;
+
+ _Node* __tmp = _M_new_node(__obj);
+ __tmp->_M_next = __first;
+ _M_buckets[__n] = __tmp;
+ ++_M_num_elements;
+ return __tmp->_M_val;
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator,
+ typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator>
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ equal_range(const key_type& __key)
+ {
+ typedef pair<iterator, iterator> _Pii;
+ const size_type __n = _M_bkt_num_key(__key);
+
+ for (_Node* __first = _M_buckets[__n]; __first;
+ __first = __first->_M_next)
+ if (_M_equals(_M_get_key(__first->_M_val), __key))
+ {
+ for (_Node* __cur = __first->_M_next; __cur;
+ __cur = __cur->_M_next)
+ if (!_M_equals(_M_get_key(__cur->_M_val), __key))
+ return _Pii(iterator(__first, this), iterator(__cur, this));
+ for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
+ if (_M_buckets[__m])
+ return _Pii(iterator(__first, this),
+ iterator(_M_buckets[__m], this));
+ return _Pii(iterator(__first, this), end());
+ }
+ return _Pii(end(), end());
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator,
+ typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator>
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ equal_range(const key_type& __key) const
+ {
+ typedef pair<const_iterator, const_iterator> _Pii;
+ const size_type __n = _M_bkt_num_key(__key);
+
+ for (const _Node* __first = _M_buckets[__n]; __first;
+ __first = __first->_M_next)
+ {
+ if (_M_equals(_M_get_key(__first->_M_val), __key))
+ {
+ for (const _Node* __cur = __first->_M_next; __cur;
+ __cur = __cur->_M_next)
+ if (!_M_equals(_M_get_key(__cur->_M_val), __key))
+ return _Pii(const_iterator(__first, this),
+ const_iterator(__cur, this));
+ for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
+ if (_M_buckets[__m])
+ return _Pii(const_iterator(__first, this),
+ const_iterator(_M_buckets[__m], this));
+ return _Pii(const_iterator(__first, this), end());
+ }
+ }
+ return _Pii(end(), end());
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::size_type
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ erase(const key_type& __key)
+ {
+ const size_type __n = _M_bkt_num_key(__key);
+ _Node* __first = _M_buckets[__n];
+ size_type __erased = 0;
+
+ if (__first)
+ {
+ _Node* __cur = __first;
+ _Node* __next = __cur->_M_next;
+ while (__next)
+ {
+ if (_M_equals(_M_get_key(__next->_M_val), __key))
+ {
+ __cur->_M_next = __next->_M_next;
+ _M_delete_node(__next);
+ __next = __cur->_M_next;
+ ++__erased;
+ --_M_num_elements;
+ }
+ else
+ {
+ __cur = __next;
+ __next = __cur->_M_next;
+ }
+ }
+ if (_M_equals(_M_get_key(__first->_M_val), __key))
+ {
+ _M_buckets[__n] = __first->_M_next;
+ _M_delete_node(__first);
+ ++__erased;
+ --_M_num_elements;
+ }
+ }
+ return __erased;
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ erase(const iterator& __it)
+ {
+ _Node* __p = __it._M_cur;
+ if (__p)
+ {
+ const size_type __n = _M_bkt_num(__p->_M_val);
+ _Node* __cur = _M_buckets[__n];
+
+ if (__cur == __p)
+ {
+ _M_buckets[__n] = __cur->_M_next;
+ _M_delete_node(__cur);
+ --_M_num_elements;
+ }
+ else
+ {
+ _Node* __next = __cur->_M_next;
+ while (__next)
+ {
+ if (__next == __p)
+ {
+ __cur->_M_next = __next->_M_next;
+ _M_delete_node(__next);
+ --_M_num_elements;
+ break;
+ }
+ else
+ {
+ __cur = __next;
+ __next = __cur->_M_next;
+ }
+ }
+ }
+ }
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ erase(iterator __first, iterator __last)
+ {
+ size_type __f_bucket = __first._M_cur ? _M_bkt_num(__first._M_cur->_M_val)
+ : _M_buckets.size();
+
+ size_type __l_bucket = __last._M_cur ? _M_bkt_num(__last._M_cur->_M_val)
+ : _M_buckets.size();
+
+ if (__first._M_cur == __last._M_cur)
+ return;
+ else if (__f_bucket == __l_bucket)
+ _M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur);
+ else
+ {
+ _M_erase_bucket(__f_bucket, __first._M_cur, 0);
+ for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n)
+ _M_erase_bucket(__n, 0);
+ if (__l_bucket != _M_buckets.size())
+ _M_erase_bucket(__l_bucket, __last._M_cur);
+ }
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ inline void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ erase(const_iterator __first, const_iterator __last)
+ {
+ erase(iterator(const_cast<_Node*>(__first._M_cur),
+ const_cast<hashtable*>(__first._M_ht)),
+ iterator(const_cast<_Node*>(__last._M_cur),
+ const_cast<hashtable*>(__last._M_ht)));
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ inline void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ erase(const const_iterator& __it)
+ { erase(iterator(const_cast<_Node*>(__it._M_cur),
+ const_cast<hashtable*>(__it._M_ht))); }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ resize(size_type __num_elements_hint)
+ {
+ const size_type __old_n = _M_buckets.size();
+ if (__num_elements_hint > __old_n)
+ {
+ const size_type __n = _M_next_size(__num_elements_hint);
+ if (__n > __old_n)
+ {
+ _Vector_type __tmp(__n, (_Node*)(0), _M_buckets.get_allocator());
+ try
+ {
+ for (size_type __bucket = 0; __bucket < __old_n; ++__bucket)
+ {
+ _Node* __first = _M_buckets[__bucket];
+ while (__first)
+ {
+ size_type __new_bucket = _M_bkt_num(__first->_M_val,
+ __n);
+ _M_buckets[__bucket] = __first->_M_next;
+ __first->_M_next = __tmp[__new_bucket];
+ __tmp[__new_bucket] = __first;
+ __first = _M_buckets[__bucket];
+ }
+ }
+ _M_buckets.swap(__tmp);
+ }
+ catch(...)
+ {
+ for (size_type __bucket = 0; __bucket < __tmp.size();
+ ++__bucket)
+ {
+ while (__tmp[__bucket])
+ {
+ _Node* __next = __tmp[__bucket]->_M_next;
+ _M_delete_node(__tmp[__bucket]);
+ __tmp[__bucket] = __next;
+ }
+ }
+ __throw_exception_again;
+ }
+ __profcxx_hashtable_resize(this, __num_elements_hint, __n);
+ }
+ }
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last)
+ {
+ _Node* __cur = _M_buckets[__n];
+ if (__cur == __first)
+ _M_erase_bucket(__n, __last);
+ else
+ {
+ _Node* __next;
+ for (__next = __cur->_M_next;
+ __next != __first;
+ __cur = __next, __next = __cur->_M_next)
+ ;
+ while (__next != __last)
+ {
+ __cur->_M_next = __next->_M_next;
+ _M_delete_node(__next);
+ __next = __cur->_M_next;
+ --_M_num_elements;
+ }
+ }
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ _M_erase_bucket(const size_type __n, _Node* __last)
+ {
+ _Node* __cur = _M_buckets[__n];
+ while (__cur != __last)
+ {
+ _Node* __next = __cur->_M_next;
+ _M_delete_node(__cur);
+ __cur = __next;
+ _M_buckets[__n] = __cur;
+ --_M_num_elements;
+ }
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ clear()
+ {
+ if (_M_num_elements != 0)
+ __profcxx_hashtable_destruct(this, _M_buckets.size(), _M_num_elements);
+ for (size_type __i = 0; __i < _M_buckets.size(); ++__i)
+ {
+ _Node* __cur = _M_buckets[__i];
+ while (__cur != 0)
+ {
+ _Node* __next = __cur->_M_next;
+ _M_delete_node(__cur);
+ __cur = __next;
+ }
+ _M_buckets[__i] = 0;
+ }
+ _M_num_elements = 0;
+ }
+
+ template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
+ void
+ hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
+ _M_copy_from(const hashtable& __ht)
+ {
+ _M_buckets.clear();
+ _M_buckets.reserve(__ht._M_buckets.size());
+ _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0);
+ try
+ {
+ for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) {
+ const _Node* __cur = __ht._M_buckets[__i];
+ if (__cur)
+ {
+ _Node* __local_copy = _M_new_node(__cur->_M_val);
+ _M_buckets[__i] = __local_copy;
+
+ for (_Node* __next = __cur->_M_next;
+ __next;
+ __cur = __next, __next = __cur->_M_next)
+ {
+ __local_copy->_M_next = _M_new_node(__next->_M_val);
+ __local_copy = __local_copy->_M_next;
+ }
+ }
+ }
+ _M_num_elements = __ht._M_num_elements;
+ }
+ catch(...)
+ {
+ clear();
+ __throw_exception_again;
+ }
+ }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif
diff --git a/libstdc++-v3/include/profile/list b/libstdc++-v3/include/profile/list
new file mode 100644
index 00000000000..eccb36c2f01
--- /dev/null
+++ b/libstdc++-v3/include/profile/list
@@ -0,0 +1,189 @@
+// Profiling list implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/list
+ * This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_LIST
+#define _GLIBCXX_PROFILE_LIST 1
+
+#include <list>
+#include <bits/stl_algo.h>
+
+namespace std
+{
+namespace __profile
+{
+ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
+ class list
+ : public _GLIBCXX_STD_PR::list<_Tp, _Allocator>
+ {
+ typedef _GLIBCXX_STD_D::list<_Tp, _Allocator> _Base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+
+ // 23.2.2.1 construct/copy/destroy:
+ explicit list(const _Allocator& __a = _Allocator())
+ : _Base(__a) { }
+
+ explicit list(size_type __n, const _Tp& __value = _Tp(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__n, __value, __a) { }
+
+ template<class _InputIterator>
+ list(_InputIterator __first, _InputIterator __last,
+ const _Allocator& __a = _Allocator())
+ : _Base(__first, __last, __a)
+ { }
+
+
+ list(const list& __x)
+ : _Base(__x) { }
+
+ list(const _Base& __x)
+ : _Base(__x) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ list(list&& __x)
+ : _Base(std::forward<list>(__x))
+ {}
+#endif
+
+ ~list() { }
+
+ list&
+ operator=(const list& __x)
+ {
+ static_cast<_Base&>(*this) = __x;
+ return *this;
+ }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(list&& __x)
+#else
+ swap(list& __x)
+#endif
+ {
+ _Base::swap(__x);
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ list&
+ operator=(list&& __x)
+ {
+ // NB: DR 675.
+ _Base::clear();
+ _Base::swap(__x);
+ return *this;
+ }
+#endif
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+ };
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator==(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator!=(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<=(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>=(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>(const list<_Tp, _Alloc>& __lhs,
+ const list<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+} // namespace __profile
+} // namespace std
+
+#endif
diff --git a/libstdc++-v3/include/profile/map b/libstdc++-v3/include/profile/map
new file mode 100644
index 00000000000..43d4f05ddc0
--- /dev/null
+++ b/libstdc++-v3/include/profile/map
@@ -0,0 +1,42 @@
+// Profiling map/multimap implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2006
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/map
+ * This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_MAP
+#define _GLIBCXX_PROFILE_MAP 1
+
+#include <map>
+#include <profile/map.h>
+#include <profile/multimap.h>
+
+#endif
diff --git a/libstdc++-v3/include/profile/map.h b/libstdc++-v3/include/profile/map.h
new file mode 100644
index 00000000000..8923b59a2eb
--- /dev/null
+++ b/libstdc++-v3/include/profile/map.h
@@ -0,0 +1,178 @@
+// Profiling map implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/map.h
+ * This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_MAP_H
+#define _GLIBCXX_PROFILE_MAP_H 1
+
+#include <utility>
+
+namespace std
+{
+namespace __profile
+{
+ template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
+ typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
+ class map
+ : public _GLIBCXX_STD_PR::map<_Key, _Tp, _Compare, _Allocator>
+ {
+ typedef _GLIBCXX_STD_D::map<_Key, _Tp, _Compare, _Allocator> _Base;
+
+ public:
+ explicit map(const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__comp, __a) { }
+
+ template<typename _InputIterator>
+ map(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__first, __last, __comp, __a) { }
+
+ map(const map& __x)
+ : _Base(__x) { }
+
+ map(const _Base& __x)
+ : _Base(__x) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ map(map&& __x)
+ : _Base(std::forward<map>(__x))
+ { }
+#endif
+ ~map() { }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(map&& __x)
+#else
+ swap(map& __x)
+#endif
+ {
+ _Base::swap(__x);
+ }
+
+
+ map&
+ operator=(const map& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ map&
+ operator=(map&& __x)
+ {
+ // NB: DR 675.
+ _Base::clear();
+ _Base::swap(__x);
+ return *this;
+ }
+#endif
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+ };
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator==(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(map<_Key, _Tp, _Compare, _Allocator>&& __lhs,
+ map<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ map<_Key, _Tp, _Compare, _Allocator>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+} // namespace __profile
+} // namespace std
+
+#endif
diff --git a/libstdc++-v3/include/profile/multimap.h b/libstdc++-v3/include/profile/multimap.h
new file mode 100644
index 00000000000..7219eaaf716
--- /dev/null
+++ b/libstdc++-v3/include/profile/multimap.h
@@ -0,0 +1,177 @@
+// Profiling multimap implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/multimap.h
+ * This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_MULTIMAP_H
+#define _GLIBCXX_PROFILE_MULTIMAP_H 1
+
+#include <utility>
+
+namespace std
+{
+namespace __profile
+{
+ template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
+ typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
+ class multimap
+ : public _GLIBCXX_STD_PR::multimap<_Key, _Tp, _Compare, _Allocator>
+ {
+ typedef _GLIBCXX_STD_D::multimap<_Key, _Tp, _Compare, _Allocator> _Base;
+
+ public:
+ explicit multimap(const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__comp, __a) { }
+
+ template<typename _InputIterator>
+ multimap(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__first, __last, __comp, __a) { }
+
+ multimap(const multimap& __x)
+ : _Base(__x) { }
+
+ multimap(const _Base& __x)
+ : _Base(__x) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ multimap(multimap&& __x)
+ : _Base(std::forward<multimap>(__x))
+ { }
+#endif
+
+ ~multimap() { }
+
+ multimap&
+ operator=(const multimap& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ multimap&
+ operator=(multimap&& __x)
+ {
+ _Base::clear();
+ _Base::swap(__x);
+ return *this;
+ }
+#endif
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(multimap&& __x)
+#else
+ swap(multimap& __x)
+#endif
+ {
+ _Base::swap(__x);
+ }
+
+ };
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline bool
+ operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(multimap<_Key, _Tp, _Compare, _Allocator>&& __lhs,
+ multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Key, typename _Tp,
+ typename _Compare, typename _Allocator>
+ inline void
+ swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
+ multimap<_Key, _Tp, _Compare, _Allocator>&& __rhs)
+ { __lhs.swap(__rhs); }
+
+#endif
+} // namespace __profile
+} // namespace std
+
+#endif
diff --git a/libstdc++-v3/include/profile/multiset.h b/libstdc++-v3/include/profile/multiset.h
new file mode 100644
index 00000000000..260298b5b3e
--- /dev/null
+++ b/libstdc++-v3/include/profile/multiset.h
@@ -0,0 +1,168 @@
+// Profiling multiset implementation -*- C++ -*-
+
+// Copyright (C) 2008
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/multiset.h
+ * This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_MULTISET_H
+#define _GLIBCXX_PROFILE_MULTISET_H 1
+
+#include <utility>
+
+namespace std
+{
+namespace __profile
+{
+ template<typename _Key, typename _Compare = std::less<_Key>,
+ typename _Allocator = std::allocator<_Key> >
+ class multiset
+ : public _GLIBCXX_STD_PR::multiset<_Key, _Compare, _Allocator>
+ {
+ typedef _GLIBCXX_STD_PR::multiset<_Key, _Compare, _Allocator> _Base;
+
+ public:
+ explicit multiset(const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__comp, __a) { }
+
+ template<typename _InputIterator>
+ multiset(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__first, __last, __comp, __a) { }
+
+ multiset(const multiset& __x)
+ : _Base(__x) { }
+
+ multiset(const _Base& __x)
+ : _Base(__x) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ multiset(multiset&& __x)
+ : _Base(std::forward<multiset>(__x))
+ {}
+#endif
+ ~multiset() { }
+
+ multiset&
+ operator=(const multiset& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ multiset&
+ operator=(multiset&& __x)
+ {
+ _Base::clear();
+ _Base::swap(__x);
+ return *this;
+ }
+#endif
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(multiset&& __x)
+#else
+ swap(multiset& __x)
+#endif
+ {
+ _Base::swap(__x);
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+ };
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator==(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator<(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator>(const multiset<_Key, _Compare, _Allocator>& __lhs,
+ const multiset<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(multiset<_Key, _Compare, _Allocator>& __x,
+ multiset<_Key, _Compare, _Allocator>& __y)
+ { return __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(multiset<_Key, _Compare, _Allocator>&& __x,
+ multiset<_Key, _Compare, _Allocator>& __y)
+ { return __x.swap(__y); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(multiset<_Key, _Compare, _Allocator>& __x,
+ multiset<_Key, _Compare, _Allocator>&& __y)
+ { return __x.swap(__y); }
+#endif
+
+} // namespace __profile
+} // namespace std
+
+#endif
diff --git a/libstdc++-v3/include/profile/set b/libstdc++-v3/include/profile/set
new file mode 100644
index 00000000000..cce4a49e7c0
--- /dev/null
+++ b/libstdc++-v3/include/profile/set
@@ -0,0 +1,42 @@
+// Profiling set/multiset implementation -*- C++ -*-
+
+// Copyright (C) 2003-2008
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/set
+ * This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_SET
+#define _GLIBCXX_PROFILE_SET 1
+
+#include <set>
+#include <profile/set.h>
+#include <profile/multiset.h>
+
+#endif
diff --git a/libstdc++-v3/include/profile/set.h b/libstdc++-v3/include/profile/set.h
new file mode 100644
index 00000000000..668549e9bd7
--- /dev/null
+++ b/libstdc++-v3/include/profile/set.h
@@ -0,0 +1,156 @@
+// Profiling set implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/set.h
+ * This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_SET_H
+#define _GLIBCXX_PROFILE_SET_H 1
+
+#include <utility>
+
+namespace std
+{
+namespace __profile
+{
+ template<typename _Key, typename _Compare = std::less<_Key>,
+ typename _Allocator = std::allocator<_Key> >
+ class set
+ : public _GLIBCXX_STD_PR::set<_Key,_Compare,_Allocator>
+ {
+ typedef _GLIBCXX_STD_PR::set<_Key, _Compare, _Allocator> _Base;
+
+ public:
+ explicit set(const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__comp, __a) { }
+
+ template<typename _InputIterator>
+ set(_InputIterator __first, _InputIterator __last,
+ const _Compare& __comp = _Compare(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__first, __last, __comp, __a) { }
+
+ set(const set& __x)
+ : _Base(__x) { }
+
+ set(const _Base& __x)
+ : _Base(__x) { }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ set(set&& __x)
+ : _Base(std::forward<set>(__x))
+ { }
+#endif
+ ~set() { }
+
+ set&
+ operator=(const set& __x)
+ {
+ *static_cast<_Base*>(this) = __x;
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ set&
+ operator=(set&& __x)
+ {
+ _Base::clear();
+ _Base::swap(__x);
+ return *this;
+ }
+#endif
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(set&& __x)
+#else
+ swap(set& __x)
+#endif
+ {
+ _Base::swap(__x);
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+ };
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator<(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator<=(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator>=(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ inline bool
+ operator>(const set<_Key, _Compare, _Allocator>& __lhs,
+ const set<_Key, _Compare, _Allocator>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(set<_Key, _Compare, _Allocator>& __x,
+ set<_Key, _Compare, _Allocator>& __y)
+ { return __x.swap(__y); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(set<_Key, _Compare, _Allocator>&& __x,
+ set<_Key, _Compare, _Allocator>& __y)
+ { return __x.swap(__y); }
+
+ template<typename _Key, typename _Compare, typename _Allocator>
+ void
+ swap(set<_Key, _Compare, _Allocator>& __x,
+ set<_Key, _Compare, _Allocator>&& __y)
+ { return __x.swap(__y); }
+#endif
+
+} // namespace __profile
+} // namespace std
+
+#endif
diff --git a/libstdc++-v3/include/profile/unordered_map b/libstdc++-v3/include/profile/unordered_map
new file mode 100644
index 00000000000..63fb5ce141b
--- /dev/null
+++ b/libstdc++-v3/include/profile/unordered_map
@@ -0,0 +1,416 @@
+// Profiling unordered_map/unordered_multimap implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/unordered_map
+ * This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_UNORDERED_MAP
+#define _GLIBCXX_PROFILE_UNORDERED_MAP 1
+
+#include <profile/base.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# include <unordered_map>
+#else
+# include <c++0x_warning.h>
+#endif
+
+#define _GLIBCXX_BASE unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>
+#define _GLIBCXX_STD_BASE _GLIBCXX_STD_PR::_GLIBCXX_BASE
+
+namespace std
+{
+namespace __profile
+{
+ template<typename _Key, typename _Tp,
+ typename _Hash = std::hash<_Key>,
+ typename _Pred = std::equal_to<_Key>,
+ typename _Alloc = std::allocator<_Key> >
+ class unordered_map
+ : public _GLIBCXX_STD_BASE
+ {
+ typedef typename _GLIBCXX_STD_BASE _Base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+ typedef typename _Base::key_type key_type;
+ typedef typename _Base::value_type value_type;
+ typedef typename _Base::difference_type difference_type;
+ typedef typename _Base::reference reference;
+ typedef typename _Base::const_reference const_reference;
+ typedef typename _Base::mapped_type mapped_type;
+ typedef std::pair<typename _Base::iterator, bool> pair_type;
+ typedef typename _Base::insert_return_type insert_return_type;
+
+ typedef typename _Base::iterator iterator;
+ typedef typename _Base::const_iterator const_iterator;
+
+ explicit
+ unordered_map(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __eql, __a)
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ template<typename _InputIterator>
+ unordered_map(_InputIterator __f, _InputIterator __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__f, __l, __n, __hf, __eql, __a)
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ unordered_map(const _Base& __x)
+ : _Base(__x)
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ unordered_map(unordered_map&& __x)
+ : _Base(std::forward<_Base>(__x))
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ ~unordered_map()
+ {
+ __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size());
+ }
+
+ unordered_map&
+ operator=(unordered_map&& __x)
+ {
+ // NB: DR 675.
+ _Base::clear();
+ _Base::swap(__x);
+ return *this;
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+
+ void
+ clear()
+ {
+ __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size());
+ _Base::clear();
+ }
+
+ insert_return_type
+ insert(const value_type& __obj)
+ {
+ size_type old_size = _Base::bucket_count();
+ insert_return_type __res = _Base::insert(__obj);
+ profile_resize(this, old_size, _Base::bucket_count());
+ return __res;
+ }
+ iterator
+ insert(iterator __iter, const value_type& __v)
+ {
+ size_type old_size = _Base::bucket_count();
+ iterator res = _Base::insert(__iter, __v);
+ profile_resize(this, old_size, _Base::bucket_count());
+ return res;
+ }
+
+ const_iterator
+ insert(const_iterator __iter, const value_type& __v)
+ {
+ size_type old_size = _Base::bucket_count();
+ const_iterator res =_Base::insert(__iter, __v);
+ profile_resize(this, old_size, _Base::bucket_count());
+ return res;
+ }
+
+ template<typename _InputIter>
+ void
+ insert(_InputIter __first, _InputIter __last)
+ {
+ size_type old_size = _Base::bucket_count();
+ _Base::insert(__first.base(), __last.base());
+ profile_resize(this, old_size, _Base::bucket_count());
+ }
+
+ void
+ insert(const value_type* __first, const value_type* __last)
+ {
+ size_type old_size = _Base::bucket_count();
+ _Base::insert(__first, __last);
+ profile_resize(this, old_size, _Base::bucket_count());
+ }
+
+ // operator []
+ mapped_type&
+ operator[](const _Key& _k)
+ {
+ size_type old_size = _Base::bucket_count();
+ mapped_type& __res = _M_base()[_k];
+ size_type new_size = _Base::bucket_count();
+ profile_resize(this, old_size, _Base::bucket_count());
+ return __res;
+ }
+ void
+ swap(unordered_map&& __x)
+ {
+ _Base::swap(__x);
+ }
+
+ void rehash(size_type __n)
+ {
+ size_type old_size = _Base::bucket_count();
+ _Base::rehash(__n);
+ profile_resize(this, old_size, _Base::bucket_count());
+ }
+ private:
+ void profile_resize(void* obj, size_type old_size, size_type new_size)
+ {
+ if (old_size != new_size)
+ {
+ __profcxx_hashtable_resize(this, old_size, new_size);
+ }
+ }
+ };
+ template<typename _Key, typename _Tp, typename _Hash,
+ typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Key, typename _Tp, typename _Hash,
+ typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x,
+ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Key, typename _Tp, typename _Hash,
+ typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+
+#undef _GLIBCXX_BASE
+#undef _GLIBCXX_STD_BASE
+#define _GLIBCXX_BASE unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
+#define _GLIBCXX_STD_BASE _GLIBCXX_STD_PR::_GLIBCXX_BASE
+
+ template<typename _Key, typename _Tp,
+ typename _Hash = std::hash<_Key>,
+ typename _Pred = std::equal_to<_Key>,
+ typename _Alloc = std::allocator<_Key> >
+ class unordered_multimap
+ : public _GLIBCXX_STD_BASE
+ {
+ typedef typename _GLIBCXX_STD_BASE _Base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+ typedef typename _Base::key_type key_type;
+ typedef typename _Base::value_type value_type;
+ typedef typename _Base::difference_type difference_type;
+ typedef typename _Base::reference reference;
+ typedef typename _Base::const_reference const_reference;
+ typedef std::pair<typename _Base::iterator, bool> pair_type;
+ typedef typename _Base::insert_return_type insert_return_type;
+
+ typedef typename _Base::iterator iterator;
+ typedef typename _Base::const_iterator const_iterator;
+
+ explicit
+ unordered_multimap(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __eql, __a)
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+ template<typename _InputIterator>
+ unordered_multimap(_InputIterator __f, _InputIterator __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__f, __l, __n, __hf, __eql, __a)
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ unordered_multimap(const _Base& __x)
+ : _Base(__x)
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ unordered_multimap(unordered_multimap&& __x)
+ : _Base(std::forward<_Base>(__x))
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ ~unordered_multimap()
+ {
+ __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size());
+ }
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+
+ void
+ clear()
+ {
+ __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size());
+ _Base::clear();
+ }
+
+ insert_return_type
+ insert(const value_type& __obj)
+ {
+ size_type old_size = _Base::bucket_count();
+ insert_return_type __res = _Base::insert(__obj);
+ profile_resize(this, old_size, _Base::bucket_count());
+ return __res;
+ }
+ iterator
+ insert(iterator __iter, const value_type& __v)
+ {
+ size_type old_size = _Base::bucket_count();
+ iterator res = _Base::insert(__iter, __v);
+ profile_resize(this, old_size, _Base::bucket_count());
+ return res;
+ }
+
+ const_iterator
+ insert(const_iterator __iter, const value_type& __v)
+ {
+ size_type old_size = _Base::bucket_count();
+ const_iterator res =_Base::insert(__iter, __v);
+ profile_resize(this, old_size, _Base::bucket_count());
+ return res;
+ }
+
+ template<typename _InputIter>
+ void
+ insert(_InputIter __first, _InputIter __last)
+ {
+ size_type old_size = _Base::bucket_count();
+ _Base::insert(__first.base(), __last.base());
+ profile_resize(this, old_size, _Base::bucket_count());
+ }
+
+ void
+ insert(const value_type* __first, const value_type* __last)
+ {
+ size_type old_size = _Base::bucket_count();
+ _Base::insert(__first, __last);
+ profile_resize(this, old_size, _Base::bucket_count());
+ }
+
+ unordered_multimap&
+ operator=(unordered_multimap&& __x)
+ {
+ // NB: DR 675.
+ _Base::clear();
+ _Base::swap(__x);
+ return *this;
+ }
+
+ void
+ swap(unordered_multimap&& __x)
+ {
+ _Base::swap(__x);
+ }
+
+ void rehash(size_type __n)
+ {
+ size_type old_size = _Base::bucket_count();
+ _Base::rehash(__n);
+ profile_resize(this, old_size, _Base::bucket_count());
+ }
+ private:
+ void profile_resize(void* obj, size_type old_size, size_type new_size)
+ {
+ if (old_size != new_size)
+ {
+ __profcxx_hashtable_resize(this, old_size, new_size);
+ }
+ }
+ };
+ template<typename _Key, typename _Tp, typename _Hash,
+ typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Key, typename _Tp, typename _Hash,
+ typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __x,
+ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Key, typename _Tp, typename _Hash,
+ typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
+ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+
+} // namespace __profile
+} // namespace std
+
+#undef _GLIBCXX_BASE
+#undef _GLIBCXX_STD_BASE
+
+#endif
diff --git a/libstdc++-v3/include/profile/unordered_set b/libstdc++-v3/include/profile/unordered_set
new file mode 100644
index 00000000000..01b2249e2c8
--- /dev/null
+++ b/libstdc++-v3/include/profile/unordered_set
@@ -0,0 +1,374 @@
+// Profiling unordered_set/unordered_multiset implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/unordered_set
+ * This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_UNORDERED_SET
+#define _GLIBCXX_PROFILE_UNORDERED_SET 1
+
+#include <profile/base.h>
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+# include <unordered_set>
+#else
+# include <c++0x_warning.h>
+#endif
+
+#define _GLIBCXX_BASE unordered_set<_Key, _Hash, _Pred, _Alloc>
+#define _GLIBCXX_STD_BASE _GLIBCXX_STD_PR::_GLIBCXX_BASE
+
+namespace std
+{
+namespace __profile
+{
+ template<typename _Key,
+ typename _Hash = std::hash<_Key>,
+ typename _Pred = std::equal_to<_Key>,
+ typename _Alloc = std::allocator<_Key> >
+ class unordered_set
+ : public _GLIBCXX_STD_BASE
+ {
+ typedef typename _GLIBCXX_STD_BASE _Base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+ typedef typename _Base::key_type key_type;
+ typedef typename _Base::value_type value_type;
+ typedef typename _Base::difference_type difference_type;
+ typedef typename _Base::reference reference;
+ typedef typename _Base::const_reference const_reference;
+ typedef typename _Base::insert_return_type insert_return_type;
+
+ typedef typename _Base::iterator iterator;
+ typedef typename _Base::const_iterator const_iterator;
+
+ explicit
+ unordered_set(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __eql, __a)
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ template<typename _InputIterator>
+ unordered_set(_InputIterator __f, _InputIterator __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__f, __l, __n, __hf, __eql, __a)
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ unordered_set(const _Base& __x)
+ : _Base(__x)
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ unordered_set(unordered_set&& __x)
+ : _Base(std::forward<_Base>(__x))
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ ~unordered_set()
+ {
+ __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size());
+ }
+
+ void
+ swap(unordered_set&& __x)
+ {
+ _Base::swap(__x);
+ }
+
+ void
+ clear()
+ {
+ __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size());
+ _Base::clear();
+ }
+ insert_return_type insert(const value_type& __obj)
+ {
+ size_type old_size = _Base::bucket_count();
+ insert_return_type __res = _Base::insert(__obj);
+ profile_resize(this, old_size, _Base::bucket_count());
+ return __res;
+ }
+ iterator
+ insert(iterator __iter, const value_type& __v)
+ {
+ size_type old_size = _Base::bucket_count();
+ iterator res = _Base::insert(__iter, __v);
+ profile_resize(this, old_size, _Base::bucket_count());
+ return res;
+ }
+
+ const_iterator
+ insert(const_iterator __iter, const value_type& __v)
+ {
+ size_type old_size = _Base::bucket_count();
+ const_iterator res =_Base::insert(__iter, __v);
+ profile_resize(this, old_size, _Base::bucket_count());
+ return res;
+ }
+
+ template<typename _InputIter>
+ void
+ insert(_InputIter __first, _InputIter __last)
+ {
+ size_type old_size = _Base::bucket_count();
+ _Base::insert(__first.base(), __last.base());
+ profile_resize(this, old_size, _Base::bucket_count());
+ }
+
+ void
+ insert(const value_type* __first, const value_type* __last)
+ {
+ size_type old_size = _Base::bucket_count();
+ _Base::insert(__first, __last);
+ profile_resize(this, old_size, _Base::bucket_count());
+ }
+
+ void rehash(size_type __n)
+ {
+ size_type old_size = _Base::bucket_count();
+ _Base::rehash(__n);
+ profile_resize(this, old_size, _Base::bucket_count());
+ }
+ private:
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ void profile_resize(void* obj, size_type old_size, size_type new_size)
+ {
+ if (old_size != new_size)
+ {
+ __profcxx_hashtable_resize(this, old_size, new_size);
+ }
+ }
+ };
+ template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_set<_Value, _Hash, _Pred, _Alloc>&& __x,
+ unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_set<_Value, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+
+#undef _GLIBCXX_BASE
+#undef _GLIBCXX_STD_BASE
+#define _GLIBCXX_STD_BASE _GLIBCXX_STD_PR::_GLIBCXX_BASE
+#define _GLIBCXX_BASE unordered_multiset<_Value, _Hash, _Pred, _Alloc>
+
+ template<typename _Value,
+ typename _Hash = std::hash<_Value>,
+ typename _Pred = std::equal_to<_Value>,
+ typename _Alloc = std::allocator<_Value> >
+ class unordered_multiset
+ : public _GLIBCXX_STD_BASE
+ {
+ typedef typename _GLIBCXX_STD_BASE _Base;
+
+ public:
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::hasher hasher;
+ typedef typename _Base::key_equal key_equal;
+ typedef typename _Base::allocator_type allocator_type;
+ typedef typename _Base::key_type key_type;
+ typedef typename _Base::value_type value_type;
+ typedef typename _Base::difference_type difference_type;
+ typedef typename _Base::reference reference;
+ typedef typename _Base::const_reference const_reference;
+ typedef typename _Base::insert_return_type insert_return_type;
+
+ typedef typename _Base::iterator iterator;
+ typedef typename _Base::const_iterator const_iterator;
+
+ explicit
+ unordered_multiset(size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__n, __hf, __eql, __a)
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ template<typename _InputIterator>
+ unordered_multiset(_InputIterator __f, _InputIterator __l,
+ size_type __n = 10,
+ const hasher& __hf = hasher(),
+ const key_equal& __eql = key_equal(),
+ const allocator_type& __a = allocator_type())
+ : _Base(__f, __l, __n, __hf, __eql, __a)
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ unordered_multiset(const _Base& __x)
+ : _Base(__x)
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ unordered_multiset(unordered_multiset&& __x)
+ : _Base(std::forward<_Base>(__x))
+ {
+ __profcxx_hashtable_construct(this, _Base::bucket_count());
+ }
+
+ ~unordered_multiset()
+ {
+ __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size());
+ }
+
+ void
+ swap(unordered_multiset&& __x)
+ {
+ _Base::swap(__x);
+ }
+
+ void
+ clear()
+ {
+ __profcxx_hashtable_destruct(this, _Base::bucket_count(), _Base::size());
+ _Base::clear();
+ }
+ insert_return_type insert(const value_type& __obj)
+ {
+ size_type old_size = _Base::bucket_count();
+ insert_return_type __res = _Base::insert(__obj);
+ profile_resize(this, old_size, _Base::bucket_count());
+ return __res;
+ }
+ iterator
+ insert(iterator __iter, const value_type& __v)
+ {
+ size_type old_size = _Base::bucket_count();
+ iterator res = _Base::insert(__iter, __v);
+ profile_resize(this, old_size, _Base::bucket_count());
+ return res;
+ }
+
+ const_iterator
+ insert(const_iterator __iter, const value_type& __v)
+ {
+ size_type old_size = _Base::bucket_count();
+ const_iterator res =_Base::insert(__iter, __v);
+ profile_resize(this, old_size, _Base::bucket_count());
+ return res;
+ }
+
+ template<typename _InputIter>
+ void
+ insert(_InputIter __first, _InputIter __last)
+ {
+ size_type old_size = _Base::bucket_count();
+ _Base::insert(__first.base(), __last.base());
+ profile_resize(this, old_size, _Base::bucket_count());
+ }
+
+ void
+ insert(const value_type* __first, const value_type* __last)
+ {
+ size_type old_size = _Base::bucket_count();
+ _Base::insert(__first, __last);
+ profile_resize(this, old_size, _Base::bucket_count());
+ }
+
+ void rehash(size_type __n)
+ {
+ size_type old_size = _Base::bucket_count();
+ _Base::rehash(__n);
+ profile_resize(this, old_size, _Base::bucket_count());
+ }
+ private:
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ void profile_resize(void* obj, size_type old_size, size_type new_size)
+ {
+ if (old_size != new_size)
+ {
+ __profcxx_hashtable_resize(this, old_size, new_size);
+ }
+ }
+ };
+ template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __x,
+ unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
+ { __x.swap(__y); }
+
+ template<typename _Value, typename _Hash, typename _Pred, typename _Alloc>
+ inline void
+ swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
+ unordered_multiset<_Value, _Hash, _Pred, _Alloc>&& __y)
+ { __x.swap(__y); }
+
+} // namespace __profile
+} // namespace std
+
+#undef _GLIBCXX_BASE
+#undef _GLIBCXX_STD_BASE
+
+#endif
diff --git a/libstdc++-v3/include/profile/vector b/libstdc++-v3/include/profile/vector
new file mode 100644
index 00000000000..d7d66f4b947
--- /dev/null
+++ b/libstdc++-v3/include/profile/vector
@@ -0,0 +1,339 @@
+// Profiling vector implementation -*- C++ -*-
+
+// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
+// 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING. If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction. Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License. This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+/** @file profile/vector
+ * This file is a GNU profile extension to the Standard C++ Library.
+ */
+
+#ifndef _GLIBCXX_PROFILE_VECTOR
+#define _GLIBCXX_PROFILE_VECTOR 1
+
+#include <vector>
+#include <utility>
+#include <profile/base.h>
+
+namespace std
+{
+namespace __profile
+{
+ template<typename _Tp,
+ typename _Allocator = std::allocator<_Tp> >
+ class vector
+ : public _GLIBCXX_STD_PR::vector<_Tp, _Allocator>
+ {
+ typedef _GLIBCXX_STD_PR::vector<_Tp, _Allocator> _Base;
+
+ public:
+ typedef typename _Base::reference reference;
+ typedef typename _Base::const_reference const_reference;
+
+ typedef typename _Base::iterator iterator;
+ typedef typename _Base::const_iterator const_iterator;
+
+ typedef typename _Base::size_type size_type;
+ typedef typename _Base::difference_type difference_type;
+
+ typedef _Tp value_type;
+ typedef _Allocator allocator_type;
+ typedef typename _Base::pointer pointer;
+ typedef typename _Base::const_pointer const_pointer;
+
+ _Base&
+ _M_base() { return *this; }
+
+ const _Base&
+ _M_base() const { return *this; }
+
+ // 23.2.4.1 construct/copy/destroy:
+ explicit vector(const _Allocator& __a = _Allocator())
+ : _Base(__a)
+ {
+ __profcxx_vector_construct(this, this->capacity());
+ }
+
+ explicit vector(size_type __n, const _Tp& __value = _Tp(),
+ const _Allocator& __a = _Allocator())
+ : _Base(__n, __value, __a)
+ {
+ __profcxx_vector_construct(this, this->capacity());
+ }
+
+ template<class _InputIterator>
+ vector(_InputIterator __first, _InputIterator __last,
+ const _Allocator& __a = _Allocator())
+ : _Base(__first, __last, __a)
+ {
+ __profcxx_vector_construct(this, this->capacity());
+ }
+
+ vector(const vector& __x)
+ : _Base(__x)
+ {
+ __profcxx_vector_construct(this, this->capacity());
+ }
+
+ /// Construction from a release-mode vector
+ vector(const _Base& __x)
+ : _Base(__x)
+ {
+ __profcxx_vector_construct(this, this->capacity());
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ vector(vector&& __x)
+ : _Base(std::forward<vector>(__x))
+ {
+ __profcxx_vector_construct(this, this->capacity());
+ }
+#endif
+
+ ~vector() {
+ __profcxx_vector_destruct(this, this->capacity(), this->size());
+ }
+
+ vector&
+ operator=(const vector& __x)
+ {
+ static_cast<_Base&>(*this) = __x;
+ return *this;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ vector&
+ operator=(vector&& __x)
+ {
+ // NB: DR 675.
+ clear();
+ swap(__x);
+ return *this;
+ }
+#endif
+
+ using _Base::get_allocator;
+
+ // 23.2.4.2 capacity:
+ using _Base::size;
+ using _Base::max_size;
+
+ void
+ resize(size_type __sz, _Tp __c = _Tp())
+ {
+ profile_resize(this, this->capacity(), __sz);
+ _Base::resize(__sz, __c);
+ }
+
+ using _Base::empty;
+
+ // element access:
+ reference
+ operator[](size_type __n)
+ {
+ return _M_base()[__n];
+ }
+
+ const_reference
+ operator[](size_type __n) const
+ {
+ return _M_base()[__n];
+ }
+
+ using _Base::at;
+
+ reference
+ front()
+ {
+ return _Base::front();
+ }
+
+ const_reference
+ front() const
+ {
+ return _Base::front();
+ }
+
+ reference
+ back()
+ {
+ return _Base::back();
+ }
+
+ const_reference
+ back() const
+ {
+ return _Base::back();
+ }
+
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // DR 464. Suggestion for new member functions in standard containers.
+ using _Base::data;
+
+ // 23.2.4.3 modifiers:
+ void
+ push_back(const _Tp& __x)
+ {
+ size_type old_size = this->capacity();
+ _Base::push_back(__x);
+ profile_resize(this, old_size, this->capacity());
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ void
+ push_back(_Tp&& __x)
+ {
+ size_type old_size = this->capacity();
+ _Base::push_back(__x);
+ profile_resize(this, old_size, this->capacity());
+ }
+
+#endif
+
+ iterator
+ insert(iterator __position, const _Tp& __x)
+ {
+ size_type old_size = this->capacity();
+ typename _Base::iterator __res = _Base::insert(__position,__x);
+ profile_resize(this, old_size, this->capacity());
+ return __res;
+ }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ iterator
+ insert(iterator __position, _Tp&& __x)
+ {
+ size_type old_size = this->capacity();
+ typename _Base::iterator __res = _Base::insert(__position,__x);
+ profile_resize(this, old_size, this->capacity());
+ return __res;
+ }
+#endif
+
+ void
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ swap(vector&& __x)
+#else
+ swap(vector& __x)
+#endif
+ {
+ _Base::swap(__x);
+ }
+
+
+ void
+ insert(iterator __position, size_type __n, const _Tp& __x)
+ {
+ size_type old_size = this->capacity();
+ _Base::insert(__position, __n, __x);
+ profile_resize(this, old_size, this->capacity());
+ }
+
+ template<class _InputIterator>
+ void
+ insert(iterator __position,
+ _InputIterator __first, _InputIterator __last)
+ {
+ size_type old_size = this->capacity();
+ _Base::insert(__position, __first, __last);
+ profile_resize(this, old_size, this->capacity());
+ }
+
+ void
+ clear()
+ {
+ __profcxx_vector_destruct(this, this->capacity(), this->size());
+ _Base::clear();
+ }
+
+ private:
+ void profile_resize(void* obj, size_type old_size, size_type new_size)
+ {
+ if (old_size < new_size) {
+ __profcxx_vector_resize(this, old_size, new_size);
+ }
+ }
+ };
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator==(const vector<_Tp, _Alloc>& __lhs,
+ const vector<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() == __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator!=(const vector<_Tp, _Alloc>& __lhs,
+ const vector<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() != __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<(const vector<_Tp, _Alloc>& __lhs,
+ const vector<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() < __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator<=(const vector<_Tp, _Alloc>& __lhs,
+ const vector<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() <= __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>=(const vector<_Tp, _Alloc>& __lhs,
+ const vector<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() >= __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline bool
+ operator>(const vector<_Tp, _Alloc>& __lhs,
+ const vector<_Tp, _Alloc>& __rhs)
+ { return __lhs._M_base() > __rhs._M_base(); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(vector<_Tp, _Alloc>&& __lhs, vector<_Tp, _Alloc>& __rhs)
+ { __lhs.swap(__rhs); }
+
+ template<typename _Tp, typename _Alloc>
+ inline void
+ swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>&& __rhs)
+ { __lhs.swap(__rhs); }
+#endif
+
+} // namespace __profile
+ using _GLIBCXX_STD_D::_S_word_bit;
+} // namespace std
+
+#endif
diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
index 50015dbd31f..a9adef500f8 100644
--- a/libstdc++-v3/include/std/bitset
+++ b/libstdc++-v3/include/std/bitset
@@ -1334,4 +1334,8 @@ _GLIBCXX_END_NESTED_NAMESPACE
# include <debug/bitset>
#endif
+#ifdef _GLIBCXX_PROFILE
+# include <profile/bitset>
+#endif
+
#endif /* _GLIBCXX_BITSET */
diff --git a/libstdc++-v3/include/std/deque b/libstdc++-v3/include/std/deque
index 1891b34dcb3..1ef063b4fff 100644
--- a/libstdc++-v3/include/std/deque
+++ b/libstdc++-v3/include/std/deque
@@ -77,4 +77,8 @@
# include <debug/deque>
#endif
+#ifdef _GLIBCXX_PROFILE
+# include <profile/deque>
+#endif
+
#endif /* _GLIBCXX_DEQUE */
diff --git a/libstdc++-v3/include/std/list b/libstdc++-v3/include/std/list
index 8e58586f51d..4b09daa5f0a 100644
--- a/libstdc++-v3/include/std/list
+++ b/libstdc++-v3/include/std/list
@@ -75,5 +75,9 @@
# include <debug/list>
#endif
+#ifdef _GLIBCXX_PROFILE
+# include <profile/list>
+#endif
+
#endif /* _GLIBCXX_LIST */
diff --git a/libstdc++-v3/include/std/map b/libstdc++-v3/include/std/map
index 29a5f6e015c..91311a880b8 100644
--- a/libstdc++-v3/include/std/map
+++ b/libstdc++-v3/include/std/map
@@ -70,4 +70,8 @@
# include <debug/map>
#endif
+#ifdef _GLIBCXX_PROFILE
+# include <profile/map>
+#endif
+
#endif /* _GLIBCXX_MAP */
diff --git a/libstdc++-v3/include/std/set b/libstdc++-v3/include/std/set
index 801a8b1ef26..6233ec65999 100644
--- a/libstdc++-v3/include/std/set
+++ b/libstdc++-v3/include/std/set
@@ -70,4 +70,8 @@
# include <debug/set>
#endif
+#ifdef _GLIBCXX_PROFILE
+# include <profile/set>
+#endif
+
#endif /* _GLIBCXX_SET */
diff --git a/libstdc++-v3/include/std/unordered_map b/libstdc++-v3/include/std/unordered_map
index e338ef7805c..d20af8ba286 100644
--- a/libstdc++-v3/include/std/unordered_map
+++ b/libstdc++-v3/include/std/unordered_map
@@ -57,7 +57,7 @@
# include <tr1_impl/unordered_map>
#else
# define _GLIBCXX_INCLUDE_AS_CXX0X
-#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL)
+#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) || defined(_GLIBCXX_PROFILE)
# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace _GLIBCXX_STD_D {
# define _GLIBCXX_END_NAMESPACE_TR1 }
# define _GLIBCXX_TR1 _GLIBCXX_STD_D
@@ -77,6 +77,10 @@
# include <debug/unordered_map>
#endif
+#ifdef _GLIBCXX_PROFILE
+# include <profile/unordered_map>
+#endif
+
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif // _GLIBCXX_UNORDERED_MAP
diff --git a/libstdc++-v3/include/std/unordered_set b/libstdc++-v3/include/std/unordered_set
index 13b412b1eb5..87c8a4d80f4 100644
--- a/libstdc++-v3/include/std/unordered_set
+++ b/libstdc++-v3/include/std/unordered_set
@@ -57,7 +57,7 @@
# include <tr1_impl/unordered_set>
#else
# define _GLIBCXX_INCLUDE_AS_CXX0X
-#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL)
+#if defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL) || defined(_GLIBCXX_PROFILE)
# define _GLIBCXX_BEGIN_NAMESPACE_TR1 namespace _GLIBCXX_STD_D {
# define _GLIBCXX_END_NAMESPACE_TR1 }
# define _GLIBCXX_TR1 _GLIBCXX_STD_D
@@ -77,6 +77,9 @@
# include <debug/unordered_set>
#endif
+#ifdef _GLIBCXX_PROFILE
+# include <profile/unordered_set>
+#endif
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif // _GLIBCXX_UNORDERED_SET
diff --git a/libstdc++-v3/include/std/vector b/libstdc++-v3/include/std/vector
index 83a08ff4a1b..38b490685e9 100644
--- a/libstdc++-v3/include/std/vector
+++ b/libstdc++-v3/include/std/vector
@@ -39,7 +39,7 @@
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
+ ded "as is" without express or implied warranty.
*
*
* Copyright (c) 1996
@@ -78,5 +78,9 @@
# include <debug/vector>
#endif
+#ifdef _GLIBCXX_PROFILE
+# include <profile/vector>
+#endif
+
#endif /* _GLIBCXX_VECTOR */
diff --git a/libstdc++-v3/include/tr1_impl/hashtable b/libstdc++-v3/include/tr1_impl/hashtable
index 55056ef3da8..36194c9c0d4 100644
--- a/libstdc++-v3/include/tr1_impl/hashtable
+++ b/libstdc++-v3/include/tr1_impl/hashtable
@@ -416,6 +416,9 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1
_M_erase_node(_Node*, _Node**);
public:
+ // Expose insert_return_type for profiling mode.
+ typedef _Insert_Return_Type insert_return_type;
+
// Insert and erase
_Insert_Return_Type
insert(const value_type& __v)
diff --git a/libstdc++-v3/libprofc++/Makefile.am b/libstdc++-v3/libprofc++/Makefile.am
new file mode 100644
index 00000000000..7f46388e9c3
--- /dev/null
+++ b/libstdc++-v3/libprofc++/Makefile.am
@@ -0,0 +1,45 @@
+## Makefile for the GNU C++ Support library.
+##
+## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+## Free Software Foundation, Inc.
+##
+## Process this file with automake to produce Makefile.in.
+##
+## This file is part of GCC.
+##
+## GCC is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## GCC is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with GCC; see the file COPYING. If not, write to
+## the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+## Boston, MA 02110-1301, USA.
+
+include $(top_srcdir)/fragment.am
+
+toolexeclib_LTLIBRARIES = libprofc++.la
+noinst_LTLIBRARIES = libprofc++convenience.la
+
+headers = \
+ profiler.h \
+
+sources = \
+ profiler_node.cc \
+ profiler_trace.cc \
+ profiler_state.cc \
+ profiler_container_size.cc \
+ profiler_hashtable_size.cc \
+ profiler_vector_size.cc
+
+libprofc___la_SOURCES = $(sources) $(c_sources)
+libprofc__convenience_la_SOURCES = $(sources) $(c_sources)
+
+glibcxxinstalldir = $(gxx_include_dir)
+glibcxxinstall_HEADERS = $(headers)
diff --git a/libstdc++-v3/libprofc++/Makefile.in b/libstdc++-v3/libprofc++/Makefile.in
new file mode 100644
index 00000000000..20bc1b11add
--- /dev/null
+++ b/libstdc++-v3/libprofc++/Makefile.in
@@ -0,0 +1,726 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+target_triplet = @target@
+DIST_COMMON = $(glibcxxinstall_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(top_srcdir)/fragment.am
+profdir = libprofc++
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../config/enable.m4 \
+ $(top_srcdir)/../config/futex.m4 \
+ $(top_srcdir)/../config/iconv.m4 \
+ $(top_srcdir)/../config/lead-dot.m4 \
+ $(top_srcdir)/../config/lib-ld.m4 \
+ $(top_srcdir)/../config/lib-link.m4 \
+ $(top_srcdir)/../config/lib-prefix.m4 \
+ $(top_srcdir)/../config/multi.m4 \
+ $(top_srcdir)/../config/no-executables.m4 \
+ $(top_srcdir)/../config/override.m4 \
+ $(top_srcdir)/../config/proginstall.m4 \
+ $(top_srcdir)/../config/stdint.m4 \
+ $(top_srcdir)/../config/unwind_ipinfo.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/../ltoptions.m4 \
+ $(top_srcdir)/../ltsugar.m4 $(top_srcdir)/../ltversion.m4 \
+ $(top_srcdir)/crossconfig.m4 $(top_srcdir)/linkage.m4 \
+ $(top_srcdir)/acinclude.m4 $(top_srcdir)/../config/tls.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(toolexeclibdir)" \
+ "$(DESTDIR)$(glibcxxinstalldir)"
+toolexeclibLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES)
+libprofc___la_LIBADD =
+am__libprofc___la_SOURCES_DIST = profiler_node.cc profiler_trace.cc profiler_container_size.cc profiler_hashtable_size.cc profiler_vector_size.cc profiler_state.cc
+am__objects_1 = ${am__libprofc___la_SOURCES_DIST:.cc=.lo}
+am_libprofc___la_OBJECTS = $(am__objects_1)
+libprofc___la_OBJECTS = $(am_libprofc___la_OBJECTS)
+libprofc__convenience_la_LIBADD =
+am__libprofc__convenience_la_SOURCES_DIST = $(am__libprofc___la_SOURCES_DIST)
+am_libprofc__convenience_la_OBJECTS = $(am__objects_1)
+libprofc__convenience_la_OBJECTS = \
+ $(am_libprofc__convenience_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+SOURCES = $(libprofc___la_SOURCES) $(libprofc__convenience_la_SOURCES)
+DIST_SOURCES = $(am__libprofc___la_SOURCES_DIST) \
+ $(am__libprofc__convenience_la_SOURCES_DIST)
+glibcxxinstallHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(glibcxxinstall_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ABI_TWEAKS_SRCDIR = @ABI_TWEAKS_SRCDIR@
+ACLOCAL = @ACLOCAL@
+ALLOCATOR_H = @ALLOCATOR_H@
+ALLOCATOR_NAME = @ALLOCATOR_NAME@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+ATOMICITY_SRCDIR = @ATOMICITY_SRCDIR@
+ATOMIC_FLAGS = @ATOMIC_FLAGS@
+ATOMIC_WORD_SRCDIR = @ATOMIC_WORD_SRCDIR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BASIC_FILE_CC = @BASIC_FILE_CC@
+BASIC_FILE_H = @BASIC_FILE_H@
+CC = @CC@
+CCODECVT_CC = @CCODECVT_CC@
+CCOLLATE_CC = @CCOLLATE_CC@
+CCTYPE_CC = @CCTYPE_CC@
+CFLAGS = @CFLAGS@
+CLOCALE_CC = @CLOCALE_CC@
+CLOCALE_H = @CLOCALE_H@
+CLOCALE_INTERNAL_H = @CLOCALE_INTERNAL_H@
+CMESSAGES_CC = @CMESSAGES_CC@
+CMESSAGES_H = @CMESSAGES_H@
+CMONEY_CC = @CMONEY_CC@
+CNUMERIC_CC = @CNUMERIC_CC@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPU_DEFINES_SRCDIR = @CPU_DEFINES_SRCDIR@
+CSTDIO_H = @CSTDIO_H@
+CTIME_CC = @CTIME_CC@
+CTIME_H = @CTIME_H@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+C_INCLUDE_DIR = @C_INCLUDE_DIR@
+DEBUG_FLAGS = @DEBUG_FLAGS@
+DEFS = @DEFS@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_PARALLEL_FALSE = @ENABLE_PARALLEL_FALSE@
+ENABLE_PARALLEL_TRUE = @ENABLE_PARALLEL_TRUE@
+ENABLE_SYMVERS_DARWIN_FALSE = @ENABLE_SYMVERS_DARWIN_FALSE@
+ENABLE_SYMVERS_DARWIN_TRUE = @ENABLE_SYMVERS_DARWIN_TRUE@
+ENABLE_SYMVERS_FALSE = @ENABLE_SYMVERS_FALSE@
+ENABLE_SYMVERS_GNU_FALSE = @ENABLE_SYMVERS_GNU_FALSE@
+ENABLE_SYMVERS_GNU_NAMESPACE_FALSE = @ENABLE_SYMVERS_GNU_NAMESPACE_FALSE@
+ENABLE_SYMVERS_GNU_NAMESPACE_TRUE = @ENABLE_SYMVERS_GNU_NAMESPACE_TRUE@
+ENABLE_SYMVERS_GNU_TRUE = @ENABLE_SYMVERS_GNU_TRUE@
+ENABLE_SYMVERS_TRUE = @ENABLE_SYMVERS_TRUE@
+ENABLE_VISIBILITY_FALSE = @ENABLE_VISIBILITY_FALSE@
+ENABLE_VISIBILITY_TRUE = @ENABLE_VISIBILITY_TRUE@
+ERROR_CONSTANTS_SRCDIR = @ERROR_CONSTANTS_SRCDIR@
+EXEEXT = @EXEEXT@
+EXTRA_CXX_FLAGS = @EXTRA_CXX_FLAGS@
+FGREP = @FGREP@
+GLIBCXX_BUILD_DEBUG_FALSE = @GLIBCXX_BUILD_DEBUG_FALSE@
+GLIBCXX_BUILD_DEBUG_TRUE = @GLIBCXX_BUILD_DEBUG_TRUE@
+GLIBCXX_BUILD_PCH_FALSE = @GLIBCXX_BUILD_PCH_FALSE@
+GLIBCXX_BUILD_PCH_TRUE = @GLIBCXX_BUILD_PCH_TRUE@
+GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE = @GLIBCXX_C_HEADERS_COMPATIBILITY_FALSE@
+GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE = @GLIBCXX_C_HEADERS_COMPATIBILITY_TRUE@
+GLIBCXX_C_HEADERS_C_FALSE = @GLIBCXX_C_HEADERS_C_FALSE@
+GLIBCXX_C_HEADERS_C_GLOBAL_FALSE = @GLIBCXX_C_HEADERS_C_GLOBAL_FALSE@
+GLIBCXX_C_HEADERS_C_GLOBAL_TRUE = @GLIBCXX_C_HEADERS_C_GLOBAL_TRUE@
+GLIBCXX_C_HEADERS_C_STD_FALSE = @GLIBCXX_C_HEADERS_C_STD_FALSE@
+GLIBCXX_C_HEADERS_C_STD_TRUE = @GLIBCXX_C_HEADERS_C_STD_TRUE@
+GLIBCXX_C_HEADERS_C_TRUE = @GLIBCXX_C_HEADERS_C_TRUE@
+GLIBCXX_C_HEADERS_EXTRA_FALSE = @GLIBCXX_C_HEADERS_EXTRA_FALSE@
+GLIBCXX_C_HEADERS_EXTRA_TRUE = @GLIBCXX_C_HEADERS_EXTRA_TRUE@
+GLIBCXX_HOSTED_FALSE = @GLIBCXX_HOSTED_FALSE@
+GLIBCXX_HOSTED_TRUE = @GLIBCXX_HOSTED_TRUE@
+GLIBCXX_INCLUDES = @GLIBCXX_INCLUDES@
+GLIBCXX_LDBL_COMPAT_FALSE = @GLIBCXX_LDBL_COMPAT_FALSE@
+GLIBCXX_LDBL_COMPAT_TRUE = @GLIBCXX_LDBL_COMPAT_TRUE@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBICONV = @LIBICONV@
+LIBMATHOBJS = @LIBMATHOBJS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSUPCXX_PICFLAGS = @LIBSUPCXX_PICFLAGS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+NM = @NM@
+OBJEXT = @OBJEXT@
+OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
+OPT_LDFLAGS = @OPT_LDFLAGS@
+OS_INC_SRCDIR = @OS_INC_SRCDIR@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SECTION_FLAGS = @SECTION_FLAGS@
+SECTION_LDFLAGS = @SECTION_LDFLAGS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SYMVER_FILE = @SYMVER_FILE@
+TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WARN_FLAGS = @WARN_FLAGS@
+WERROR = @WERROR@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+baseline_dir = @baseline_dir@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+check_msgfmt = @check_msgfmt@
+datadir = @datadir@
+enable_shared = @enable_shared@
+enable_static = @enable_static@
+exec_prefix = @exec_prefix@
+glibcxx_MOFILES = @glibcxx_MOFILES@
+glibcxx_PCHFLAGS = @glibcxx_PCHFLAGS@
+glibcxx_POFILES = @glibcxx_POFILES@
+glibcxx_builddir = @glibcxx_builddir@
+glibcxx_localedir = @glibcxx_localedir@
+glibcxx_prefixdir = @glibcxx_prefixdir@
+glibcxx_srcdir = @glibcxx_srcdir@
+glibcxx_thread_h = @glibcxx_thread_h@
+glibcxx_toolexecdir = @glibcxx_toolexecdir@
+glibcxx_toolexeclibdir = @glibcxx_toolexeclibdir@
+gxx_include_dir = @gxx_include_dir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libtool_VERSION = @libtool_VERSION@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+multi_basedir = @multi_basedir@
+oldincludedir = @oldincludedir@
+port_specific_symbol_files = @port_specific_symbol_files@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+toplevel_srcdir = @toplevel_srcdir@
+
+# May be used by various profstitution variables.
+gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
+MAINT_CHARSET = latin1
+mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
+PWD_COMMAND = $${PWDCMD-pwd}
+STAMP = echo timestamp >
+toolexecdir = $(glibcxx_toolexecdir)
+toolexeclibdir = $(glibcxx_toolexeclibdir)
+
+# These bits are all figured out from configure. Look in acinclude.m4
+# or configure.ac to see how they are set. See GLIBCXX_EXPORT_FLAGS.
+CONFIG_CXXFLAGS = \
+ $(SECTION_FLAGS) $(EXTRA_CXX_FLAGS)
+
+WARN_CXXFLAGS = \
+ $(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once
+
+
+# -I/-D flags to pass when compiling.
+AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
+
+# Need this library to both be part of libstdc++.a, and installed
+# separately too.
+# 1) separate libprofc++.la
+toolexeclib_LTLIBRARIES = libprofc++.la
+# 2) integrated libprofc++convenience.la that is to be a part of libstdc++.a
+noinst_LTLIBRARIES = libprofc++convenience.la
+headers = \
+ profiler.h
+
+sources = \
+ profiler_node.cc \
+ profiler_trace.cc \
+ profiler_container_size.cc \
+ profiler_hashtable_size.cc \
+ profiler_vector_size.cc \
+ profiler_state.cc
+
+libprofc___la_SOURCES = $(sources) $(c_sources)
+libprofc__convenience_la_SOURCES = $(sources) $(c_sources)
+glibcxxinstalldir = $(gxx_include_dir)
+glibcxxinstall_HEADERS = $(headers)
+
+# AM_CXXFLAGS needs to be in each profdirectory so that it can be
+# modified in a per-library or per-prof-library way. Need to manually
+# set this option because CONFIG_CXXFLAGS has to be after
+# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
+# as the occasion call for it.
+AM_CXXFLAGS = \
+ -fno-implicit-templates \
+ $(LIBSUPCXX_PICFLAGS) \
+ $(WARN_CXXFLAGS) \
+ $(OPTIMIZE_CXXFLAGS) \
+ $(CONFIG_CXXFLAGS)
+
+AM_MAKEFLAGS = \
+ "gxx_include_dir=$(gxx_include_dir)"
+
+
+# Use special rules for pulling things out of libiberty. These
+# objects should be compiled with the "C" compiler, not the C++
+# compiler, and also should not use the C++ includes.
+C_INCLUDES = -I.. -I$(toplevel_srcdir)/libiberty -I$(toplevel_srcdir)/include
+C_COMPILE = \
+ $(CC) $(DEFS) $(C_INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+
+
+# LTCOMPILE is copied from LTCXXCOMPILE below.
+LTCOMPILE = $(LIBTOOL) --tag CC --tag disable-shared --mode=compile $(CC) \
+ $(DEFS) $(C_INCLUDES) $(LIBSUPCXX_PICFLAGS) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+
+
+# libstdc++ libtool notes
+
+# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
+# last. (That way, things like -O2 passed down from the toplevel can
+# be overridden by --enable-debug.)
+
+# 2) In general, libtool expects an argument such as `--tag=CXX' when
+# using the C++ compiler, because that will enable the settings
+# detected when C++ profport was being configured. However, when no
+# such flag is given in the command line, libtool attempts to figure
+# it out by matching the compiler name in each configuration section
+# against a prefix of the command line. The problem is that, if the
+# compiler name and its initial flags stored in the libtool
+# configuration file don't match those in the command line, libtool
+# can't decide which configuration to use, and it gives up. The
+# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
+# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
+# attempt to infer which configuration to use.
+#
+# We have to put --tag disable-shared after --tag CXX lest things
+# CXX undo the affect of disable-shared.
+LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared \
+ --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+
+LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
+
+# 3) We'd have a problem when building the shared libstdc++ object if
+# the rules automake generates would be used. We cannot allow g++ to
+# be used since this would add -lstdc++ to the link line which of
+# course is problematic at this point. So, we get the top-level
+# directory to configure libstdc++-v3 to use gcc as the C++
+# compilation driver.
+CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared \
+ --mode=link $(CXX) \
+ $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cc .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/fragment.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps libprofc++/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign --ignore-deps libprofc++/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(profdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(profdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+install-toolexeclibLTLIBRARIES: $(toolexeclib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(toolexeclibdir)" || $(mkdir_p) "$(DESTDIR)$(toolexeclibdir)"
+ @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=install $(toolexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(toolexeclibdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(toolexeclibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(toolexeclibdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-toolexeclibLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @set -x; list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(toolexeclibdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(toolexeclibdir)/$$p"; \
+ done
+
+clean-toolexeclibLTLIBRARIES:
+ -test -z "$(toolexeclib_LTLIBRARIES)" || rm -f $(toolexeclib_LTLIBRARIES)
+ @list='$(toolexeclib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libprofc++.la: $(libprofc___la_OBJECTS) $(libprofc___la_DEPENDENCIES)
+ $(CXXLINK) -rpath $(toolexeclibdir) $(libprofc___la_LDFLAGS) $(libprofc___la_OBJECTS) $(libprofc___la_LIBADD) $(LIBS)
+libprofc++convenience.la: $(libprofc__convenience_la_OBJECTS) $(libprofc__convenience_la_DEPENDENCIES)
+ $(CXXLINK) $(libprofc__convenience_la_LDFLAGS) $(libprofc__convenience_la_OBJECTS) $(libprofc__convenience_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(LTCOMPILE) -c -o $@ $<
+
+.cc.o:
+ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(mkdir_p) $(distdir)/..
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(toolexeclibdir)" "$(DESTDIR)$(glibcxxinstalldir)"; do \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ clean-toolexeclibLTLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-glibcxxinstallHEADERS
+
+install-exec-am: install-toolexeclibLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-glibcxxinstallHEADERS uninstall-info-am \
+ uninstall-toolexeclibLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES \
+ clean-toolexeclibLTLIBRARIES ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-glibcxxinstallHEADERS install-info install-info-am \
+ install-man install-strip install-toolexeclibLTLIBRARIES \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-glibcxxinstallHEADERS \
+ uninstall-info-am uninstall-toolexeclibLTLIBRARIES
+
+
+cp-demangle.c:
+ rm -f $@
+ $(LN_S) $(toplevel_srcdir)/libiberty/cp-demangle.c $@
+cp-demangle.lo: cp-demangle.c
+ $(LTCOMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
+cp-demangle.o: cp-demangle.c
+ $(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
+
+profiler_container_size.lo: profiler_container_size.cc profiler_container_size.h
+ $(LTCOMPILE) -std=c++0x -c $<
+
+profiler_hashtable_size.lo: profiler_hashtable_size.cc profiler_container_size.h
+ $(LTCOMPILE) -std=c++0x -c $<
+
+profiler_vector_size.lo: profiler_vector_size.cc profiler_container_size.h
+ $(LTCOMPILE) -std=c++0x -c $<
+
+profiler_trace.lo: profiler_trace.cc profiler_trace.h profiler_container_size.h
+ $(LTCOMPILE) -std=c++0x -c $<
+
+# We have to have rules modified from the default to counteract SUN make
+# prepending each of $(glibcxxinstall_HEADERS) with VPATH below.
+install-glibcxxinstallHEADERS: $(glibcxxinstall_HEADERS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(glibcxxinstalldir)
+ @list='$(glibcxxinstall_HEADERS)'; for p in $$list; do \
+ q=`echo $$p | sed -e 's,.*/,,'`; \
+ if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
+ echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(glibcxxinstalldir)/$$q"; \
+ $(INSTALL_DATA) $$d$$p $(DESTDIR)$(glibcxxinstalldir)/$$q; \
+ done
+
+uninstall-glibcxxinstallHEADERS:
+ @$(NORMAL_UNINSTALL)
+ list='$(glibcxxinstall_HEADERS)'; for p in $$list; do \
+ q=`echo $$p | sed -e 's,.*/,,'`; \
+ rm -f $(DESTDIR)$(glibcxxinstalldir)/$$q; \
+ done
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libstdc++-v3/libprofc++/profiler.h b/libstdc++-v3/libprofc++/profiler.h
new file mode 100644
index 00000000000..04480e3e646
--- /dev/null
+++ b/libstdc++-v3/libprofc++/profiler.h
@@ -0,0 +1,97 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2008 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 terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file libprofc++/profiler.h
+ * @brief Interface of the profiling runtime library.
+ */
+
+// Written by Lixia Liu
+
+#ifndef PROFCXX_PROFILER_H__
+#define PROFCXX_PROFILER_H__ 1
+
+namespace cxxprof_runtime
+{
+// State management.
+void turn_on();
+void turn_off();
+bool is_invalid();
+bool is_on();
+bool is_off();
+
+// Instrumentation hooks.
+void trace_hashtable_size_resize(void*, unsigned long, unsigned long);
+void trace_hashtable_size_destruct(void*, unsigned long, unsigned long);
+void trace_hashtable_size_construct(void*, unsigned long);
+void trace_vector_size_resize(void*, unsigned long, unsigned long);
+void trace_vector_size_destruct(void*, unsigned long, unsigned long);
+void trace_vector_size_construct(void*, unsigned long);
+} // namespace cxxprof_runtime
+
+// Master switch turns on all diagnostics.
+#ifdef _GLIBCXX_PROFILE
+#define _GLIBCXX_PROFILE_HASHTABLE_TOO_SMALL
+#define _GLIBCXX_PROFILE_HASHTABLE_TOO_LARGE
+#define _GLIBCXX_PROFILE_VECTOR_TOO_SMALL
+#define _GLIBCXX_PROFILE_VECTOR_TOO_LARGE
+#define _GLIBCXX_PROFILE_INEFFICIENT_HASH
+#endif
+
+// Turn on/off instrumentation for HASHTABLE_TOO_SMALL and HASHTABLE_TOO_LARGE.
+#if ((defined(_GLIBCXX_PROFILE_HASHTABLE_TOO_SMALL) \
+ && !defined(_NO_GLIBCXX_PROFILE_HASHTABLE_TOO_SMALL)) \
+ || (defined(_GLIBCXX_PROFILE_HASHTABLE_TOO_LARGE) \
+ && !defined(_NO_GLIBCXX_PROFILE_HASHTABLE_TOO_LARGE)))
+#define __profcxx_hashtable_resize cxxprof_runtime::trace_hashtable_size_resize
+#define __profcxx_hashtable_destruct \
+ cxxprof_runtime::trace_hashtable_size_destruct
+#define __profcxx_hashtable_construct \
+ cxxprof_runtime::trace_hashtable_size_construct
+#else
+#define __profcxx_hashtable_resize(x...)
+#define __profcxx_hashtable_destruct(x...)
+#define __profcxx_hashtable_construct(x...)
+#endif
+
+// Turn on/off instrumentation for VECTOR_TOO_SMALL and VECTOR_TOO_LARGE.
+#if ((defined(_GLIBCXX_PROFILE_VECTOR_TOO_SMALL) \
+ && !defined(_NO_GLIBCXX_PROFILE_VECTOR_TOO_SMALL)) \
+ || (defined(_GLIBCXX_PROFILE_VECTOR_TOO_LARGE) \
+ && !defined(_NO_GLIBCXX_PROFILE_VECTOR_TOO_LARGE)))
+#define __profcxx_vector_resize cxxprof_runtime::trace_vector_size_resize
+#define __profcxx_vector_destruct cxxprof_runtime::trace_vector_size_destruct
+#define __profcxx_vector_construct cxxprof_runtime::trace_vector_size_construct
+#else
+#define __profcxx_vector_resize(x...)
+#define __profcxx_vector_destruct(x...)
+#define __profcxx_vector_construct(x...)
+#endif
+
+#endif // PROFCXX_PROFILER_H__
diff --git a/libstdc++-v3/libprofc++/profiler_container_size.cc b/libstdc++-v3/libprofc++/profiler_container_size.cc
new file mode 100644
index 00000000000..f3eabb27829
--- /dev/null
+++ b/libstdc++-v3/libprofc++/profiler_container_size.cc
@@ -0,0 +1,148 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2008 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 terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file libprofc++/profiler_trace.h
+ * @brief Data structures to represent profiling traces.
+ */
+
+// Written by Lixia Liu
+
+#include "profiler.h"
+#include "profiler_node.h"
+#include "profiler_trace.h"
+#include "profiler_state.h"
+#include "profiler_container_size.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+namespace cxxprof_runtime
+{
+
+static long _S_reserve_size = -1; // 1M.
+
+long reserve_size()
+{
+ return _S_reserve_size;
+}
+
+void trace_container_size::destruct(void* __obj, stdlib_size_t __num,
+ stdlib_size_t __inum)
+{
+ if (!is_on()) return;
+
+ // First find the item from the live objects and update the informations.
+ ObjMap* live = &trace_info.first;
+ ObjMap::iterator objs = live->find(__obj);
+ StackMap* summary = &trace_info.second;
+
+ if (objs != live->end()) {
+ stdlib_info_size *res = objs->second;
+ res->destruct(__obj, __num, __inum);
+
+ // Remove the node.
+ live->erase(__obj);
+ stack_t* s = res->stack();
+
+ // Find the node in the summary.
+ StackMap::iterator it = summary->find(s);
+
+ // Merge the result into the first one.
+ // Basically now merge data with same stack.
+ if (it == summary->end()) {
+ // Create new node.
+ summary->insert(StackMap::value_type(s, res));
+ // Turn off the profiling if having enough information.
+ if (_S_reserve_size > 0 && summary->size() >= _S_reserve_size ) {
+ turn_off();
+ }
+ } else {
+ // Merge data with previous node.
+ res = it->second;
+ res->destruct(__obj, __num, __inum);
+ }
+ }
+ // Skip the case if never find constructor.
+}
+
+void trace_container_size::print()
+{
+ char* trace_file_name();
+ FILE* f = fopen(trace_file_name(), "a");
+
+ StackMap summary = trace_info.second;
+ StackMap::iterator it;
+ for (it = summary.begin(); it != summary.end(); it++) {
+ stdlib_info_size *res = it->second;
+ res->print(f);
+ }
+
+ fclose(f);
+}
+
+void trace_container_size::resize(void* __obj, int __from, int __to)
+{
+ if (!is_on()) return;
+
+ // First find the item from the live objects and update the informations.
+ ObjMap um = trace_info.first;
+ ObjMap::iterator objs = um.find(__obj);
+
+ if (objs != um.end()) {
+ stdlib_info_size *res = objs->second;
+ res->resize(__obj, __from, __to);
+ }
+ // Do nothing if we don't have it registered.
+}
+
+// Free all information content of traces.
+void trace_container_size::free_all()
+{
+ ObjMap* live = &trace_info.first;
+ StackMap* summary = &trace_info.second;
+ if (live) {
+ ObjMap::iterator it;
+ for (it = live->begin(); it != live->end(); it++)
+ {
+ delete it->second;
+ }
+ }
+ if (summary) {
+ StackMap::iterator it;
+ for (it = summary->begin(); it != summary->end(); it++)
+ {
+ delete it->second;
+ delete it->first;
+ }
+ }
+}
+
+} // namespace cxxprof_runtime
diff --git a/libstdc++-v3/libprofc++/profiler_container_size.h b/libstdc++-v3/libprofc++/profiler_container_size.h
new file mode 100644
index 00000000000..667c56c9caa
--- /dev/null
+++ b/libstdc++-v3/libprofc++/profiler_container_size.h
@@ -0,0 +1,87 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2008 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 terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file libprofc++/profiler_trace.h
+ * @brief Data structures to represent profiling traces.
+ */
+
+// Written by Lixia Liu
+
+#ifndef PROFCXX_PROFILER_CONTAINER_SIZE_H__
+#define PROFCXX_PROFILER_CONTAINER_SIZE_H__ 1
+
+#include "profiler.h"
+#include "profiler_node.h"
+#include "profiler_trace.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+namespace cxxprof_runtime
+{
+long reserve_size();
+
+class trace_container_size
+ : public trace_base<stdlib_info_size*, stdlib_info_size*>
+{
+ public:
+ trace_container_size() {}
+ ~trace_container_size() {free_all();}
+ trace_container_size(unsigned long size)
+ : trace_base<stdlib_info_size*, stdlib_info_size*>(size) {};
+
+ // Insert a new node at construct with object, callstack and initial size.
+ void insert(void* __obj, stack_t* __stack, stdlib_size_t __num);
+ // Call at destruction/clean to set container final size.
+ void destruct(void* __obj, stdlib_size_t __num, stdlib_size_t __inum);
+ void construct(void* __obj, stdlib_size_t __inum);
+ // Call at resize to set resize/cost information.
+ void resize(void* __obj, int __from, int __to);
+ void print();
+ void free_all();
+ // Get stack but return a vector.
+ stack_t* get_stack();
+};
+
+inline void trace_container_size::insert(void* __obj, stack_t* __stack,
+ stdlib_size_t __num)
+{
+ ObjMap* live = &trace_info.first;
+
+ // Control the size to be less than reserved size.
+ if (reserve_size() > 0 && live->size() > reserve_size()) return;
+
+ stdlib_info_size *node = new stdlib_info_size(__obj, __stack, __num);
+ live->insert(ObjMap::value_type(__obj, node));
+}
+
+} // namespace cxxprof_runtime
+#endif /* PROFCXX_PROFILER_CONTAINER_SIZE_H__ */
diff --git a/libstdc++-v3/libprofc++/profiler_hashtable_size.cc b/libstdc++-v3/libprofc++/profiler_hashtable_size.cc
new file mode 100644
index 00000000000..256a2677eb0
--- /dev/null
+++ b/libstdc++-v3/libprofc++/profiler_hashtable_size.cc
@@ -0,0 +1,95 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2008 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 terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file libprofc++/profiler_hashtable_size.cc
+ * @brief Collection of hashtable size traces.
+ */
+
+// Written by Lixia Liu
+
+#include "profiler.h"
+#include "profiler_node.h"
+#include "profiler_trace.h"
+#include "profiler_state.h"
+#include "profiler_container_size.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+namespace cxxprof_runtime
+{
+
+class trace_hashtable_size : public trace_container_size
+{
+ public:
+ trace_hashtable_size(unsigned long size)
+ : trace_container_size(size) {}
+};
+
+static trace_hashtable_size* _S_hashtable_size = NULL;
+
+void trace_hashtable_size_construct(void* __obj, stdlib_size_t __num)
+{
+ if (!__profcxx_init()) return;
+
+ _S_hashtable_size->insert(__obj, get_stack(), __num);
+}
+
+void trace_hashtable_size_destruct(void* __obj, stdlib_size_t __num,
+ stdlib_size_t __inum)
+{
+ if (!__profcxx_init()) return;
+
+ _S_hashtable_size->destruct(__obj, __num, __inum);
+}
+
+void trace_hashtable_size_resize(void* __obj, stdlib_size_t __from,
+ stdlib_size_t __to)
+{
+ if (!__profcxx_init()) return;
+
+ _S_hashtable_size->resize(__obj, __from, __to);
+}
+
+void trace_hashtable_size_init() {
+ unsigned long size = reserve_size() <= 0 ? 0 : reserve_size();
+ _S_hashtable_size = new trace_hashtable_size(size);
+}
+
+void trace_hashtable_size_report() {
+ if (_S_hashtable_size) {
+ _S_hashtable_size->print();
+ delete _S_hashtable_size;
+ _S_hashtable_size = NULL;
+ }
+}
+
+} // namespace cxxprof_runtime
diff --git a/libstdc++-v3/libprofc++/profiler_node.cc b/libstdc++-v3/libprofc++/profiler_node.cc
new file mode 100644
index 00000000000..cf4610004c2
--- /dev/null
+++ b/libstdc++-v3/libprofc++/profiler_node.cc
@@ -0,0 +1,82 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2008 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 terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file libprofc++/profiler_node.h
+ * @brief Data structures to represent a single profiling event.
+ */
+
+// Written by Lixia Liu
+
+#include "profiler_node.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+namespace cxxprof_runtime
+{
+
+void stdlib_info_size::print_debug()
+{
+ for(stack_t::iterator it = _M_stack->begin(); it != _M_stack->end(); it++) {
+ fprintf(stderr, "[%p]", *it);
+ }
+ fprintf(stderr, "|%lu %lu %d ", _M_init, _M_count, int(_M_cost));
+ fprintf(stderr, "%lu %lu %lu %lu %lu %lu %lu %lu\n",
+ _M_resize, _M_min, _M_max, _M_total, _M_item_min, _M_item_max,
+ _M_item_total, (stdlib_size_t)_M_object);
+}
+
+void stdlib_info_size::print(FILE* __f)
+{
+ // XXX: This will be replaced entirely by a binary trace IO module.
+ // For now, 1024 is provably sufficient in all possible cases because
+ // max trace depth is 32.
+ char __str[1024];
+ __str[0] = '\0';
+
+ for (stack_t::iterator it = _M_stack->begin(); it != _M_stack->end(); it++) {
+ snprintf(__str + strlen(__str), sizeof(__str), "[%p]", *it);
+ }
+ assert(strlen(__str) < sizeof(__str));
+ snprintf(__str + strlen(__str), sizeof(__str), "|%lu %lu %lu ",
+ _M_init, _M_count, static_cast<unsigned long>(_M_cost));
+ assert(strlen(__str) < sizeof(__str));
+ snprintf(__str + strlen(__str), sizeof(__str), "%lu %lu %lu %lu ",
+ _M_resize, _M_min, _M_max, _M_total);
+ assert(strlen(__str) < sizeof(__str));
+ snprintf(__str + strlen(__str), sizeof(__str), "%lu %lu %lu %lu\n",
+ _M_item_min, _M_item_max, _M_item_total,
+ reinterpret_cast<stdlib_size_t>(_M_object));
+
+ fputs(__str, __f);
+}
+
+} // namespace cxxprof_runtime
diff --git a/libstdc++-v3/libprofc++/profiler_node.h b/libstdc++-v3/libprofc++/profiler_node.h
new file mode 100644
index 00000000000..c0c0bdb5c5f
--- /dev/null
+++ b/libstdc++-v3/libprofc++/profiler_node.h
@@ -0,0 +1,158 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2008 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 terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file libprofc++/profiler_node.h
+ * @brief Data structures to represent a single profiling event.
+ */
+
+// Written by Lixia Liu
+
+#ifndef PROFCXX_PROFILER_NODE_H__
+#define PROFCXX_PROFILER_NODE_H__ 1
+
+#include <assert.h>
+#include <stdio.h>
+#include <vector>
+
+namespace cxxprof_runtime
+{
+typedef unsigned long stdlib_size_t;
+
+#ifndef _GLIBCXX_PROFILE
+using std::vector;
+#else
+using std::_GLIBCXX_STD_PR::vector;
+#endif
+
+typedef vector<void*> stack_t;
+
+// Base class for all information nodes.
+class stdlib_info_base
+{
+ public:
+ stdlib_info_base()
+ : _M_object(NULL), _M_stack(NULL) {}
+
+ stdlib_info_base(void* __obj, stack_t* __stack);
+ virtual ~stdlib_info_base() {}
+
+ // Accessors.
+ void set_stack(stack_t* stack);
+ stack_t* stack() { return _M_stack; }
+ int stack_size() { return _M_stack?_M_stack->size():0; }
+ void set_cost(float cost);
+ float cost() { return _M_cost; }
+
+ protected:
+ void* _M_object;
+ float _M_cost;
+ stack_t* _M_stack;
+};
+
+// Class for container size node.
+class stdlib_info_size:public stdlib_info_base
+{
+ public:
+ stdlib_info_size() {}
+ stdlib_info_size(void* __obj, stack_t* __stack, stdlib_size_t __num);
+ virtual ~stdlib_info_size() {}
+
+ // Call if a container is destructed or cleaned.
+ void destruct(void* __obj, stdlib_size_t __num, stdlib_size_t __inum);
+
+ // Estimate the cost of resize/rehash.
+ float resize_cost(stdlib_size_t __from, stdlib_size_t __to) { return __from; }
+
+ // Call if container is resized.
+ void resize(void* __obj, stdlib_size_t __from, stdlib_size_t __to);
+
+ void print_debug();
+
+ void print(FILE* f);
+private:
+ stdlib_size_t _M_init;
+ stdlib_size_t _M_max; // range of # buckets
+ stdlib_size_t _M_min;
+ stdlib_size_t _M_total;
+ stdlib_size_t _M_item_min; // range of # items
+ stdlib_size_t _M_item_max;
+ stdlib_size_t _M_item_total;
+ stdlib_size_t _M_count;
+ stdlib_size_t _M_resize;
+};
+
+inline stdlib_info_base::stdlib_info_base(void* __obj, stack_t* __stack)
+{
+ _M_stack = __stack;
+ _M_object = __obj;
+ _M_cost = 0;
+}
+
+inline stdlib_info_size::stdlib_info_size(void* __obj, stack_t* __stack,
+ stdlib_size_t __num)
+ : stdlib_info_base(__obj, __stack)
+{
+ _M_init = _M_max = __num;
+ _M_item_min = _M_item_max = _M_item_total = _M_total = 0;
+ _M_min = 0;
+ _M_count = 0;
+ _M_resize = 0;
+}
+
+inline void stdlib_info_size::destruct(void* __obj, stdlib_size_t __num,
+ stdlib_size_t __inum)
+{
+ assert(__obj != NULL);
+ _M_max = _M_max < __num ? __num:_M_max;
+ _M_item_max = _M_item_max < __inum ? __inum:_M_item_max;
+ if (_M_min==0) {
+ _M_min = __num;
+ _M_item_min = __inum;
+ } else {
+ _M_min = _M_min < __num ? _M_min:__num;
+ _M_item_min = _M_item_min < __inum ? _M_item_min:__inum;
+ }
+ _M_total += __num;
+ _M_item_total += __inum;
+ _M_count += 1;
+}
+
+inline void stdlib_info_size::resize(void* __obj, stdlib_size_t __from,
+ stdlib_size_t __to)
+{
+ assert(__obj == _M_object);
+ assert(__from <= __to);
+ _M_cost += this->resize_cost(__from, __to);
+ _M_resize += 1;
+ _M_max = _M_max > __to ? _M_max : __to;
+}
+
+} // namespace cxxprof_runtime
+#endif /* PROFCXX_PROFILER_NODE_H__ */
diff --git a/libstdc++-v3/libprofc++/profiler_state.cc b/libstdc++-v3/libprofc++/profiler_state.cc
new file mode 100644
index 00000000000..1f7e576d8e5
--- /dev/null
+++ b/libstdc++-v3/libprofc++/profiler_state.cc
@@ -0,0 +1,44 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2008 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 terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file libprofc++/profiler_state.cc
+ * @brief Global profiler state.
+ */
+
+// Written by Lixia Liu
+
+#include "profiler_state.h"
+
+namespace cxxprof_runtime
+{
+
+state* _S_diag_state = NULL;
+
+} // end namespace cxxprof_runtime
diff --git a/libstdc++-v3/libprofc++/profiler_state.h b/libstdc++-v3/libprofc++/profiler_state.h
new file mode 100644
index 00000000000..f40fde5c9b0
--- /dev/null
+++ b/libstdc++-v3/libprofc++/profiler_state.h
@@ -0,0 +1,94 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2008 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 terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file libprofc++/profiler_state.cc
+ * @brief Global profiler state.
+ */
+
+// Written by Lixia Liu
+
+#ifndef PROFCXX_PROFILER_STATE_H__
+#define PROFCXX_PROFILER_STATE_H__ 1
+
+#include <assert.h>
+#include <stdio.h>
+
+namespace cxxprof_runtime
+{
+
+class state
+{
+ public:
+ state() : _M_state(INVALID) {}
+ ~state() {}
+
+ bool is_on() { return _M_state == ON; }
+ bool is_off() { return _M_state == OFF; }
+ bool is_invalid() { return _M_state == INVALID; }
+ void turn_on() { _M_state = ON; }
+ void turn_off() { _M_state = OFF; }
+
+ private:
+ enum state_type { ON, OFF, INVALID };
+ state_type _M_state;
+};
+
+extern state* _S_diag_state;
+
+inline bool is_on()
+{
+ return _S_diag_state && _S_diag_state->is_on();
+}
+
+inline bool is_off()
+{
+ return _S_diag_state && _S_diag_state->is_off();
+}
+
+inline bool is_invalid()
+{
+ return !_S_diag_state || _S_diag_state->is_invalid();
+}
+
+inline void turn_on()
+{
+ if (!_S_diag_state) { _S_diag_state = new state; }
+ _S_diag_state->turn_on();
+}
+
+inline void turn_off()
+{
+ assert(_S_diag_state);
+ _S_diag_state->turn_off();
+}
+
+
+} // end namespace cxxprof_runtime
+#endif /* PROFCXX_PROFILER_STATE_H__ */
diff --git a/libstdc++-v3/libprofc++/profiler_trace.cc b/libstdc++-v3/libprofc++/profiler_trace.cc
new file mode 100644
index 00000000000..10aad3d3041
--- /dev/null
+++ b/libstdc++-v3/libprofc++/profiler_trace.cc
@@ -0,0 +1,119 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2008 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 terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file libprofc++/profiler_trace.cc
+ * @brief Data structures to represent profiling traces.
+ */
+
+// Written by Lixia Liu
+
+#include "profiler.h"
+#include "profiler_node.h"
+#include "profiler_state.h"
+#include "profiler_trace.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+namespace cxxprof_runtime
+{
+class trace_hashtable_size;
+
+// Point to all stdlib profiling information
+static trace_hashtable_size* _S_hashtable_size = NULL;
+
+// Trace file name. Default to "profile-stdlib.txt".
+static char _S_trace_default_file_name[] = "./profile-stdlib.txt";
+static char _S_trace_env_var[] = "GLIBCXX_PROFILE_TRACE";
+static char* _S_trace_file_name = _S_trace_default_file_name;
+
+// Environment variable to turn everything off.
+static char _S_off_env_var[] = "GLIBCXX_PROFILE_OFF";
+
+// Individual diagnostic init and report/destroy methods.
+void trace_vector_size_init();
+void trace_hashtable_size_init();
+void trace_vector_size_report();
+void trace_hashtable_size_report();
+
+char* trace_file_name() {return _S_trace_file_name;}
+
+// Final report, meant to be registered by "atexit".
+static void __profcxx_report(void)
+{
+ turn_off();
+
+ trace_vector_size_report();
+ trace_hashtable_size_report();
+}
+
+static void set_trace_path() {
+ char* env_trace_file_name = getenv(_S_trace_env_var);
+
+ if (env_trace_file_name) {
+ _S_trace_file_name = env_trace_file_name;
+ }
+
+ // Make sure early that we can create the trace file.
+ FILE* f = fopen(_S_trace_file_name, "w");
+ if (f) {
+ fclose(f);
+ } else {
+ fprintf(stderr, "Cannot create trace file at given path '%s'.",
+ _S_trace_file_name);
+ exit(1);
+ }
+}
+
+void __profcxx_init_unconditional()
+{
+ stdlib_lock(&init_lock);
+
+ if (is_invalid()) {
+ if (getenv(_S_off_env_var)) {
+ turn_off();
+ } else {
+ set_trace_path();
+ atexit(__profcxx_report);
+
+ // Initialize data structures for each trace class.
+ trace_vector_size_init();
+ trace_hashtable_size_init();
+
+ // Go live.
+ turn_on();
+ }
+ }
+
+ stdlib_unlock(&init_lock);
+}
+
+} // namespace cxxprof_runtime
diff --git a/libstdc++-v3/libprofc++/profiler_trace.h b/libstdc++-v3/libprofc++/profiler_trace.h
new file mode 100644
index 00000000000..12acd9ff2d1
--- /dev/null
+++ b/libstdc++-v3/libprofc++/profiler_trace.h
@@ -0,0 +1,146 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2008 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 terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file libprofc++/profiler_trace.h
+ * @brief Data structures to represent profiling traces.
+ */
+
+// Written by Lixia Liu
+
+#ifndef PROFCXX_PROFILER_TRACE_H__
+#define PROFCXX_PROFILER_TRACE_H__ 1
+
+#include <execinfo.h>
+#include <string.h>
+#include <unordered_map>
+#include <vector>
+#include "profiler_state.h"
+
+namespace cxxprof_runtime
+{
+#ifndef _GLIBCXX_PROFILE
+using std::unordered_map;
+using std::vector;
+#else
+using std::_GLIBCXX_STD_PR::unordered_map;
+using std::_GLIBCXX_STD_PR::vector;
+#endif
+
+typedef vector<void*> stack_t;
+
+inline stack_t* get_stack()
+{
+ const int _S_max_stack_depth = 32;
+ void* __stack_buffer[_S_max_stack_depth];
+
+ int __depth = backtrace(__stack_buffer, _S_max_stack_depth);
+ stack_t* __stack = new vector<void*>(__depth);
+ memcpy(&(*__stack)[0], __stack_buffer, __depth * sizeof(void*));
+
+ return __stack;
+}
+
+// Hash function for summary trace using stack as index.
+class stack_hash
+{
+ public:
+ size_t operator()(stack_t* const __s) const
+ {
+ if (__s == NULL) return 0;
+
+ size_t index = 0;
+ for (stack_t::iterator it = __s->begin(); it != __s->end(); ++it) {
+ index += (unsigned long)*it;
+ }
+ return index;
+ }
+
+ bool operator() (stack_t* const stack1, stack_t* const stack2) const
+ {
+ if (stack1 == NULL && stack2 == NULL) return true;
+
+ if (stack1 == NULL || stack2 == NULL) return false;
+
+ if (stack1->size() != stack2->size()) return false;
+
+ size_t byte_size = stack1->size() * sizeof(stack_t::value_type);
+ return memcmp(&(*stack1)[0], &(*stack2)[0], byte_size) == 0;
+ }
+};
+
+template <typename _Obj, typename _Summary>
+class trace_base
+{
+ public:
+ trace_base() {}
+ trace_base(unsigned long size);
+ ~trace_base() {}
+
+protected:
+ typedef unordered_map<void*, _Obj> ObjMap;
+ typedef unordered_map<stack_t*, _Summary, stack_hash, stack_hash> StackMap;
+ std::pair <ObjMap, StackMap> trace_info;
+};
+
+template <typename _Obj, typename _Summary>
+inline trace_base<_Obj, _Summary>::trace_base(unsigned long size)
+{
+ trace_info.first.rehash(size);
+ trace_info.second.rehash(size);
+}
+
+// This function must be called by each instrumentation point.
+// The common path is inlined fully.
+inline bool __profcxx_init(void)
+{
+ if (is_invalid()) {
+ void __profcxx_init_unconditional();
+ __profcxx_init_unconditional();
+ }
+ return is_on();
+}
+
+// Mutex for multiple threads ifdef THEREAD
+#ifdef THREADS
+static pthread_mutex_t list_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t init_lock = PTHREAD_MUTEX_INITIALIZER;
+
+// Disable mutext when runing with single thread.
+#define stdlib_lock(A) pthread_mutex_lock(A)
+#define stdlib_unlock(A) pthread_mutex_unlock(A)
+
+#else
+// Disable mutext when runing with single thread.
+#define stdlib_lock(A)
+#define stdlib_unlock(A)
+#endif
+} // namespace cxxprof_runtime
+
+#endif /* PROFCXX_PROFILER_TRACE_H__ */
diff --git a/libstdc++-v3/libprofc++/profiler_vector_size.cc b/libstdc++-v3/libprofc++/profiler_vector_size.cc
new file mode 100644
index 00000000000..c9b5bbdce16
--- /dev/null
+++ b/libstdc++-v3/libprofc++/profiler_vector_size.cc
@@ -0,0 +1,94 @@
+// -*- C++ -*-
+//
+// Copyright (C) 2008 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 terms
+// of the GNU General Public License as published by the Free Software
+// Foundation; either version 2, or (at your option) any later
+// version.
+
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/** @file libprofc++/profiler_vector_size.cc
+ * @brief Collection of vector size traces.
+ */
+
+// Written by Lixia Liu
+
+#include "profiler.h"
+#include "profiler_node.h"
+#include "profiler_trace.h"
+#include "profiler_state.h"
+#include "profiler_container_size.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+
+namespace cxxprof_runtime
+{
+
+class trace_vector_size : public trace_container_size
+{
+ public:
+ trace_vector_size(unsigned long size)
+ : trace_container_size(size) {}
+};
+static trace_vector_size* _S_vector_size = NULL;
+
+void trace_vector_size_construct(void* __obj, stdlib_size_t __num)
+{
+ if (!__profcxx_init()) return;
+
+ _S_vector_size->insert(__obj, get_stack(), __num);
+}
+
+void trace_vector_size_destruct(void* __obj, stdlib_size_t __num,
+ stdlib_size_t __inum)
+{
+ if (!__profcxx_init()) return;
+
+ _S_vector_size->destruct(__obj, __num, __inum);
+}
+
+void trace_vector_size_resize(void* __obj, stdlib_size_t __from,
+ stdlib_size_t __to)
+{
+ if (!__profcxx_init()) return;
+
+ _S_vector_size->resize(__obj, __from, __to);
+}
+
+void trace_vector_size_init() {
+ unsigned long size = reserve_size() <= 0 ? 0 : reserve_size();
+ _S_vector_size = new trace_vector_size(size);
+}
+
+void trace_vector_size_report() {
+ if (_S_vector_size) {
+ _S_vector_size->print();
+ delete _S_vector_size;
+ _S_vector_size = NULL;
+ }
+}
+
+} // namespace cxxprof_runtime
diff --git a/libstdc++-v3/src/Makefile.am b/libstdc++-v3/src/Makefile.am
index 8d2cbf5e14b..08f423238d9 100644
--- a/libstdc++-v3/src/Makefile.am
+++ b/libstdc++-v3/src/Makefile.am
@@ -196,7 +196,8 @@ libstdc___la_SOURCES = $(sources)
libstdc___la_LIBADD = \
$(top_builddir)/libmath/libmath.la \
- $(top_builddir)/libsupc++/libsupc++convenience.la
+ $(top_builddir)/libsupc++/libsupc++convenience.la \
+ $(top_builddir)/libprofc++/libprofc++convenience.la
libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
diff --git a/libstdc++-v3/src/Makefile.in b/libstdc++-v3/src/Makefile.in
index f0e98973d3f..e40d3275f4d 100644
--- a/libstdc++-v3/src/Makefile.in
+++ b/libstdc++-v3/src/Makefile.in
@@ -428,7 +428,8 @@ sources = \
libstdc___la_SOURCES = $(sources)
libstdc___la_LIBADD = \
$(top_builddir)/libmath/libmath.la \
- $(top_builddir)/libsupc++/libsupc++convenience.la
+ $(top_builddir)/libsupc++/libsupc++convenience.la \
+ $(top_builddir)/libprofc++/libprofc++convenience.la
libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
libstdc___la_LDFLAGS = \
diff --git a/libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc b/libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc
index f24babc0792..e97edabd473 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/resize/moveable.cc
@@ -50,26 +50,26 @@ test01()
a.resize(98);
a.resize(99);
a.resize(100);
-#ifndef _GLIBCXX_DEBUG
+#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE)
VERIFY( copycounter::copycount == 100 + 1 );
#else
VERIFY( copycounter::copycount == 100 + 1 + 4 );
#endif
a.resize(99);
a.resize(0);
-#ifndef _GLIBCXX_DEBUG
+#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE)
VERIFY( copycounter::copycount == 100 + 1 );
#else
VERIFY( copycounter::copycount == 100 + 1 + 6 );
#endif
a.resize(100);
-#ifndef _GLIBCXX_DEBUG
+#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE)
VERIFY( copycounter::copycount == 200 + 2 );
#else
VERIFY( copycounter::copycount == 200 + 2 + 7 );
#endif
a.clear();
-#ifndef _GLIBCXX_DEBUG
+#if !defined(_GLIBCXX_DEBUG) && !defined(_GLIBCXX_PROFILE)
VERIFY( copycounter::copycount == 200 + 2 );
#else
VERIFY( copycounter::copycount == 200 + 2 + 7 );
diff --git a/libstdc++-v3/testsuite/31_profile/hash_map.cc b/libstdc++-v3/testsuite/31_profile/hash_map.cc
new file mode 100644
index 00000000000..7939a35e3ef
--- /dev/null
+++ b/libstdc++-v3/testsuite/31_profile/hash_map.cc
@@ -0,0 +1,22 @@
+// { dg-options "-Wno-deprecated" }
+/* testing the gcc instrumented */
+
+#include <ext/hash_map>
+using namespace std;
+using __gnu_cxx::hash_map;
+
+int main()
+{
+ hash_map <int, int> *tmp;
+
+ for (int j=1; j<=10; j++)
+ {
+ tmp = new hash_map<int, int>;
+ // Insert more than default item
+ for (int i=0; i<10000*j; i++) {
+ (*tmp)[i]= i;
+ }
+ delete tmp;
+ }
+}
+
diff --git a/libstdc++-v3/testsuite/31_profile/unordered.cc b/libstdc++-v3/testsuite/31_profile/unordered.cc
new file mode 100644
index 00000000000..93b506e9832
--- /dev/null
+++ b/libstdc++-v3/testsuite/31_profile/unordered.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=gnu++0x" }
+/* testing the gcc instrumented */
+
+#include <unordered_map>
+#include <unordered_set>
+using std::unordered_map;
+using std::unordered_set;
+
+void test_unordered_set()
+{
+ // Test for unordered set
+ unordered_set <int> *tmp2;
+ tmp2 = new unordered_set<int>;
+ tmp2->insert(1);
+ delete tmp2;
+}
+void test_unordered_map()
+{
+ unordered_map <int, int> *tmp;
+ for (int i=0; i<20; i++)
+ {
+ tmp = new unordered_map<int, int>(i+2);
+ // Insert more than default item
+ for (int j=0; j<10000; j++) {
+ (*tmp)[j]= j;
+ }
+
+ delete tmp;
+ }
+
+ tmp = new unordered_map<int, int>;
+
+ // Insert more than default item
+ for (int i=0; i<150000; i++) {
+// (*tmp)[i] = i;
+ (*tmp).insert(unordered_map<int, int>::value_type(i, i));
+ }
+
+ (*tmp).erase(1);
+ delete tmp;
+}
+int main()
+{
+ test_unordered_set();
+ test_unordered_map();
+}
+
diff --git a/libstdc++-v3/testsuite/31_profile/vector.cc b/libstdc++-v3/testsuite/31_profile/vector.cc
new file mode 100644
index 00000000000..1e9d01afec5
--- /dev/null
+++ b/libstdc++-v3/testsuite/31_profile/vector.cc
@@ -0,0 +1,18 @@
+// Test vector: performance difference 25% (0.444s vs 0.539s)
+// Advice: set tmp as 10000
+
+#include <vector>
+
+using std::vector;
+
+int main()
+{
+ vector <int> tmp;
+
+ for (int j=0; j<2000; j++)
+ // Insert more than default item
+ for (int i=0; i<10000; i++) {
+ tmp.push_back(i);
+ }
+}
+
diff --git a/libstdc++-v3/testsuite/Makefile.am b/libstdc++-v3/testsuite/Makefile.am
index 407d7c95f91..2b7e9e51a07 100644
--- a/libstdc++-v3/testsuite/Makefile.am
+++ b/libstdc++-v3/testsuite/Makefile.am
@@ -121,6 +121,14 @@ libgomp_flags=-B${glibcxx_builddir}/../libgomp \
atomic_flags=$(ATOMIC_FLAGS)
parallel_flags="unix/-D_GLIBCXX_PARALLEL/-fopenmp"
+# Runs the testsuite in profile mode.
+libprofc++_dir = ${glibcxx_builddir}/libprofc++
+libprofc++_flags = -B${glibcxx_builddir}/libprofc++ \
+ -I${glibcxx_builddir}/libprofc++ \
+ -L${glibcxx_builddir}/libprofc++/.libs
+
+profile_flags = "unix/-fprofile-stdlib"
+
check-parallel: site.exp
-@(if test ! -d $${libgomp_dir}; then \
echo "Testing parallel mode failed as libgomp not present."; \
@@ -139,8 +147,21 @@ check-performance-parallel: testsuite_files_performance ${performance_script}
CXXFLAGS="-D_GLIBCXX_PARALLEL -fopenmp $(atomic_flags) $(libgomp_flags)"; export CXXFLAGS; \
${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
+check-profile: site.exp
+ -@(if test ! -d $${libprofc++_dir}; then \
+ echo "Testing profiling mode failed as libprofc++ not present."; \
+ exit 1; \
+ fi; \
+ outputdir=profile; export outputdir; \
+ if test ! -d $${outputdir}; then \
+ mkdir $${outputdir}; \
+ fi; \
+ srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+ EXPECT=$(EXPECT); export EXPECT; \
+ $(MAKE) CXXFLAGS="$(atomic_flags) $(libprofc++_flags)" RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(profile_flags)" check-DEJAGNU; )
+
.PHONY: baseline_symbols new-abi-baseline \
- check-abi check-compile check-performance check-parallel
+ check-abi check-compile check-performance check-parallel check-profile
# By adding these files here, automake will remove them for 'make clean'
CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
@@ -149,4 +170,4 @@ CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
# To remove directories.
clean-local:
- rm -rf parallel
+ rm -rf parallel profile
diff --git a/libstdc++-v3/testsuite/Makefile.in b/libstdc++-v3/testsuite/Makefile.in
index c029ced7612..468700e8f04 100644
--- a/libstdc++-v3/testsuite/Makefile.in
+++ b/libstdc++-v3/testsuite/Makefile.in
@@ -314,6 +314,13 @@ libgomp_flags = -B${glibcxx_builddir}/../libgomp \
atomic_flags = $(ATOMIC_FLAGS)
parallel_flags = "unix/-D_GLIBCXX_PARALLEL/-fopenmp"
+# Runs the testsuite in profile
+libprofc++_dir = ${glibcxx_builddir}/libprofc++
+libprofc++_flags = -B${glibcxx_builddir}/libprofc++ \
+ -I${glibcxx_builddir}/libprofc++ \
+ -L${glibcxx_builddir}/libprofc++/.libs
+profile_flags = "unix/-fprofile-stdlib"
+
# By adding these files here, automake will remove them for 'make clean'
CLEANFILES = *.txt *.tst *.exe core* filebuf_* tmp* ostream_* *.log *.sum \
testsuite_* site.exp abi_check baseline_symbols *TEST* *.dat \
@@ -581,12 +588,25 @@ check-performance-parallel: testsuite_files_performance ${performance_script}
CXXFLAGS="-D_GLIBCXX_PARALLEL -fopenmp $(atomic_flags) $(libgomp_flags)"; export CXXFLAGS; \
${check_performance_script} ${glibcxx_srcdir} ${glibcxx_builddir})
+check-profile: site.exp
+ -@(if test ! -d $${libprofc++_dir}; then \
+ echo "Testing profiling mode failed as libprofc++ not present."; \
+ exit 1; \
+ fi; \
+ outputdir=profile; export outputdir; \
+ if test ! -d $${outputdir}; then \
+ mkdir $${outputdir}; \
+ fi; \
+ srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+ EXPECT=$(EXPECT); export EXPECT; \
+ $(MAKE) CXXFLAGS="$(atomic_flags) $(libprofc++_flags)" RUNTESTFLAGS="$(RUNTESTFLAGS) conformance.exp --outdir $${outputdir} --objdir $${outputdir} --target_board=$(profile_flags)" check-DEJAGNU; )
+
.PHONY: baseline_symbols new-abi-baseline \
- check-abi check-compile check-performance check-parallel
+ check-abi check-compile check-performance check-parallel check-profile
# To remove directories.
clean-local:
- rm -rf parallel
+ rm -rf parallel profile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: