diff options
author | Todd Kennedy <toddke@google.com> | 2015-09-28 18:23:42 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-09-28 18:23:42 +0000 |
commit | 534a49dc3282d1056f92c7ed6e0ef7fa2f9ec74e (patch) | |
tree | 2dd979f72478d7116e35219d9a34536f86b2c5b7 | |
parent | a5359950298f0bd5833ab72b7a26aef9fc45056f (diff) | |
parent | 905c1446ea602b4649a248bfe878626cae01a87a (diff) | |
download | native-534a49dc3282d1056f92c7ed6e0ef7fa2f9ec74e.tar.gz |
am 905c1446: Merge "Allow using the JIT"
* commit '905c1446ea602b4649a248bfe878626cae01a87a':
Allow using the JIT
-rw-r--r-- | cmds/installd/commands.cpp | 8 | ||||
-rw-r--r-- | cmds/installd/installd.h | 18 |
2 files changed, 18 insertions, 8 deletions
diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp index 2324db5e13..2ded43da02 100644 --- a/cmds/installd/commands.cpp +++ b/cmds/installd/commands.cpp @@ -746,7 +746,7 @@ static bool check_boolean_property(const char* property_name, bool default_value static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, const char* output_file_name, int swap_fd, const char *pkgname, const char *instruction_set, - bool vm_safe_mode, bool debuggable, bool post_bootcomplete) + bool vm_safe_mode, bool debuggable, bool post_bootcomplete, bool use_jit) { static const unsigned int MAX_INSTRUCTION_SET_LEN = 7; @@ -820,7 +820,6 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, (strcmp(vold_decrypt, "trigger_restart_min_framework") == 0 || (strcmp(vold_decrypt, "1") == 0))); - bool use_jit = check_boolean_property("debug.usejit"); bool generate_debug_info = check_boolean_property("debug.generate-debug-info"); static const char* DEX2OAT_BIN = "/system/bin/dex2oat"; @@ -874,6 +873,8 @@ static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, } } + // use the JIT if either it's specified as a dexopt flag or if the property is set + use_jit = use_jit || check_boolean_property("debug.usejit"); if (have_dex2oat_Xms_flag) { sprintf(dex2oat_Xms_arg, "-Xms%s", dex2oat_Xms_flag); } @@ -1108,6 +1109,7 @@ int dexopt(const char *apk_path, uid_t uid, const char *pkgname, const char *ins bool vm_safe_mode = (dexopt_flags & DEXOPT_SAFEMODE) != 0; bool debuggable = (dexopt_flags & DEXOPT_DEBUGGABLE) != 0; bool boot_complete = (dexopt_flags & DEXOPT_BOOTCOMPLETE) != 0; + bool use_jit = (dexopt_flags & DEXOPT_USEJIT) != 0; if ((dexopt_flags & DEXOPT_MASK) != 0) { LOG_FATAL("dexopt flags contains unknown fields\n"); @@ -1251,7 +1253,7 @@ int dexopt(const char *apk_path, uid_t uid, const char *pkgname, const char *ins input_file_name++; } run_dex2oat(input_fd, out_fd, input_file_name, out_path, swap_fd, pkgname, - instruction_set, vm_safe_mode, debuggable, boot_complete); + instruction_set, vm_safe_mode, debuggable, boot_complete, use_jit); } else { ALOGE("Invalid dexopt needed: %d\n", dexopt_needed); exit(73); diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h index 51a609c09e..df13fe4e72 100644 --- a/cmds/installd/installd.h +++ b/cmds/installd/installd.h @@ -94,11 +94,19 @@ * IMPORTANT: These values are passed from Java code. Keep them in sync with * frameworks/base/services/core/java/com/android/server/pm/Installer.java ***************************************************************************/ -#define DEXOPT_PUBLIC (1 << 1) -#define DEXOPT_SAFEMODE (1 << 2) -#define DEXOPT_DEBUGGABLE (1 << 3) -#define DEXOPT_BOOTCOMPLETE (1 << 4) -#define DEXOPT_MASK (DEXOPT_PUBLIC | DEXOPT_SAFEMODE | DEXOPT_DEBUGGABLE | DEXOPT_BOOTCOMPLETE) +constexpr int DEXOPT_PUBLIC = 1 << 1; +constexpr int DEXOPT_SAFEMODE = 1 << 2; +constexpr int DEXOPT_DEBUGGABLE = 1 << 3; +constexpr int DEXOPT_BOOTCOMPLETE = 1 << 4; +constexpr int DEXOPT_USEJIT = 1 << 5; + +/* all known values for dexopt flags */ +constexpr int DEXOPT_MASK = + DEXOPT_PUBLIC + | DEXOPT_SAFEMODE + | DEXOPT_DEBUGGABLE + | DEXOPT_BOOTCOMPLETE + | DEXOPT_USEJIT; #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) |