[standalone] Remove tcmalloc.

Removes build complexity around which combinations of compiler/architecture/sysroot/libc support tcmalloc, reduces binary size, and reduces memory usage at the expense of some throughput.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/51111
Bug: https://github.com/dart-lang/sdk/issues/51535
Bug: https://github.com/dart-lang/sdk/issues/51639
Change-Id: Id73d5b87e2b16c1cd1e5228ba0cbf1aa2521c01a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287001
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2023-04-18 20:56:00 +00:00 committed by Commit Queue
parent 7c1e2fee70
commit 7b2cfdbc8c
15 changed files with 5 additions and 846 deletions

5
DEPS
View file

@ -93,7 +93,6 @@ vars = {
"boringssl_rev": "87f316d7748268eb56f2dc147bd593254ae93198",
"browser-compat-data_tag": "ac8cae697014da1ff7124fba33b0b4245cc6cd1b", # v1.0.22
"devtools_rev": "026f0adf03725fbab24d601ac74c811808f258e5",
"gperftools_revision": "bf8b714bf5075d0a6f2f28504b43095e2b1e11c5",
"icu_rev": "81d656878ec611cb0b42d52c82e9dae93920d9ba",
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
"libprotobuf_rev": "24487dd1045c7f3d64a21f38a3f0c06cc4cf2edb",
@ -334,10 +333,6 @@ deps = {
Var('chromium_git') + '/external/github.com/mdn/browser-compat-data' +
"@" + Var("browser-compat-data_tag"),
Var("dart_root") + "/third_party/tcmalloc/gperftools":
Var('chromium_git') + '/external/github.com/gperftools/gperftools.git' +
"@" + Var("gperftools_revision"),
Var("dart_root") + "/third_party/pkg/args":
Var("dart_git") + "args.git" + "@" + Var("args_rev"),
Var("dart_root") + "/third_party/pkg/async":

View file

@ -158,10 +158,6 @@ config("dart_config") {
}
include_dirs = [ "include" ]
if (dart_use_tcmalloc) {
defines += [ "DART_USE_TCMALLOC" ]
include_dirs += [ "../third_party/tcmalloc/gperftools/src" ]
}
if (dart_include_sampling_heap_profiler) {
defines += [ "FORCE_FORCE_INCLUDE_SAMPLING_HEAP_PROFILER" ]

View file

@ -196,10 +196,6 @@ template("build_gen_snapshot") {
"//third_party",
]
if (dart_use_tcmalloc) {
deps += [ "//third_party/tcmalloc" ]
}
if (is_mac) {
frameworks = [
"CoreFoundation.framework",
@ -752,10 +748,6 @@ template("dart_executable") {
defines += [ "EXCLUDE_CFE_AND_KERNEL_PLATFORM" ]
}
if (dart_use_tcmalloc) {
deps += [ "//third_party/tcmalloc" ]
}
include_dirs = [
"..",
"//third_party",
@ -968,11 +960,6 @@ executable("run_vm_tests") {
]
defines = [ "TESTING" ]
if (dart_use_tcmalloc) {
deps += [ "//third_party/tcmalloc" ]
defines += [ "DART_USE_TCMALLOC" ]
}
if (is_fuchsia) {
if (using_fuchsia_gn_sdk) {
include_dirs += [ "$fuchsia_sdk_path/pkg/trace-engine/include" ]

View file

@ -32,28 +32,17 @@ uint8_t* IOBuffer::Allocate(intptr_t size) {
}
uint8_t* IOBuffer::Reallocate(uint8_t* buffer, intptr_t new_size) {
if (new_size == 0) {
// The call to `realloc()` below has a corner case if the new size is 0:
// It can return `nullptr` in that case even though `malloc(0)` would
// return a unique non-`nullptr` value. To avoid returning `nullptr` on
// successful realloc, we handle this case specially.
auto new_buffer = IOBuffer::Allocate(0);
if (new_buffer != nullptr) {
free(buffer);
return new_buffer;
}
return buffer;
}
#if defined(DART_TARGET_OS_WINDOWS)
// It seems windows realloc() doesn't free memory when shrinking, so we'll
// manually allocate a new buffer, copy the data and free the old buffer.
// It seems windows realloc() and glibc relloc() don't free memory when
// shrinking, so we'll manually allocate a new buffer, copy the data and free
// the old buffer. This also avoids a corner case if the new size is 0:
// It can return `nullptr` in that case even though `malloc(0)` would
// return a unique non-`nullptr` value.
auto new_buffer = IOBuffer::Allocate(new_size);
if (new_buffer != nullptr) {
memmove(new_buffer, buffer, new_size);
free(buffer);
return static_cast<uint8_t*>(new_buffer);
}
#endif
return static_cast<uint8_t*>(realloc(buffer, new_size));
}

View file

@ -42,10 +42,6 @@ declare_args() {
# verified at the operating system level.
dart_use_fallback_root_certificates = false
# Whether to link the standalone VM against tcmalloc. The standalone build of
# the VM enables this only for Linux builds.
dart_use_tcmalloc = false
# Whether to link Crashpad library for crash handling. Only supported on
# Windows for now.
dart_use_crashpad = false

View file

@ -1,3 +0,0 @@
*.mk
*.Makefile
/gperftools

View file

@ -1,137 +0,0 @@
# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import("tcmalloc_sources.gni")
config("internal_config") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
cflags = [
"-Wall",
"-Wextra",
"-Wno-format",
"-Wno-missing-field-initializers",
"-Wno-sign-compare",
"-Wno-type-limits",
"-Wno-unused-result",
"-Wno-unused-parameter",
"-Wno-unused-function",
"-Wno-unused-but-set-variable",
"-Wno-vla",
"-g3",
"-ggdb3",
"-fstack-protector",
"-Wa,--noexecstack",
"-fno-omit-frame-pointer",
"-fno-builtin-malloc",
"-fno-builtin-free",
"-fno-builtin-realloc",
"-fno-builtin-calloc",
"-fno-builtin-cfree",
"-fno-builtin-memalign",
"-fno-builtin-posix_memalign",
"-fno-builtin-valloc",
"-fno-builtin-pvalloc",
"-fsized-deallocation",
"-faligned-new",
]
if (is_clang) {
cflags += [
"-Wno-unused-const-variable",
"-Wno-implicit-int-float-conversion",
]
}
if (current_cpu == "arm" && !is_clang) {
cflags += [ "-Wno-psabi" ]
}
}
config("link_config") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
ldflags = [
# Don't let linker rip this symbol out, otherwise the heap&cpu
# profilers will not initialize properly on startup.
"-Wl,-uIsHeapProfilerRunning,-uProfilerStart",
]
}
source_set("dynamic_annotations") {
configs -= [
"//build/config/compiler:chromium_code",
"//build/config/compiler:clang_stackrealign",
]
configs += [ ":internal_config" ]
include_dirs = [
"include",
"gperftools/src/base",
"gperftools/src",
]
sources = [
"gperftools/src/base/dynamic_annotations.c",
"gperftools/src/base/dynamic_annotations.h",
]
}
source_set("tcmalloc") {
configs -= [
"//build/config/compiler:chromium_code",
"//build/config/compiler:clang_stackrealign",
"//build/config/compiler:compiler_arm_thumb",
]
configs += [ ":internal_config" ]
public_configs = [ ":link_config" ]
deps = [ ":dynamic_annotations" ]
include_dirs = [
"include",
"gperftools/src/base",
"gperftools/src",
]
# Disable the heap checker in tcmalloc.
defines = [
"ENABLE_EMERGENCY_MALLOC",
"NO_HEAP_CHECK",
# Disable debug even in a Dart Debug build. It is too slow.
"NDEBUG",
]
if (is_product) {
# Disable stack sampling for heap profiling in Product builds.
defines += [ "NO_TCMALLOC_SAMPLES" ]
# To override the C library functions, we can't hide symbols.
configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
}
cflags = [
"-Wnon-virtual-dtor",
"-Woverloaded-virtual",
"-fno-rtti",
"-fpermissive",
]
if (!is_clang) {
cflags += [ "-Wno-format" ]
}
sources = tcmalloc_sources - [
# No debug allocator.
"gperftools/src/debugallocation.cc",
# Not needed when using emergency malloc.
"gperftools/src/fake_stacktrace_scope.cc",
# Not using the cpuprofiler
"gperftools/src/profile-handler.cc",
"gperftools/src/profile-handler.h",
"gperftools/src/profiledata.cc",
"gperftools/src/profiledata.h",
"gperftools/src/profiler.cc",
]
}

View file

@ -1,28 +0,0 @@
Copyright (c) 2005, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -1 +0,0 @@
file:/tools/OWNERS_VM

View file

@ -1,25 +0,0 @@
Dart uses tcmalloc in the standalone VM on Linux.
To roll tcmalloc forward:
. Clone the gperftools git repo at the revision you want in a directory off
to the side.
. Run a configure command similar to the one in the configure_command file in
this directory. It is up to you to determine if different flags are required
for the newer gperftools.
. From that repo, copy src/config.h and src/gperftools/tcmalloc.h, and any other
generated header files to the include/ directory in this directory.
. Also copy the COPYING file and any other relevant licensing information.
. Make sure that include/config.h defines HAVE_UCONTEXT_H on Linux,
. Update tcmalloc_sources.gypi, and tcmalloc.gyp if necessary. This may require
inspecting gperftools/Makefile.am to see any additional source files and
preprocessor defines (-D flags).
. Update the DEPS file with the new git hash.
. Build and run tests for Debug, Release, and Product builds for ia32, x64,
and arm for Linux and any other OSs that are supported.

View file

@ -1,2 +0,0 @@
./autogen.sh
./configure --enable-emergency-malloc --enable-frame-pointers --disable-cpu-profiler --disable-heap-checker --disable-debugalloc --enable-sized-delete --disable-libunwind

View file

@ -1,282 +0,0 @@
/* src/config.h. Generated from config.h.in by configure. */
/* src/config.h.in. Generated from configure.ac by autoheader. */
#ifndef GPERFTOOLS_CONFIG_H_
#define GPERFTOOLS_CONFIG_H_
/* enable aggressive decommit by default */
/* #undef ENABLE_AGGRESSIVE_DECOMMIT_BY_DEFAULT */
/* Build new/delete operators for overaligned types */
#define ENABLE_ALIGNED_NEW_DELETE 1
/* Build runtime detection for sized delete */
/* #undef ENABLE_DYNAMIC_SIZED_DELETE */
/* report large allocation */
/* #undef ENABLE_LARGE_ALLOC_REPORT */
/* Build sized deletion operators */
#define ENABLE_SIZED_DELETE 1
/* Define to 1 if you have the <asm/ptrace.h> header file. */
/* #undef HAVE_ASM_PTRACE_H */
/* Define to 1 if you have the <conflict-signal.h> header file. */
/* #undef HAVE_CONFLICT_SIGNAL_H */
/* define if the compiler supports basic C++11 syntax */
#define HAVE_CXX11 1
/* 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 `backtrace', and to 0 if you
don't. */
/* #undef HAVE_DECL_BACKTRACE */
/* 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 1
/* Define to 1 if you have the declaration of `nanosleep', and to 0 if you
don't. */
/* #undef HAVE_DECL_NANOSLEEP */
/* Define to 1 if you have the declaration of `posix_memalign', and to 0 if
you don't. */
#define HAVE_DECL_POSIX_MEMALIGN 1
/* Define to 1 if you have the declaration of `pvalloc', and to 0 if you
don't. */
#define HAVE_DECL_PVALLOC 1
/* Define to 1 if you have the declaration of `sleep', and to 0 if you don't.
*/
/* #undef HAVE_DECL_SLEEP */
/* Define to 1 if you have the declaration of `valloc', and to 0 if you don't.
*/
#define HAVE_DECL_VALLOC 1
/* 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'. */
#define HAVE_ELF32_VERSYM 1
/* 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. */
#define HAVE_FEATURES_H 1
/* Define to 1 if you have the `fork' function. */
#define HAVE_FORK 1
/* Define to 1 if you have the `geteuid' function. */
#define HAVE_GETEUID 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. */
/* #undef HAVE_LIBUNWIND_H */
/* Define to 1 if you have the <linux/ptrace.h> header file. */
#define HAVE_LINUX_PTRACE_H 1
/* Define if this is Linux that has SIGEV_THREAD_ID */
#define HAVE_LINUX_SIGEV_THREAD_ID 1
/* Define to 1 if you have the <malloc.h> header file. */
#define HAVE_MALLOC_H 1
/* Define to 1 if you have a working `mmap' system call. */
#define HAVE_MMAP 1
/* Define to 1 if you have the <poll.h> header file. */
#define HAVE_POLL_H 1
/* define if libc has program_invocation_name */
#define HAVE_PROGRAM_INVOCATION_NAME 1
/* Define if you have POSIX threads libraries and header files. */
#define HAVE_PTHREAD 1
/* defined to 1 if pthread symbols are exposed even without include pthread.h
*/
/* #undef HAVE_PTHREAD_DESPITE_ASKING_FOR */
/* 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_SBRK 1
/* Define to 1 if you have the <sched.h> header file. */
#define HAVE_SCHED_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_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'. */
#define HAVE_STRUCT_MALLINFO 1
/* Define to 1 if you have the <sys/cdefs.h> header file. */
#define HAVE_SYS_CDEFS_H 1
/* Define to 1 if you have the <sys/prctl.h> header file. */
#define HAVE_SYS_PRCTL_H 1
/* 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/ucontext.h> header file. */
#define HAVE_SYS_UCONTEXT_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 */
#define HAVE_TLS 1
/* Define to 1 if you have the <ucontext.h> header file. */
#define HAVE_UCONTEXT_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Whether <unwind.h> contains _Unwind_Backtrace */
#define HAVE_UNWIND_BACKTRACE 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 if your compiler supports alignment of functions */
#define HAVE___ATTRIBUTE__ALIGNED_FN 1
/* Define to 1 if compiler supports __environ */
#define HAVE___ENVIRON 1
/* Define to 1 if you have the `__sbrk' function. */
#define HAVE___SBRK 1
/* 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 the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"
/* Name of package */
#define PACKAGE "gperftools"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "gperftools@googlegroups.com"
/* Define to the full name of this package. */
#define PACKAGE_NAME "gperftools"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "gperftools 2.10"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "gperftools"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "2.10"
/* 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
"config.h" before anything else. */
#define PERFTOOLS_DLL_DECL /**/
/* Mark the systems where we know it's bad if pthreads runs too
early before main (before threads are initialized, presumably). */
#ifdef __FreeBSD__
#define PTHREADS_CRASHES_IF_RUN_TOO_EARLY 1
#endif
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
/* #undef PTHREAD_CREATE_JOINABLE */
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#define STDC_HEADERS 1
/* Define 8 bytes of allocation alignment for tcmalloc */
/* #undef TCMALLOC_ALIGN_8BYTES */
/* Define internal page size for tcmalloc as number of left bitshift */
/* #undef TCMALLOC_PAGE_SIZE_SHIFT */
/* Version number of package */
#define VERSION "2.10"
/* C99 says: define this to get the PRI... macros from stdint.h */
#ifndef __STDC_FORMAT_MACROS
# define __STDC_FORMAT_MACROS 1
#endif
#ifdef __MINGW32__
#include "windows/mingw.h"
#endif
#endif /* #ifndef GPERFTOOLS_CONFIG_H_ */

View file

@ -1,163 +0,0 @@
// -*- Mode: C; c-basic-offset: 2; indent-tabs-mode: nil -*-
/* Copyright (c) 2003, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ---
* Author: Sanjay Ghemawat <opensource@google.com>
* .h file by Craig Silverstein <opensource@google.com>
*/
#ifndef TCMALLOC_TCMALLOC_H_
#define TCMALLOC_TCMALLOC_H_
#include <stddef.h> /* for size_t */
#ifdef __cplusplus
#include <new> /* for std::nothrow_t, std::align_val_t */
#endif
/* Define the version number so folks can check against it */
#define TC_VERSION_MAJOR 2
#define TC_VERSION_MINOR 8
#define TC_VERSION_PATCH ""
#define TC_VERSION_STRING "gperftools 2.8"
/* For struct mallinfo, if it's defined. */
#if 1
# include <malloc.h>
#endif
#ifndef PERFTOOLS_NOTHROW
#if __cplusplus >= 201103L
#define PERFTOOLS_NOTHROW noexcept
#elif defined(__cplusplus)
#define PERFTOOLS_NOTHROW throw()
#else
# ifdef __GNUC__
# define PERFTOOLS_NOTHROW __attribute__((__nothrow__))
# else
# define PERFTOOLS_NOTHROW
# endif
#endif
#endif
#ifndef PERFTOOLS_DLL_DECL
# ifdef _WIN32
# define PERFTOOLS_DLL_DECL __declspec(dllimport)
# else
# define PERFTOOLS_DLL_DECL
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Returns a human-readable version string. If major, minor,
* and/or patch are not NULL, they are set to the major version,
* minor version, and patch-code (a string, usually "").
*/
PERFTOOLS_DLL_DECL const char* tc_version(int* major, int* minor,
const char** patch) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void* tc_malloc(size_t size) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void* tc_malloc_skip_new_handler(size_t size) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_free(void* ptr) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_free_sized(void *ptr, size_t size) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void* tc_realloc(void* ptr, size_t size) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void* tc_calloc(size_t nmemb, size_t size) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_cfree(void* ptr) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void* tc_memalign(size_t __alignment,
size_t __size) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL int tc_posix_memalign(void** ptr,
size_t align, size_t size) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void* tc_valloc(size_t __size) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void* tc_pvalloc(size_t __size) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_malloc_stats(void) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL int tc_mallopt(int cmd, int value) PERFTOOLS_NOTHROW;
#if 1
PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) PERFTOOLS_NOTHROW;
#endif
/*
* This is an alias for MallocExtension::instance()->GetAllocatedSize().
* It is equivalent to
* OS X: malloc_size()
* glibc: malloc_usable_size()
* Windows: _msize()
*/
PERFTOOLS_DLL_DECL size_t tc_malloc_size(void* ptr) PERFTOOLS_NOTHROW;
#ifdef __cplusplus
PERFTOOLS_DLL_DECL int tc_set_new_mode(int flag) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void* tc_new(size_t size);
PERFTOOLS_DLL_DECL void* tc_new_nothrow(size_t size,
const std::nothrow_t&) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_delete(void* p) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_delete_sized(void* p, size_t size) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_delete_nothrow(void* p,
const std::nothrow_t&) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void* tc_newarray(size_t size);
PERFTOOLS_DLL_DECL void* tc_newarray_nothrow(size_t size,
const std::nothrow_t&) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_deletearray(void* p) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_deletearray_sized(void* p, size_t size) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_deletearray_nothrow(void* p,
const std::nothrow_t&) PERFTOOLS_NOTHROW;
#if 1 && __cplusplus >= 201703L
PERFTOOLS_DLL_DECL void* tc_new_aligned(size_t size, std::align_val_t al);
PERFTOOLS_DLL_DECL void* tc_new_aligned_nothrow(size_t size, std::align_val_t al,
const std::nothrow_t&) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_delete_aligned(void* p, std::align_val_t al) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_delete_sized_aligned(void* p, size_t size, std::align_val_t al) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_delete_aligned_nothrow(void* p, std::align_val_t al,
const std::nothrow_t&) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void* tc_newarray_aligned(size_t size, std::align_val_t al);
PERFTOOLS_DLL_DECL void* tc_newarray_aligned_nothrow(size_t size, std::align_val_t al,
const std::nothrow_t&) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_deletearray_aligned(void* p, std::align_val_t al) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_deletearray_sized_aligned(void* p, size_t size, std::align_val_t al) PERFTOOLS_NOTHROW;
PERFTOOLS_DLL_DECL void tc_deletearray_aligned_nothrow(void* p, std::align_val_t al,
const std::nothrow_t&) PERFTOOLS_NOTHROW;
#endif
}
#endif
/* We're only un-defining for public */
#if !defined(GPERFTOOLS_CONFIG_H_)
#undef PERFTOOLS_NOTHROW
#endif /* GPERFTOOLS_CONFIG_H_ */
#endif /* #ifndef TCMALLOC_TCMALLOC_H_ */

View file

@ -1,155 +0,0 @@
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
tcmalloc_sources = [
# gperftools/src/
"gperftools/src/addressmap-inl.h",
"gperftools/src/central_freelist.cc",
"gperftools/src/central_freelist.h",
"gperftools/src/common.cc",
"gperftools/src/common.h",
"gperftools/src/config_for_unittests.h",
"gperftools/src/debugallocation.cc",
"gperftools/src/emergency_malloc.cc",
"gperftools/src/emergency_malloc_for_stacktrace.cc",
"gperftools/src/emergency_malloc.h",
"gperftools/src/fake_stacktrace_scope.cc",
"gperftools/src/getenv_safe.h",
"gperftools/src/getpc.h",
"gperftools/src/heap-checker-bcad.cc",
"gperftools/src/heap-checker.cc",
"gperftools/src/heap-profiler.cc",
"gperftools/src/heap-profile-stats.h",
"gperftools/src/heap-profile-table.cc",
"gperftools/src/heap-profile-table.h",
"gperftools/src/internal_logging.cc",
"gperftools/src/internal_logging.h",
"gperftools/src/libc_override_gcc_and_weak.h",
"gperftools/src/libc_override_glibc.h",
"gperftools/src/libc_override.h",
"gperftools/src/libc_override_osx.h",
"gperftools/src/libc_override_redefine.h",
"gperftools/src/linked_list.h",
"gperftools/src/malloc_extension.cc",
"gperftools/src/malloc_hook.cc",
"gperftools/src/malloc_hook-inl.h",
"gperftools/src/malloc_hook_mmap_freebsd.h",
"gperftools/src/malloc_hook_mmap_linux.h",
"gperftools/src/maybe_emergency_malloc.h",
"gperftools/src/maybe_threads.cc",
"gperftools/src/maybe_threads.h",
"gperftools/src/memfs_malloc.cc",
"gperftools/src/memory_region_map.cc",
"gperftools/src/memory_region_map.h",
"gperftools/src/packed-cache-inl.h",
"gperftools/src/page_heap_allocator.h",
"gperftools/src/page_heap.cc",
"gperftools/src/page_heap.h",
"gperftools/src/pagemap.h",
"gperftools/src/profiledata.cc",
"gperftools/src/profiledata.h",
"gperftools/src/profile-handler.cc",
"gperftools/src/profile-handler.h",
"gperftools/src/profiler.cc",
"gperftools/src/raw_printer.cc",
"gperftools/src/raw_printer.h",
"gperftools/src/sampler.cc",
"gperftools/src/sampler.h",
"gperftools/src/span.cc",
"gperftools/src/span.h",
"gperftools/src/stacktrace_arm-inl.h",
"gperftools/src/stacktrace.cc",
"gperftools/src/stacktrace_generic-inl.h",
"gperftools/src/stacktrace_impl_setup-inl.h",
"gperftools/src/stacktrace_instrument-inl.h",
"gperftools/src/stacktrace_libgcc-inl.h",
"gperftools/src/stacktrace_libunwind-inl.h",
"gperftools/src/stacktrace_powerpc-darwin-inl.h",
"gperftools/src/stacktrace_powerpc-inl.h",
"gperftools/src/stacktrace_powerpc-linux-inl.h",
"gperftools/src/stack_trace_table.cc",
"gperftools/src/stack_trace_table.h",
"gperftools/src/stacktrace_win32-inl.h",
"gperftools/src/stacktrace_x86-inl.h",
"gperftools/src/static_vars.cc",
"gperftools/src/static_vars.h",
"gperftools/src/symbolize.cc",
"gperftools/src/symbolize.h",
"gperftools/src/system-alloc.cc",
"gperftools/src/system-alloc.h",
"gperftools/src/tcmalloc.cc",
"gperftools/src/tcmalloc_guard.h",
"gperftools/src/tcmalloc.h",
"gperftools/src/thread_cache.cc",
"gperftools/src/thread_cache.h",
# gperftools/src/base/
"gperftools/src/base/arm_instruction_set_select.h",
"gperftools/src/base/atomicops.h",
"gperftools/src/base/atomicops-internals-arm-generic.h",
"gperftools/src/base/atomicops-internals-arm-v6plus.h",
"gperftools/src/base/atomicops-internals-gcc.h",
"gperftools/src/base/atomicops-internals-linuxppc.h",
"gperftools/src/base/atomicops-internals-macosx.h",
"gperftools/src/base/atomicops-internals-mips.h",
"gperftools/src/base/atomicops-internals-windows.h",
"gperftools/src/base/atomicops-internals-x86.cc",
"gperftools/src/base/atomicops-internals-x86.h",
"gperftools/src/base/basictypes.h",
"gperftools/src/base/commandlineflags.h",
# This C files is compiled into a separate target.
# "gperftools/src/base/dynamic_annotations.c",
# "gperftools/src/base/dynamic_annotations.h",
"gperftools/src/base/elfcore.h",
"gperftools/src/base/elf_mem_image.cc",
"gperftools/src/base/elf_mem_image.h",
"gperftools/src/base/googleinit.h",
"gperftools/src/base/linux_syscall_support.h",
"gperftools/src/base/linuxthreads.cc",
"gperftools/src/base/linuxthreads.h",
"gperftools/src/base/logging.cc",
"gperftools/src/base/logging.h",
"gperftools/src/base/low_level_alloc.cc",
"gperftools/src/base/low_level_alloc.h",
"gperftools/src/base/simple_mutex.h",
"gperftools/src/base/spinlock.cc",
"gperftools/src/base/spinlock.h",
"gperftools/src/base/spinlock_internal.cc",
"gperftools/src/base/spinlock_internal.h",
"gperftools/src/base/spinlock_linux-inl.h",
"gperftools/src/base/spinlock_posix-inl.h",
"gperftools/src/base/spinlock_win32-inl.h",
"gperftools/src/base/stl_allocator.h",
"gperftools/src/base/sysinfo.cc",
"gperftools/src/base/sysinfo.h",
"gperftools/src/base/thread_annotations.h",
"gperftools/src/base/thread_lister.c",
"gperftools/src/base/thread_lister.h",
"gperftools/src/base/vdso_support.cc",
"gperftools/src/base/vdso_support.h",
# gperftools/src/google/
"gperftools/src/google/heap-checker.h",
"gperftools/src/google/heap-profiler.h",
"gperftools/src/google/malloc_extension_c.h",
"gperftools/src/google/malloc_extension.h",
"gperftools/src/google/malloc_hook_c.h",
"gperftools/src/google/malloc_hook.h",
"gperftools/src/google/profiler.h",
"gperftools/src/google/stacktrace.h",
"gperftools/src/google/tcmalloc.h",
# gperftools/src/gperftools/
"gperftools/src/gperftools/heap-checker.h",
"gperftools/src/gperftools/heap-profiler.h",
"gperftools/src/gperftools/malloc_extension_c.h",
"gperftools/src/gperftools/malloc_extension.h",
"gperftools/src/gperftools/malloc_hook_c.h",
"gperftools/src/gperftools/malloc_hook.h",
"gperftools/src/gperftools/profiler.h",
"gperftools/src/gperftools/stacktrace.h",
# gperftools/src/third_party/
"gperftools/src/third_party/valgrind.h",
]

View file

@ -228,14 +228,6 @@ def ToGnArgs(args, mode, arch, target_os, sanitizer, verify_sdk_hash):
gn_args['bssl_use_clang_integrated_as'] = True
# Use tcmalloc only when targeting Linux and when not using ASAN.
# TODO(51111): Re-enable for riscv64.
gn_args['dart_use_tcmalloc'] = ((gn_args['target_os'] == 'linux') and
(gn_args['target_cpu'] != 'arm') and
(gn_args['target_cpu'] != 'riscv32') and
(gn_args['target_cpu'] != 'riscv64') and
sanitizer == 'none')
if gn_args['target_os'] == 'linux':
if gn_args['target_cpu'] == 'arm':
# Default to -mfloat-abi=hard and -mfpu=neon for arm on Linux as we're