[Avida-SVN] r3478 - in branches/tcmalloc-1.4/source/platform: tcmalloc tcmalloc-1.4

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Wed Oct 14 13:08:25 PDT 2009


Author: brysonda
Date: 2009-10-14 16:08:25 -0400 (Wed, 14 Oct 2009)
New Revision: 3478

Modified:
   branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/malloc_extension.cc
   branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/tcmalloc-platform.h
   branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/tcmalloc.cc
   branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/tcmalloc.h
   branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/thread_cache.cc
   branches/tcmalloc-1.4/source/platform/tcmalloc/tcmalloc-platform.h
Log:
Cleanup tcmalloc-platform.h

Modified: branches/tcmalloc-1.4/source/platform/tcmalloc/tcmalloc-platform.h
===================================================================
--- branches/tcmalloc-1.4/source/platform/tcmalloc/tcmalloc-platform.h	2009-10-14 19:12:12 UTC (rev 3477)
+++ branches/tcmalloc-1.4/source/platform/tcmalloc/tcmalloc-platform.h	2009-10-14 20:08:25 UTC (rev 3478)
@@ -54,7 +54,6 @@
 #define PLATFORM(KX_FEATURE) (defined( KXMLCORE_PLATFORM_##KX_FEATURE ) && KXMLCORE_PLATFORM_##KX_FEATURE)
 #define COMPILER(KX_FEATURE) (defined( KXMLCORE_COMPILER_##KX_FEATURE ) && KXMLCORE_COMPILER_##KX_FEATURE)
 #define HAVE(KX_FEATURE) (defined( HAVE_##KX_FEATURE ) && HAVE_##KX_FEATURE)
-#define USE(KX_FEATURE) (defined( KXMLCORE_USE_##KX_FEATURE ) && KXMLCORE_USE_##KX_FEATURE)
 
 // Operating systems - low-level dependencies
 

Modified: branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/malloc_extension.cc
===================================================================
--- branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/malloc_extension.cc	2009-10-14 19:12:12 UTC (rev 3477)
+++ branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/malloc_extension.cc	2009-10-14 20:08:25 UTC (rev 3478)
@@ -68,12 +68,9 @@
 #endif
 #include <string>
 #include "sysinfo.h"    // for FillProcSelfMaps
-#ifndef NO_HEAP_CHECK
-#include "heap-checker.h"
-#endif
 #include "malloc_extension.h"
 
