art: Implement SetTargetMinHeapFree, SetTargetHeapConcurrentStart
* Commit: GC triggering performance optimizations
ID: 7646e2eb41024d152d76b269653c2321e2cfbd23
introduced additional functions that needed to be implemented.
Change-Id: I5ec4ae74dc70f1859db2bae8588e697b147a2682
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 1b46257..a9b9133 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -940,6 +940,14 @@
target_utilization_ = target;
}
+void Heap::SetTargetHeapMinFree(size_t bytes) {
+ min_free_ = bytes;
+}
+
+void Heap::SetTargetHeapConcurrentStart(size_t bytes) {
+ concurrent_start_bytes_ = bytes;
+}
+
size_t Heap::GetObjectsAllocated() const {
size_t total = 0;
typedef std::vector<space::ContinuousSpace*>::const_iterator It;
diff --git a/runtime/gc/heap.h b/runtime/gc/heap.h
index 0b64261..530118b 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -203,6 +203,24 @@
// dalvik.system.VMRuntime.setTargetHeapUtilization.
void SetTargetHeapUtilization(float target);
+ // Sets HEAP_MIN_FREE, implements
+ // dalvik.system.VMRuntime.SetTargetHeapMinFree.
+ void SetTargetHeapMinFree(size_t bytes);
+
+ // Gets HEAP_MIN_FREE
+ int GetTargetHeapMinFree() const {
+ return min_free_;
+ }
+
+ // Sets HEAP_CONCURRENT_START, implements
+ // dalvik.system.VMRuntime.SetTargetHeapConcurrentStart.
+ void SetTargetHeapConcurrentStart(size_t bytes);
+
+ // Gets HEAP_CONCURRENT_START
+ int GetTargetHeapConcurrentStart() const {
+ return concurrent_start_bytes_;
+ }
+
// For the alloc space, sets the maximum number of bytes that the heap is allowed to allocate
// from the system. Doesn't allow the space to exceed its growth limit.
void SetIdealFootprint(size_t max_allowed_footprint);
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index 5fc8bd5..0a652b6 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -43,6 +43,18 @@
Runtime::Current()->GetHeap()->SetTargetHeapUtilization(target);
}
+static jint VMRuntime_nativeSetTargetHeapMinFree(JNIEnv*, jobject, jint bytes) {
+ Runtime::Current()->GetHeap()->SetTargetHeapMinFree(bytes);
+
+ return Runtime::Current()->GetHeap()->GetTargetHeapMinFree();
+}
+
+static jint VMRuntime_nativeSetTargetHeapConcurrentStart(JNIEnv*, jobject, jint bytes) {
+ Runtime::Current()->GetHeap()->SetTargetHeapConcurrentStart(bytes);
+
+ return Runtime::Current()->GetHeap()->GetTargetHeapConcurrentStart();
+}
+
static void VMRuntime_startJitCompilation(JNIEnv*, jobject) {
}
@@ -206,6 +218,8 @@
NATIVE_METHOD(VMRuntime, getTargetHeapUtilization, "()F"),
NATIVE_METHOD(VMRuntime, isDebuggerActive, "()Z"),
NATIVE_METHOD(VMRuntime, nativeSetTargetHeapUtilization, "(F)V"),
+ NATIVE_METHOD(VMRuntime, nativeSetTargetHeapMinFree, "(I)I"),
+ NATIVE_METHOD(VMRuntime, nativeSetTargetHeapConcurrentStart, "(I)I"),
NATIVE_METHOD(VMRuntime, newNonMovableArray, "(Ljava/lang/Class;I)Ljava/lang/Object;"),
NATIVE_METHOD(VMRuntime, properties, "()[Ljava/lang/String;"),
NATIVE_METHOD(VMRuntime, setTargetSdkVersion, "(I)V"),