Merge change I42d17725 into eclair-mr2
* changes:
Cache NumberFormat and DecimalFormatSymbols objects in a ThreadLocal, so they can be reused between multiple instances of Formatter on the same thread. This speeds up my unscientific benchmark (a number of printouts involved in a debugging diagnostics output) by 3x, and should have a similar impact on anyone who uses String.format(), PrintWriter.format(), and the like.
diff --git a/vm/Debugger.c b/vm/Debugger.c
index 4ddf25c..0d8f3f6 100644
--- a/vm/Debugger.c
+++ b/vm/Debugger.c
@@ -2949,7 +2949,7 @@
void dvmDbgDdmSendChunk(int type, int len, const u1* buf)
{
if (gDvm.jdwpState == NULL) {
- LOGI("Debugger thread not active, ignoring DDM send (t=0x%08x l=%d)\n",
+ LOGV("Debugger thread not active, ignoring DDM send (t=0x%08x l=%d)\n",
type, len);
return;
}
diff --git a/vm/Native.c b/vm/Native.c
index 31832c2..967482c 100644
--- a/vm/Native.c
+++ b/vm/Native.c
@@ -444,8 +444,13 @@
{
SharedLib* pEntry;
void* handle;
+ bool verbose;
- LOGD("Trying to load lib %s %p\n", pathName, classLoader);
+ /* reduce noise by not chattering about system libraries */
+ verbose = strncmp(pathName, "/system", sizeof("/system")-1) != 0;
+
+ if (verbose)
+ LOGD("Trying to load lib %s %p\n", pathName, classLoader);
/*
* See if we've already loaded it. If we have, and the class loader
@@ -458,8 +463,10 @@
pathName, pEntry->classLoader, classLoader);
return false;
}
- LOGD("Shared lib '%s' already loaded in same CL %p\n",
- pathName, classLoader);
+ if (verbose) {
+ LOGD("Shared lib '%s' already loaded in same CL %p\n",
+ pathName, classLoader);
+ }
if (!checkOnLoadResult(pEntry))
return false;
return true;
@@ -473,11 +480,9 @@
* Failures here are expected when java.library.path has several entries
* and we have to hunt for the lib.
*
- * The current android-arm dynamic linker implementation tends to
- * return "Cannot find library" from dlerror() regardless of the actual
- * problem. A more useful diagnostic may be sent to stdout/stderr if
- * linker diagnostics are enabled, but that's not usually visible in
- * Android apps. Some things to try:
+ * The current version of the dynamic linker prints detailed information
+ * about dlopen() failures. Some things to check if the message is
+ * cryptic:
* - make sure the library exists on the device
* - verify that the right path is being opened (the debug log message
* above can help with that)
@@ -523,7 +528,8 @@
freeSharedLibEntry(pNewEntry);
return checkOnLoadResult(pActualEntry);
} else {
- LOGD("Added shared lib %s %p\n", pathName, classLoader);
+ if (verbose)
+ LOGD("Added shared lib %s %p\n", pathName, classLoader);
bool result = true;
void* vonLoad;
@@ -531,7 +537,8 @@
vonLoad = dlsym(handle, "JNI_OnLoad");
if (vonLoad == NULL) {
- LOGD("No JNI_OnLoad found in %s %p\n", pathName, classLoader);
+ LOGD("No JNI_OnLoad found in %s %p, skipping init\n",
+ pathName, classLoader);
} else {
/*
* Call JNI_OnLoad. We have to override the current class
@@ -746,7 +753,7 @@
int len;
if (meth->clazz->classLoader != pLib->classLoader) {
- LOGD("+++ not scanning '%s' for '%s' (wrong CL)\n",
+ LOGV("+++ not scanning '%s' for '%s' (wrong CL)\n",
pLib->pathName, meth->name);
return 0;
} else
diff --git a/vm/alloc/HeapSource.c b/vm/alloc/HeapSource.c
index 830e5d7..6e3036b 100644
--- a/vm/alloc/HeapSource.c
+++ b/vm/alloc/HeapSource.c
@@ -498,7 +498,7 @@
/* Create a new heap for post-fork zygote allocations. We only
* try once, even if it fails.
*/
- LOGI("Splitting out new zygote heap\n");
+ LOGV("Splitting out new zygote heap\n");
gDvm.newZygoteHeapAllocated = true;
return addNewHeap(hs, NULL, 0);
}