-using STL_NAMESPACE::string;
+using std::string;
 
 static void DumpAddressMap(string* result) {
   *result += "\nMAPPED_LIBRARIES:\n";
@@ -184,9 +181,6 @@
 
 static void InitModule() {
   current_instance = new MallocExtension;
-#ifndef NO_HEAP_CHECK
-  HeapLeakChecker::IgnoreObject(current_instance);
-#endif
 }
 
 MallocExtension* MallocExtension::instance() {

Modified: branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/tcmalloc-platform.h
===================================================================
--- branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/tcmalloc-platform.h	2009-10-14 19:12:12 UTC (rev 3477)
+++ branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/tcmalloc-platform.h	2009-10-14 20:08:25 UTC (rev 3478)
@@ -21,238 +21,59 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  */
+#ifndef TCMALLOC_PLATFORM_H
+#define TCMALLOC_PLATFORM_H
 
-/* src/config.h.  Generated from config.h.in by configure.  */
-/* src/config.h.in.  Generated from configure.ac by autoheader.  */
-
-/* Define to 1 if compiler supports __builtin_stack_pointer */
-/* #undef HAVE_BUILTIN_STACK_POINTER */
-
-/* Define to 1 if you have the <conflict-signal.h> header file. */
-/* #undef HAVE_CONFLICT_SIGNAL_H */
-
-/* Define to 1 if you have the <cygwin/signal.h> header file. */
-/* #undef HAVE_CYGWIN_SIGNAL_H */
-
-/* Define to 1 if you have the declaration of `cfree', and to 0 if you don't.
- */
-#define HAVE_DECL_CFREE 0
-
-/* Define to 1 if you have the declaration of `memalign', and to 0 if you
- don't. */
-#define HAVE_DECL_MEMALIGN 0
-
-/* Define to 1 if you have the declaration of `posix_memalign', and to 0 if
- you don't. */
-#define HAVE_DECL_POSIX_MEMALIGN 0
-
-/* Define to 1 if you have the declaration of `pvalloc', and to 0 if you
- don't. */
-#define HAVE_DECL_PVALLOC 0
-
-/* Define to 1 if you have the declaration of `uname', and to 0 if you don't.
- */
-#define HAVE_DECL_UNAME 1
-
-/* Define to 1 if you have the declaration of `valloc', and to 0 if you don't.
- */
-#define HAVE_DECL_VALLOC 0
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#define HAVE_DLFCN_H 1
-
-/* Define to 1 if the system has the type `Elf32_Versym'. */
-/* #undef HAVE_ELF32_VERSYM */
-
-/* Define to 1 if you have the <execinfo.h> header file. */
-#define HAVE_EXECINFO_H 1
-
-/* Define to 1 if you have the <fcntl.h> header file. */
-#define HAVE_FCNTL_H 1
-
-/* Define to 1 if you have the <features.h> header file. */
-/* #undef HAVE_FEATURES_H */
-
-/* Define to 1 if you have the `geteuid' function. */
-#define HAVE_GETEUID 1
-
-/* Define to 1 if you have the `getpagesize' function. */
-#define HAVE_GETPAGESIZE 1
-
-/* Define to 1 if you have the <glob.h> header file. */
-#define HAVE_GLOB_H 1
-
-/* Define to 1 if you have the <grp.h> header file. */
-#define HAVE_GRP_H 1
-
 /* Define to 1 if you have the <inttypes.h> header file. */
 #define HAVE_INTTYPES_H 1
 
-/* Define to 1 if you have the <libunwind.h> header file. */
-#define HAVE_LIBUNWIND_H 1
+/* Always the empty-string on non-windows systems. On windows, should be
+ "__declspec(dllexport)". This way, when we compile the dll, we export our
+ functions/classes. It's safe to define this here because config.h is only
+ used internally, to compile the DLL, and every DLL source file #includes
+ "tcmalloc-platform.h" before anything else. */
+#if defined(WIN32) || defined(_WIN32)
+# define __declspec(dllimport)
+#else
+# define PERFTOOLS_DLL_DECL 
+#endif
 
-/* Define to 1 if you have the <linux/ptrace.h> header file. */
-/* #undef HAVE_LINUX_PTRACE_H */
-
-/* Define to 1 if you have the <malloc.h> header file. */
-/* #undef HAVE_MALLOC_H */
-
-/* Define to 1 if you have the <memory.h> header file. */
-#define HAVE_MEMORY_H 1
-
-/* Define to 1 if you have a working `mmap' system call. */
-#define HAVE_MMAP 1
-
-/* define if the compiler implements namespaces */
-#define HAVE_NAMESPACES 1
-
-/* Define to 1 if you have the <poll.h> header file. */
-#define HAVE_POLL_H 1
-
-/* define if libc has program_invocation_name */
-/* #undef HAVE_PROGRAM_INVOCATION_NAME */
-
 /* Define if you have POSIX threads libraries and header files. */
 #define HAVE_PTHREAD 1
 
-/* Define to 1 if you have the <pwd.h> header file. */
-#define HAVE_PWD_H 1
 
-/* Define to 1 if you have the `sbrk' function. */
+#define HAVE_MMAP 1
 #define HAVE_SBRK 1
 
-/* Define to 1 if you have the <sched.h> header file. */
-#define HAVE_SCHED_H 1
+/* printf format code for printing a size_t and ssize_t */
+#define PRIuS "zu"
 
-/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_SCHED_H 1
 #define HAVE_STDINT_H 1
+#define HAVE_UNISTD_H 1
+#define HAVE_SYS_SYSCALL_H 1
 
-/* Define to 1 if you have the <stdlib.h> header file. */
-#define HAVE_STDLIB_H 1
 
-/* Define to 1 if you have the <strings.h> header file. */
-#define HAVE_STRINGS_H 1
-
-/* Define to 1 if you have the <string.h> header file. */
-#define HAVE_STRING_H 1
-
 /* Define to 1 if the system has the type `struct mallinfo'. */
 /* #undef HAVE_STRUCT_MALLINFO */
 
-/* Define to 1 if you have the <sys/prctl.h> header file. */
-/* #undef HAVE_SYS_PRCTL_H */
-
-/* Define to 1 if you have the <sys/resource.h> header file. */
-#define HAVE_SYS_RESOURCE_H 1
-
-/* Define to 1 if you have the <sys/socket.h> header file. */
-#define HAVE_SYS_SOCKET_H 1
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#define HAVE_SYS_STAT_H 1
-
-/* Define to 1 if you have the <sys/syscall.h> header file. */
-#define HAVE_SYS_SYSCALL_H 1
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 1
-
-/* Define to 1 if you have the <sys/wait.h> header file. */
-#define HAVE_SYS_WAIT_H 1
-
 /* Define to 1 if compiler supports __thread */
 /* #undef HAVE_TLS */
 
-/* Define to 1 if you have the <ucontext.h> header file. */
-/* #undef HAVE_UCONTEXT_H */
 
-/* Define to 1 if you have the <unistd.h> header file. */
-#define HAVE_UNISTD_H 1
-
-/* Define to 1 if you have the <unwind.h> header file. */
-#define HAVE_UNWIND_H 1
-
 /* define if your compiler has __attribute__ */
 #define HAVE___ATTRIBUTE__ 1
 
-/* Define to 1 if the system has the type `__int64'. */
-/* #undef HAVE___INT64 */
 
-/* prefix where we look for installed files */
-#define INSTALL_PREFIX "/usr/local"
-
-/* Define to 1 if int32_t is equivalent to intptr_t */
-/* #undef INT32_EQUALS_INTPTR */
-
-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
-/* #undef NO_MINUS_C_MINUS_O */
-
-/* Name of package */
-#define PACKAGE "google-perftools"
-
-/* Define to the address where bug reports for this package should be sent. */
-#define PACKAGE_BUGREPORT "opensource at google.com"
-
-/* Define to the full name of this package. */
-#define PACKAGE_NAME "google-perftools"
-
-/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "google-perftools 1.4"
-
-/* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME "google-perftools"
-
-/* Define to the version of this package. */
-#define PACKAGE_VERSION "1.4"
-
-/* How to access the PC from a struct ucontext */
-/* #undef PC_FROM_UCONTEXT */
-
-/* Always the empty-string on non-windows systems. On windows, should be
- "__declspec(dllexport)". This way, when we compile the dll, we export our
- functions/classes. It's safe to define this here because config.h is only
- used internally, to compile the DLL, and every DLL source file #includes
- "tcmalloc-platform.h" before anything else. */
-#define PERFTOOLS_DLL_DECL 
-
-/* printf format code for printing a size_t and ssize_t */
-#define PRIdS "zd"
-
-/* printf format code for printing a size_t and ssize_t */
-#define PRIuS "zu"
-
-/* printf format code for printing a size_t and ssize_t */
-#define PRIxS "zx"
-
-/* Define to necessary symbol if this constant uses a non-standard name on
- your system. */
-/* #undef PTHREAD_CREATE_JOINABLE */
-
-/* Define to 1 if you have the ANSI C header files. */
-#define STDC_HEADERS 1
-
-/* the namespace where STL code like vector<> is defined */
-#define STL_NAMESPACE std
-
-/* Version number of package */
-#define VERSION "1.4"
-
 /* C99 says: define this to get the PRI... macros from stdint.h */
 #ifndef __STDC_FORMAT_MACROS
 # define __STDC_FORMAT_MACROS 1
 #endif
 
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name.  */
-#ifndef __cplusplus
-/* #undef inline */
-#endif
 
-
 #ifdef __MINGW32__
 #include "windows/mingw.h"
 #endif
 
-#define NO_HEAP_CHECK
 
-
+#endif

Modified: branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/tcmalloc.cc
===================================================================
--- branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/tcmalloc.cc	2009-10-14 19:12:12 UTC (rev 3477)
+++ branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/tcmalloc.cc	2009-10-14 20:08:25 UTC (rev 3478)
@@ -121,9 +121,6 @@
 #else
 #include <sys/types.h>
 #endif
-#if defined(HAVE_MALLOC_H) && defined(HAVE_STRUCT_MALLINFO)
-#include <malloc.h>                        // for struct mallinfo
-#endif
 #include <string.h>
 #ifdef HAVE_PTHREAD
 #include <pthread.h>

Modified: branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/tcmalloc.h
===================================================================
--- branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/tcmalloc.h	2009-10-14 19:12:12 UTC (rev 3477)
+++ branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/tcmalloc.h	2009-10-14 20:08:25 UTC (rev 3478)
@@ -70,7 +70,7 @@
 #define TC_VERSION_MAJOR  1
 #define TC_VERSION_MINOR  4
 #define TC_VERSION_PATCH  ""
-#define TC_VERSION_STRING "google-perftools 1.4"
+#define TC_VERSION_STRING "tcmalloc-avida 1.4 (from google-perftools 1.4)"
 
 #include <stdlib.h>   // for struct mallinfo, if it's defined
 

Modified: branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/thread_cache.cc
===================================================================
--- branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/thread_cache.cc	2009-10-14 19:12:12 UTC (rev 3477)
+++ branches/tcmalloc-1.4/source/platform/tcmalloc-1.4/thread_cache.cc	2009-10-14 20:08:25 UTC (rev 3478)
@@ -93,33 +93,27 @@
 
 #if defined(HAVE_TLS)
 bool kernel_supports_tls = false;      // be conservative
-# if !HAVE_DECL_UNAME   // if too old for uname, probably too old for TLS
-    void CheckIfKernelSupportsTLS() {
+# include <sys/utsname.h>    // DECL_UNAME checked for <sys/utsname.h> too
+  void CheckIfKernelSupportsTLS() {
+    struct utsname buf;
+    if (uname(&buf) != 0) {   // should be impossible
+      MESSAGE("uname failed assuming no TLS support (errno=%d)\n", errno);
       kernel_supports_tls = false;
-    }
-# else
-#   include <sys/utsname.h>    // DECL_UNAME checked for <sys/utsname.h> too
-    void CheckIfKernelSupportsTLS() {
-      struct utsname buf;
-      if (uname(&buf) != 0) {   // should be impossible
-        MESSAGE("uname failed assuming no TLS support (errno=%d)\n", errno);
+    } else if (strcasecmp(buf.sysname, "linux") == 0) {
+      // The linux case: the first kernel to support TLS was 2.6.0
+      if (buf.release[0] < '2' && buf.release[1] == '.')    // 0.x or 1.x
         kernel_supports_tls = false;
-      } else if (strcasecmp(buf.sysname, "linux") == 0) {
-        // The linux case: the first kernel to support TLS was 2.6.0
-        if (buf.release[0] < '2' && buf.release[1] == '.')    // 0.x or 1.x
-          kernel_supports_tls = false;
-        else if (buf.release[0] == '2' && buf.release[1] == '.' &&
-                 buf.release[2] >= '0' && buf.release[2] < '6' &&
-                 buf.release[3] == '.')                       // 2.0 - 2.5
-          kernel_supports_tls = false;
-        else
-          kernel_supports_tls = true;
-      } else {        // some other kernel, we'll be optimisitic
+      else if (buf.release[0] == '2' && buf.release[1] == '.' &&
+               buf.release[2] >= '0' && buf.release[2] < '6' &&
+               buf.release[3] == '.')                       // 2.0 - 2.5
+        kernel_supports_tls = false;
+      else
         kernel_supports_tls = true;
-      }
-      // TODO(csilvers): VLOG(1) the tls status once we support RAW_VLOG
+    } else {        // some other kernel, we'll be optimisitic
+      kernel_supports_tls = true;
     }
-#  endif  // HAVE_DECL_UNAME
+    // TODO(csilvers): VLOG(1) the tls status once we support RAW_VLOG
+  }
 #endif    // HAVE_TLS
 
 void ThreadCache::Init(pthread_t tid) {




More information about the Avida-cvs mailing list