diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-04-01 22:37:45 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-04-01 22:37:45 +0000 |
commit | 252f848f68356551980701126481e0685bbded08 (patch) | |
tree | 2aeec7b68eff57bb84218d70aa47ba936cf43171 | |
parent | b3d7eed9f760fa22e3a8e87ec2c8ff3fe50a1f50 (diff) | |
parent | da44d773dedf8aae6153e3423012f236cba3bfcd (diff) | |
download | art-252f848f68356551980701126481e0685bbded08.zip art-252f848f68356551980701126481e0685bbded08.tar.gz art-252f848f68356551980701126481e0685bbded08.tar.bz2 |
Merge "Fix running with DlMalloc instead of RosAlloc."
-rw-r--r-- | runtime/gc/heap.cc | 3 | ||||
-rw-r--r-- | runtime/gc/space/dlmalloc_space.cc | 2 | ||||
-rw-r--r-- | runtime/gc/space/large_object_space.cc | 2 | ||||
-rw-r--r-- | runtime/runtime.cc | 2 | ||||
-rw-r--r-- | runtime/runtime.h | 6 |
5 files changed, 11 insertions, 4 deletions
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc index bc50668..915e54f 100644 --- a/runtime/gc/heap.cc +++ b/runtime/gc/heap.cc @@ -21,7 +21,6 @@ #include <limits> #include <vector> -#include <valgrind.h> #include "base/histogram-inl.h" #include "base/stl_util.h" @@ -150,7 +149,7 @@ Heap::Heap(size_t initial_size, size_t growth_limit, size_t min_free, size_t max total_allocation_time_(0), verify_object_mode_(kVerifyObjectModeDisabled), disable_moving_gc_count_(0), - running_on_valgrind_(RUNNING_ON_VALGRIND > 0), + running_on_valgrind_(Runtime::Current()->RunningOnValgrind()), use_tlab_(use_tlab) { if (VLOG_IS_ON(heap) || VLOG_IS_ON(startup)) { LOG(INFO) << "Heap() entering"; diff --git a/runtime/gc/space/dlmalloc_space.cc b/runtime/gc/space/dlmalloc_space.cc index 30c2edb..60f566c 100644 --- a/runtime/gc/space/dlmalloc_space.cc +++ b/runtime/gc/space/dlmalloc_space.cc @@ -60,7 +60,7 @@ DlMallocSpace* DlMallocSpace::CreateFromMemMap(MemMap* mem_map, const std::strin // Everything is set so record in immutable structure and leave byte* begin = mem_map->Begin(); - if (Runtime::Current()->GetHeap()->RunningOnValgrind()) { + if (Runtime::Current()->RunningOnValgrind()) { return new ValgrindMallocSpace<DlMallocSpace, void*>( name, mem_map, mspace, begin, end, begin + capacity, growth_limit, initial_size); } else { diff --git a/runtime/gc/space/large_object_space.cc b/runtime/gc/space/large_object_space.cc index 2fc67ec..0b353c7 100644 --- a/runtime/gc/space/large_object_space.cc +++ b/runtime/gc/space/large_object_space.cc @@ -97,7 +97,7 @@ LargeObjectMapSpace::LargeObjectMapSpace(const std::string& name) lock_("large object map space lock", kAllocSpaceLock) {} LargeObjectMapSpace* LargeObjectMapSpace::Create(const std::string& name) { - if (RUNNING_ON_VALGRIND > 0) { + if (Runtime::Current()->RunningOnValgrind()) { return new ValgrindLargeObjectMapSpace(name); } else { return new LargeObjectMapSpace(name); diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 3e3b5e4..c0bb36a 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -22,6 +22,7 @@ #include <signal.h> #include <sys/syscall.h> +#include <valgrind.h> #include <cstdio> #include <cstdlib> @@ -112,6 +113,7 @@ Runtime::Runtime() exit_(nullptr), abort_(nullptr), stats_enabled_(false), + running_on_valgrind_(RUNNING_ON_VALGRIND > 0), profile_(false), profile_period_s_(0), profile_duration_s_(0), diff --git a/runtime/runtime.h b/runtime/runtime.h index 50c88d3..755c0f0 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -417,6 +417,10 @@ class Runtime { return stack_overflow_handler_ == nullptr; } + bool RunningOnValgrind() const { + return running_on_valgrind_; + } + private: static void InitPlatformSignalHandlers(); @@ -517,6 +521,8 @@ class Runtime { bool stats_enabled_; RuntimeStats stats_; + const bool running_on_valgrind_; + // Runtime profile support. bool profile_; std::string profile_output_filename_; |