Commit 0ea5e72a authored by Wang Qing's avatar Wang Qing Committed by Commit Bot

[MIPS64] Add support for using tcmalloc on loongson platform.

Currently, tcmalloc is not supported on loongson, and the build
failed with use tcmalloc. This CL adds support for tcmalloc on
loongson, and resolves many compiler errors, bugs when test
base_unittests on loongosn.

Bug: 799810

R= wfh@chromium.org, thakis@chromium.org

Change-Id: I68bea09334cb9af02d083a24a94654aaf6c884c8
Reviewed-on: https://chromium-review.googlesource.com/853695Reviewed-by: default avatarWill Harris <wfh@chromium.org>
Commit-Queue: 汪 清 <wangqing-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#533192}
parent 122462a5
...@@ -175,6 +175,14 @@ if (use_allocator == "tcmalloc") { ...@@ -175,6 +175,14 @@ if (use_allocator == "tcmalloc") {
#"win_allocator.cc", #"win_allocator.cc",
] ]
# Not included on mips64el.
if (current_cpu == "mips64el") {
sources -= [
"$tcmalloc_dir/src/base/linuxthreads.cc",
"$tcmalloc_dir/src/base/linuxthreads.h",
]
}
# Disable the heap checker in tcmalloc. # Disable the heap checker in tcmalloc.
defines = [ "NO_HEAP_CHECK" ] defines = [ "NO_HEAP_CHECK" ]
......
...@@ -111,3 +111,4 @@ Modifications: ...@@ -111,3 +111,4 @@ Modifications:
- Fix potential missing nul character in symbol names produced by addr2line-pdb. - Fix potential missing nul character in symbol names produced by addr2line-pdb.
- Remove superfluous size_t value >= 0 check. - Remove superfluous size_t value >= 0 check.
- Make kFooType in tcmalloc.cc truly const. - Make kFooType in tcmalloc.cc truly const.
- Added support for mips64el.
...@@ -101,6 +101,8 @@ ...@@ -101,6 +101,8 @@
#include "base/atomicops-internals-x86.h" #include "base/atomicops-internals-x86.h"
#elif defined(__linux__) && defined(__PPC__) #elif defined(__linux__) && defined(__PPC__)
#include "base/atomicops-internals-linuxppc.h" #include "base/atomicops-internals-linuxppc.h"
#elif defined(__GNUC__) && defined(__mips__)
#include "base/atomicops-internals-mips.h"
#else #else
// Assume x86 for now. If you need to support a new architecture and // Assume x86 for now. If you need to support a new architecture and
// don't know how to implement atomic ops, you can probably get away // don't know how to implement atomic ops, you can probably get away
......
...@@ -81,9 +81,14 @@ static const size_t kNumClasses = 78 - kSkippedClasses; ...@@ -81,9 +81,14 @@ static const size_t kNumClasses = 78 - kSkippedClasses;
#else #else
// Original TCMalloc code used kPageShift == 13. In Chromium, we changed // Original TCMalloc code used kPageShift == 13. In Chromium, we changed
// this to 12 (as was done in prior versions of TCMalloc). // this to 12 (as was done in prior versions of TCMalloc).
#if defined(_MIPS_ARCH_LOONGSON)
static const size_t kPageShift = 14;
static const size_t kNumClasses = 70 - kSkippedClasses;
#else
static const size_t kPageShift = 12; static const size_t kPageShift = 12;
static const size_t kNumClasses = 54 - kSkippedClasses; static const size_t kNumClasses = 54 - kSkippedClasses;
#endif #endif
#endif
static const size_t kMaxThreadCacheSize = 4 << 20; static const size_t kMaxThreadCacheSize = 4 << 20;
static const size_t kPageSize = 1 << kPageShift; static const size_t kPageSize = 1 << kPageShift;
......
...@@ -80,6 +80,14 @@ ...@@ -80,6 +80,14 @@
# error stacktrace without frame pointer is not supported on ARM # error stacktrace without frame pointer is not supported on ARM
# endif # endif
// The Mips case
#elif defined(__GNUC__) && defined(__mips__)
# if !defined(NO_FRAME_POINTER)
# define STACKTRACE_INL_HEADER "stacktrace_mips-inl.h"
# else
# define STACKTRACE_INL_HEADER "stacktrace_generic-inl.h"
# endif
// The Windows case -- probably cygwin and mingw will use one of the // The Windows case -- probably cygwin and mingw will use one of the
// x86-includes above, but if not, we can fall back to windows intrinsics. // x86-includes above, but if not, we can fall back to windows intrinsics.
#elif defined(_WIN32) || defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(__MINGW32__) #elif defined(_WIN32) || defined(__CYGWIN__) || defined(__CYGWIN32__) || defined(__MINGW32__)
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment