Disable compaction for jni workarounds.
Compaction can't work when jni workarounds is enabled. Also some
other refactoring.
Change-Id: Ia7b0f2b39c79f5a0a5f50874d823b950ab02a0c3
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 87ee21b..1fcbe4d 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -318,6 +318,16 @@
}
}
+void Heap::DisableCompaction() {
+ if (IsCompactingGC(post_zygote_collector_type_)) {
+ post_zygote_collector_type_ = kCollectorTypeCMS;
+ }
+ if (IsCompactingGC(background_collector_type_)) {
+ background_collector_type_ = post_zygote_collector_type_;
+ }
+ TransitionCollector(post_zygote_collector_type_);
+}
+
std::string Heap::SafeGetClassDescriptor(mirror::Class* klass) {
if (!IsValidContinuousSpaceObjectAddress(klass)) {
return StringPrintf("<non heap address klass %p>", klass);