From a4adbfd44032d70e166e6f18096bbbed05a990ba Mon Sep 17 00:00:00 2001 From: Hiroshi Yamauchi Date: Tue, 4 Feb 2014 18:12:17 -0800 Subject: RosAlloc verification. If enabled, RosAlloc verification checks the allocator internal metadata and invariants to detect bugs, heap corruptions, and race conditions. Added runtime options for enabling and disabling it. Enable it for the debug build. Bug: 9986565 Bug: 12592026 Change-Id: I923742b87805ae839f1549d78d0d492733da6a58 --- runtime/runtime.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'runtime/runtime.cc') diff --git a/runtime/runtime.cc b/runtime/runtime.cc index 4e90478..17afb43 100644 --- a/runtime/runtime.cc +++ b/runtime/runtime.cc @@ -429,6 +429,8 @@ Runtime::ParsedOptions* Runtime::ParsedOptions::Create(const Options& options, b parsed->use_tlab_ = false; parsed->verify_pre_gc_heap_ = false; parsed->verify_post_gc_heap_ = kIsDebugBuild; + parsed->verify_pre_gc_rosalloc_ = kIsDebugBuild; + parsed->verify_post_gc_rosalloc_ = false; parsed->compiler_callbacks_ = nullptr; parsed->is_zygote_ = false; @@ -615,12 +617,20 @@ Runtime::ParsedOptions* Runtime::ParsedOptions::Create(const Options& options, b parsed->collector_type_ = collector_type; } else if (gc_option == "preverify") { parsed->verify_pre_gc_heap_ = true; - } else if (gc_option == "nopreverify") { + } else if (gc_option == "nopreverify") { parsed->verify_pre_gc_heap_ = false; } else if (gc_option == "postverify") { parsed->verify_post_gc_heap_ = true; } else if (gc_option == "nopostverify") { parsed->verify_post_gc_heap_ = false; + } else if (gc_option == "preverify_rosalloc") { + parsed->verify_pre_gc_rosalloc_ = true; + } else if (gc_option == "nopreverify_rosalloc") { + parsed->verify_pre_gc_rosalloc_ = false; + } else if (gc_option == "postverify_rosalloc") { + parsed->verify_post_gc_rosalloc_ = true; + } else if (gc_option == "nopostverify_rosalloc") { + parsed->verify_post_gc_rosalloc_ = false; } else { LOG(WARNING) << "Ignoring unknown -Xgc option: " << gc_option; } @@ -1018,7 +1028,9 @@ bool Runtime::Init(const Options& raw_options, bool ignore_unrecognized) { options->ignore_max_footprint_, options->use_tlab_, options->verify_pre_gc_heap_, - options->verify_post_gc_heap_); + options->verify_post_gc_heap_, + options->verify_pre_gc_rosalloc_, + options->verify_post_gc_rosalloc_); dump_gc_performance_on_shutdown_ = options->dump_gc_performance_on_shutdown_; -- cgit v1.1