OSDN Git Service

Remove support for setting the minimum size of the heap at runtime.
authorCarl Shapiro <cshapiro@google.com>
Wed, 12 Jan 2011 19:04:55 +0000 (11:04 -0800)
committerCarl Shapiro <cshapiro@google.com>
Wed, 12 Jan 2011 19:31:24 +0000 (11:31 -0800)
Change-Id: I1752c59184325b5929532b61f4fa0feaa03b8218

vm/alloc/Alloc.h
vm/alloc/Copying.c
vm/alloc/HeapSource.c
vm/native/dalvik_system_VMRuntime.c

index 64da479..988ae6c 100644 (file)
@@ -153,13 +153,6 @@ float dvmGetTargetHeapUtilization(void);
 void dvmSetTargetHeapUtilization(float newTarget);
 
 /*
- * If set is true, sets the new minimum heap size to size; always
- * returns the current (or previous) size.  If size is zero,
- * removes the current minimum constraint (if present).
- */
-size_t dvmMinimumHeapSize(size_t size, bool set);
-
-/*
  * Initiate garbage collection.
  *
  * This usually happens automatically, but can also be caused by Runtime.gc().
index 0d72bfc..c4debfe 100644 (file)
@@ -745,11 +745,6 @@ void dvmSetTargetHeapUtilization(float newTarget)
     assert(newTarget > 0.0f && newTarget < 1.0f);
 }
 
-size_t dvmMinimumHeapSize(size_t size, bool set)
-{
-    return gDvm.gcHeap->heapSource->minimumSize;
-}
-
 /*
  * Expands the size of the heap after a collection.  At present we
  * commit the pages for maximum size of the heap so this routine is
index 4a05be9..5127cad 100644 (file)
@@ -106,10 +106,6 @@ struct HeapSource {
      */
     size_t targetUtilization;
 
-    /* Requested minimum heap size, or zero if there is no minimum.
-     */
-    size_t minimumSize;
-
     /* The starting heap size.
      */
     size_t startSize;
@@ -518,7 +514,6 @@ dvmHeapSourceStartup(size_t startSize, size_t absoluteMaxSize)
     memset(hs, 0, sizeof(*hs));
 
     hs->targetUtilization = DEFAULT_HEAP_UTILIZATION;
-    hs->minimumSize = 0;
     hs->startSize = startSize;
     hs->absoluteMaxSize = absoluteMaxSize;
     hs->idealSize = startSize;
@@ -1169,8 +1164,6 @@ setIdealFootprint(size_t max)
                 FRACTIONAL_MB(max),
                 FRACTIONAL_MB(hs->absoluteMaxSize));
         max = hs->absoluteMaxSize;
-    } else if (max < hs->minimumSize) {
-        max = hs->minimumSize;
     }
 
     /* Convert max into a size that applies to the active heap.
@@ -1245,48 +1238,6 @@ void dvmSetTargetHeapUtilization(float newTarget)
 }
 
 /*
- * If set is true, sets the new minimum heap size to size; always
- * returns the current (or previous) size.  If size is negative,
- * removes the current minimum constraint (if present).
- */
-size_t
-dvmMinimumHeapSize(size_t size, bool set)
-{
-    HeapSource *hs = gHs;
-    size_t oldMinimumSize;
-
-    /* gHs caches an entry in gDvm.gcHeap;  we need to hold the
-     * heap lock if we're going to look at it.  We also need the
-     * lock for the call to setIdealFootprint().
-     */
-    dvmLockHeap();
-
-    HS_BOILERPLATE();
-
-    oldMinimumSize = hs->minimumSize;
-
-    if (set) {
-        if (size > hs->absoluteMaxSize) {
-            size = hs->absoluteMaxSize;
-        }
-        hs->minimumSize = size;
-        if (size > hs->idealSize) {
-            /* Force a snap to the minimum value, which we just set
-             * and which setIdealFootprint() will take into consideration.
-             */
-            setIdealFootprint(hs->idealSize);
-        }
-        /* Otherwise we'll just keep it in mind the next time
-         * setIdealFootprint() is called.
-         */
-    }
-
-    dvmUnlockHeap();
-
-    return oldMinimumSize;
-}
-
-/*
  * Given the size of a live set, returns the ideal heap size given
  * the current target utilization and MIN/MAX values.
  *
index 06c88a4..542961c 100644 (file)
@@ -54,34 +54,6 @@ static void Dalvik_dalvik_system_VMRuntime_nativeSetTargetHeapUtilization(
 }
 
 /*
- * native long nativeMinimumHeapSize(long size, boolean set)
- *
- * If set is true, sets the new minimum heap size to size; always
- * returns the current (or previous) size.  If size is negative or
- * zero, removes the current minimum constraint (if present).
- */
-static void Dalvik_dalvik_system_VMRuntime_nativeMinimumHeapSize(
-    const u4* args, JValue* pResult)
-{
-    s8 longSize = GET_ARG_LONG(args, 1);
-    size_t size;
-    bool set = (args[3] != 0);
-
-    /* Fit in 32 bits. */
-    if (longSize < 0) {
-        size = 0;
-    } else if (longSize > INT_MAX) {
-        size = INT_MAX;
-    } else {
-        size = (size_t)longSize;
-    }
-
-    size = dvmMinimumHeapSize(size, set);
-
-    RETURN_LONG(size);
-}
-
-/*
  * public native void gcSoftReferences()
  *
  * Does a GC and forces collection of SoftReferences that are
@@ -198,8 +170,6 @@ const DalvikNativeMethod dvm_dalvik_system_VMRuntime[] = {
         Dalvik_dalvik_system_VMRuntime_getTargetHeapUtilization },
     { "nativeSetTargetHeapUtilization", "(F)V",
         Dalvik_dalvik_system_VMRuntime_nativeSetTargetHeapUtilization },
-    { "nativeMinimumHeapSize", "(JZ)J",
-        Dalvik_dalvik_system_VMRuntime_nativeMinimumHeapSize },
     { "gcSoftReferences", "()V",
         Dalvik_dalvik_system_VMRuntime_gcSoftReferences },
     { "runFinalizationSync", "()V",