diff options
Diffstat (limited to 'dalvik/src/main/java')
4 files changed, 27 insertions, 5 deletions
diff --git a/dalvik/src/main/java/dalvik/annotation/TestTargetNew.java b/dalvik/src/main/java/dalvik/annotation/TestTargetNew.java index b8be0cb..c00e37b 100644 --- a/dalvik/src/main/java/dalvik/annotation/TestTargetNew.java +++ b/dalvik/src/main/java/dalvik/annotation/TestTargetNew.java @@ -51,7 +51,7 @@ public @interface TestTargetNew { * not provided, the class identified in @TestTargetClass is used by the * test progress doclet. */ - Class<?> clazz(); // default void.class; + Class<?> clazz() default void.class; /** * Specifies the level of coverage the tested API method has. diff --git a/dalvik/src/main/java/dalvik/system/DexClassLoader.java b/dalvik/src/main/java/dalvik/system/DexClassLoader.java index cb2f76d..73e6fe4 100644 --- a/dalvik/src/main/java/dalvik/system/DexClassLoader.java +++ b/dalvik/src/main/java/dalvik/system/DexClassLoader.java @@ -95,7 +95,7 @@ public class DexClassLoader extends ClassLoader { /** * Complete initialization on first use of the class loader. */ - private void ensureInit() { + private synchronized void ensureInit() { if (mInitialized) { return; } @@ -195,13 +195,21 @@ public class DexClassLoader extends ClassLoader { else sourceFileName = sourcePathName.substring(lastSlash+1); - /* replace ".jar", ".zip", whatever with ".odex" */ + /* + * Replace ".jar", ".zip", whatever with ".dex". We don't want to + * use ".odex", because the build system uses that for files that + * are paired with resource-only jar files. If the VM can assume + * that there's no classes.dex in the matching jar, it doesn't need + * to open the jar to check for updated dependencies, providing a + * slight performance boost at startup. The use of ".dex" here + * matches the use on files in /data/dalvik-cache. + */ int lastDot = sourceFileName.lastIndexOf("."); if (lastDot < 0) newStr.append(sourceFileName); else newStr.append(sourceFileName, 0, lastDot); - newStr.append(".odex"); + newStr.append(".dex"); if (VERBOSE_DEBUG) System.out.println("Output file will be " + newStr.toString()); diff --git a/dalvik/src/main/java/dalvik/system/PathClassLoader.java b/dalvik/src/main/java/dalvik/system/PathClassLoader.java index 94edfa1..c80aef8 100644 --- a/dalvik/src/main/java/dalvik/system/PathClassLoader.java +++ b/dalvik/src/main/java/dalvik/system/PathClassLoader.java @@ -102,7 +102,7 @@ public class PathClassLoader extends ClassLoader { this.libPath = libPath; } - private void ensureInit() { + private synchronized void ensureInit() { if (initialized) { return; } diff --git a/dalvik/src/main/java/dalvik/system/VMDebug.java b/dalvik/src/main/java/dalvik/system/VMDebug.java index 9034ac1..023cd6a 100644 --- a/dalvik/src/main/java/dalvik/system/VMDebug.java +++ b/dalvik/src/main/java/dalvik/system/VMDebug.java @@ -16,6 +16,8 @@ package dalvik.system; +import java.io.IOException; + /** * Provides access to some VM-specific debug features. Though this class and * many of its members are public, this class is meant to be wrapped in a more @@ -240,6 +242,18 @@ public final class VMDebug { */ public static native int getLoadedClassCount(); + /** + * Dump "hprof" data to the specified file. This will cause a GC. + * + * The VM may create a temporary file in the same directory. + * + * @param fileName Full pathname of output file (e.g. "/sdcard/dump.hprof"). + * @throws UnsupportedOperationException if the VM was built without + * HPROF support. + * @throws IOException if an error occurs while opening or writing files. + */ + public static native void dumpHprofData(String fileName) throws IOException; + /* don't ask */ static native void printThis(Object thisThing, int count, int thing); |