Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f50c879 authored by Mathieu Chartier's avatar Mathieu Chartier
Browse files

Add boot profile support

If the boot profile file exists, its passed to the runtime as an
image compiler option. Also pass speed-profile for this case.

Bug: 37966211
Test: make, flash, and look at logcat during boot

(cherry picked from commit f99e70e9)

Change-Id: Ia09ff0200186382e45151b7cabb53016f8e0aa3f
parent 5d5ace5e
Loading
Loading
Loading
Loading
+20 −12
Original line number Diff line number Diff line
@@ -799,6 +799,13 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote)
                            "--compiler-filter=", "-Ximage-compiler-option");
    }

    // If there is a boot profile, it takes precedence over the image and preloaded classes.
    if (hasFile("/system/etc/boot-image.prof")) {
        addOption("-Ximage-compiler-option");
        addOption("--profile-file=/system/etc/boot-image.prof");
        addOption("-Ximage-compiler-option");
        addOption("--compiler-filter=speed-profile");
    } else {
        // Make sure there is a preloaded-classes file.
        if (!hasFile("/system/etc/preloaded-classes")) {
            ALOGE("Missing preloaded-classes file, /system/etc/preloaded-classes not found: %s\n",
@@ -813,6 +820,7 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote)
            addOption("-Ximage-compiler-option");
            addOption("--compiled-classes=/system/etc/compiled-classes");
        }
    }

    property_get("dalvik.vm.image-dex2oat-flags", dex2oatImageFlagsBuf, "");
    parseExtraOpts(dex2oatImageFlagsBuf, "-Ximage-compiler-option");