summaryrefslogtreecommitdiffstats
path: root/vm
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2013-11-30 08:27:37 -0800
committerSteve Kondik <shade@chemlab.org>2013-11-30 08:27:37 -0800
commit8b099af122a2689af3de32fcb23972651ee7d4e5 (patch)
treedfab41054ca0c2dcf5e886adf1486da8bb8fbc5f /vm
parentbab417cc2aceee45238d5648975118bf3dd4c2e9 (diff)
parentd3260cbe21ac8502dedf1bf360466acc6df79615 (diff)
downloadandroid_dalvik-8b099af122a2689af3de32fcb23972651ee7d4e5.tar.gz
android_dalvik-8b099af122a2689af3de32fcb23972651ee7d4e5.tar.bz2
android_dalvik-8b099af122a2689af3de32fcb23972651ee7d4e5.zip
Merge branch 'kk_2.7_rb1.11' of git://codeaurora.org/platform/dalvik into cm-11.0
Diffstat (limited to 'vm')
-rw-r--r--vm/Android.mk6
-rw-r--r--vm/alloc/HeapSource.cpp60
-rw-r--r--vm/analysis/DexPrepare.cpp2
-rw-r--r--vm/compiler/codegen/arm/Assemble.cpp16
-rw-r--r--vm/native/dalvik_system_Zygote.cpp12
5 files changed, 68 insertions, 28 deletions
diff --git a/vm/Android.mk b/vm/Android.mk
index 8cca3f39b..bdd164eca 100644
--- a/vm/Android.mk
+++ b/vm/Android.mk
@@ -56,6 +56,9 @@ include $(LOCAL_PATH)/ReconfigureDvm.mk
# Overwrite default settings
LOCAL_MODULE := libdvm
LOCAL_CFLAGS += $(target_smp_flag)
+ifeq ($(TARGET_ARCH_LOWMEM),true)
+ LOCAL_CFLAGS += -DDALVIK_LOWMEM
+endif
# Define WITH_ADDRESS_SANITIZER to build an ASan-instrumented version of the
# library in /system/lib/asan/libdvm.so.
@@ -150,6 +153,9 @@ ifeq ($(WITH_HOST_DALVIK),true)
LOCAL_CFLAGS += $(host_inline_arg5_flag)
# TODO: split out the asflags.
LOCAL_ASFLAGS := $(LOCAL_CFLAGS)
+ ifeq ($(TARGET_ARCH_LOWMEM),true)
+ LOCAL_CFLAGS += -DDALVIK_LOWMEM
+ endif
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libdvm
diff --git a/vm/alloc/HeapSource.cpp b/vm/alloc/HeapSource.cpp
index 8f1c4cbe2..caf30af02 100644
--- a/vm/alloc/HeapSource.cpp
+++ b/vm/alloc/HeapSource.cpp
@@ -35,7 +35,17 @@ static void setIdealFootprint(size_t max);
static size_t getMaximumSize(const HeapSource *hs);
static void trimHeaps();
+#ifdef DALVIK_LOWMEM
+static const bool lowmem = true;
+#else
+static const bool lowmem = false;
+#endif
+
#define HEAP_UTILIZATION_MAX 1024
+#define DEFAULT_HEAP_UTILIZATION 512 // Range 1..HEAP_UTILIZATION_MAX
+#define HEAP_IDEAL_FREE_DEFAULT (2 * 1024 * 1024)
+static unsigned int heapIdeaFree = HEAP_IDEAL_FREE_DEFAULT;
+#define HEAP_MIN_FREE ((heapIdeaFree) / 4)
/* How long to wait after a GC before performing a heap trim
* operation to reclaim unused pages.
@@ -450,16 +460,30 @@ static bool addNewHeap(HeapSource *hs)
overhead, hs->maximumSize);
return false;
}
- size_t morecoreStart = MAX(SYSTEM_PAGE_SIZE, gDvm.heapStartingSize);
- heap.maximumSize = hs->growthLimit - overhead;
- heap.concurrentStartBytes = hs->minFree - concurrentStart;
- heap.base = base;
- heap.limit = heap.base + heap.maximumSize;
- heap.brk = heap.base + morecoreStart;
- if (!remapNewHeap(hs, &heap)) {
- return false;
+
+ if(lowmem) {
+ heap.maximumSize = hs->growthLimit - overhead;
+ heap.concurrentStartBytes = HEAP_MIN_FREE - concurrentStart;
+ heap.base = base;
+ heap.limit = heap.base + heap.maximumSize;
+ heap.brk = heap.base + HEAP_MIN_FREE;
+ if (!remapNewHeap(hs, &heap)) {
+ return false;
+ }
+ heap.msp = createMspace(base, HEAP_MIN_FREE, hs->maximumSize - overhead);
+ }
+ else {
+ size_t morecoreStart = MAX(SYSTEM_PAGE_SIZE, gDvm.heapStartingSize);
+ heap.maximumSize = hs->growthLimit - overhead;
+ heap.concurrentStartBytes = hs->minFree - concurrentStart;
+ heap.base = base;
+ heap.limit = heap.base + heap.maximumSize;
+ heap.brk = heap.base + morecoreStart;
+ if (!remapNewHeap(hs, &heap)) {
+ return false;
+ }
+ heap.msp = createMspace(base, morecoreStart, hs->minFree);
}
- heap.msp = createMspace(base, morecoreStart, hs->minFree);
if (heap.msp == NULL) {
return false;
}
@@ -698,14 +722,16 @@ fail:
bool dvmHeapSourceStartupAfterZygote()
{
- //For each new application forked, we need to reset softLimit and
- //concurrentStartBytes to be the correct expected value, not the one
- //inherit from Zygote
- HeapSource* hs = gHs;
-
- hs->softLimit=SIZE_MAX;
- hs->heaps[0].concurrentStartBytes = mspace_footprint(hs->heaps[0].msp) - concurrentStart;
- return gDvm.concurrentMarkSweep ? gcDaemonStartup() : true;
+ if(lowmem) {
+ return gDvm.concurrentMarkSweep ? gcDaemonStartup() : true;
+ }
+ else {
+ HeapSource* hs = gHs;
+
+ hs->softLimit=SIZE_MAX;
+ hs->heaps[0].concurrentStartBytes = mspace_footprint(hs->heaps[0].msp) - concurrentStart;
+ return gDvm.concurrentMarkSweep ? gcDaemonStartup() : true;
+ }
}
/*
diff --git a/vm/analysis/DexPrepare.cpp b/vm/analysis/DexPrepare.cpp
index e8112d543..b0147b3f2 100644
--- a/vm/analysis/DexPrepare.cpp
+++ b/vm/analysis/DexPrepare.cpp
@@ -1153,7 +1153,7 @@ static const u1* getSignature(const ClassPathEntry* cpe)
* If this changes, update DEX_OPT_MAGIC_VERS.
*/
static const size_t kMinDepSize = 4 * 4;
-static const size_t kMaxDepSize = 4 * 4 + 2048; // sanity check
+static const size_t kMaxDepSize = 4 * 4 + 2448; // sanity check
/*
* Read the "opt" header, verify it, then read the dependencies section
diff --git a/vm/compiler/codegen/arm/Assemble.cpp b/vm/compiler/codegen/arm/Assemble.cpp
index 5e64c0107..5eab3f73f 100644
--- a/vm/compiler/codegen/arm/Assemble.cpp
+++ b/vm/compiler/codegen/arm/Assemble.cpp
@@ -1047,12 +1047,18 @@ static AssemblerStatus assembleInstructions(CompilationUnit *cUnit,
intptr_t target = targetLIR->generic.offset;
int delta = target - pc;
if ((lir->opcode == kThumbBCond) && (delta > 254 || delta < -256)) {
- if (cUnit->printMe) {
- ALOGD("kThumbBCond@%x: delta=%d", lir->generic.offset,
- delta);
- dvmCompilerCodegenDump(cUnit);
+ if (delta <= 1048574 && delta >= -1048576) {
+ /* convert T1 branch to T3 */
+ lir->opcode = kThumb2BCond;
+ return kRetryAll;
+ } else {
+ if (cUnit->printMe) {
+ ALOGD("kThumbBCond@%x: delta=%d", lir->generic.offset,
+ delta);
+ dvmCompilerCodegenDump(cUnit);
+ }
+ return kRetryHalve;
}
- return kRetryHalve;
}
lir->operands[0] = delta >> 1;
} else if (lir->opcode == kThumbBUncond) {
diff --git a/vm/native/dalvik_system_Zygote.cpp b/vm/native/dalvik_system_Zygote.cpp
index cd69d3633..f0d8cf637 100644
--- a/vm/native/dalvik_system_Zygote.cpp
+++ b/vm/native/dalvik_system_Zygote.cpp
@@ -433,19 +433,21 @@ static int setCapabilities(int64_t permitted, int64_t effective)
{
#ifdef HAVE_ANDROID_OS
struct __user_cap_header_struct capheader;
- struct __user_cap_data_struct capdata;
+ struct __user_cap_data_struct capdata[_LINUX_CAPABILITY_U32S_3];
memset(&capheader, 0, sizeof(capheader));
memset(&capdata, 0, sizeof(capdata));
- capheader.version = _LINUX_CAPABILITY_VERSION;
+ capheader.version = _LINUX_CAPABILITY_VERSION_3;
capheader.pid = 0;
- capdata.effective = effective;
- capdata.permitted = permitted;
+ capdata[0].effective = effective & 0xffffffffULL;
+ capdata[0].permitted = permitted & 0xffffffffULL;
+ capdata[1].effective = (uint64_t)effective >> 32;
+ capdata[1].permitted = (uint64_t)permitted >> 32;
ALOGV("CAPSET perm=%llx eff=%llx", permitted, effective);
- if (capset(&capheader, &capdata) != 0)
+ if (capset(&capheader, capdata) != 0)
return errno;
#endif /*HAVE_ANDROID_OS*/