summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/gc/heap.cc8
-rw-r--r--runtime/gc/heap.h18
-rw-r--r--runtime/native/dalvik_system_VMRuntime.cc14
3 files changed, 40 insertions, 0 deletions
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 1b46257c08..a9b91333f3 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -940,6 +940,14 @@ void Heap::SetTargetHeapUtilization(float target) {
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 0b64261fa1..530118bb23 100644
--- a/runtime/gc/heap.h
+++ b/runtime/gc/heap.h
@@ -203,6 +203,24 @@ class Heap {
// 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 5fc8bd5a48..0a652b6d5f 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -43,6 +43,18 @@ static void VMRuntime_nativeSetTargetHeapUtilization(JNIEnv*, jobject, jfloat ta
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 @@ static JNINativeMethod gMethods[] = {
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"),