Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 1 | #################################### |
| 2 | # dexpreopt support for ART |
| 3 | # |
| 4 | #################################### |
| 5 | |
| 6 | DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX) |
| 7 | DEX2OATD := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX) |
| 8 | |
| 9 | LIBART_COMPILER := $(HOST_OUT_SHARED_LIBRARIES)/libart-compiler$(HOST_SHLIB_SUFFIX) |
| 10 | LIBARTD_COMPILER := $(HOST_OUT_SHARED_LIBRARIES)/libartd-compiler$(HOST_SHLIB_SUFFIX) |
| 11 | |
| 12 | # TODO: for now, override with debug version for better error reporting |
| 13 | DEX2OAT := $(DEX2OATD) |
| 14 | LIBART_COMPILER := $(LIBARTD_COMPILER) |
| 15 | |
| 16 | # By default, do not run rerun dex2oat if the tool changes. |
| 17 | # Comment out the | to force dex2oat to rerun on after all changes. |
| 18 | DEX2OAT_DEPENDENCY := art/runtime/oat.cc # dependency on oat version number |
| 19 | DEX2OAT_DEPENDENCY += art/runtime/image.cc # dependency on image version number |
| 20 | DEX2OAT_DEPENDENCY += | |
| 21 | DEX2OAT_DEPENDENCY += $(DEX2OAT) |
| 22 | DEX2OAT_DEPENDENCY += $(LIBART_COMPILER) |
| 23 | |
| 24 | PRELOADED_CLASSES := frameworks/base/preloaded-classes |
| 25 | |
| 26 | LIBART_BOOT_IMAGE := /$(DEXPREOPT_BOOT_JAR_DIR)/boot.art |
| 27 | |
| 28 | DEFAULT_DEX_PREOPT_BUILT_IMAGE := $(DEXPREOPT_BOOT_JAR_DIR_FULL_PATH)/boot.art |
Brian Carlstrom | 8fb5dfc | 2014-01-16 23:25:27 -0800 | [diff] [blame] | 29 | |
| 30 | DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := |
| 31 | ifneq ($(PRODUCT_DEX_PREOPT_IMAGE_IN_DATA),true) |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 32 | DEFAULT_DEX_PREOPT_INSTALLED_IMAGE := $(PRODUCT_OUT)$(LIBART_BOOT_IMAGE) |
| 33 | |
| 34 | # The rule to install boot.art and boot.oat |
| 35 | $(DEFAULT_DEX_PREOPT_INSTALLED_IMAGE) : $(DEFAULT_DEX_PREOPT_BUILT_IMAGE) | $(ACP) |
| 36 | $(call copy-file-to-target) |
| 37 | $(hide) $(ACP) -fp $(patsubst %.art,%.oat,$<) $(patsubst %.art,%.oat,$@) |
Brian Carlstrom | 8fb5dfc | 2014-01-16 23:25:27 -0800 | [diff] [blame] | 38 | endif |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 39 | |
| 40 | DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := default |
| 41 | ifeq ($(TARGET_CPU_VARIANT),$(filter $(TARGET_CPU_VARIANT),cortex-a15 krait)) |
| 42 | DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES := div |
| 43 | endif |
| 44 | |
| 45 | # start of image reserved address space |
| 46 | LIBART_IMG_HOST_BASE_ADDRESS := 0x60000000 |
| 47 | |
| 48 | ifeq ($(TARGET_ARCH),mips) |
| 49 | LIBART_IMG_TARGET_BASE_ADDRESS := 0x30000000 |
| 50 | else |
Mathieu Chartier | 3408ca0 | 2014-03-05 14:45:18 -0800 | [diff] [blame^] | 51 | LIBART_IMG_TARGET_BASE_ADDRESS := 0x70000000 |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 52 | endif |
| 53 | |
| 54 | ######################################################################## |
| 55 | # The full system boot classpath |
| 56 | |
| 57 | # note we use core-libart.jar in place of core.jar for ART. |
| 58 | LIBART_TARGET_BOOT_JARS := $(patsubst core, core-libart,$(DEXPREOPT_BOOT_JARS_MODULES)) |
| 59 | LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar) |
| 60 | LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar) |
| 61 | |
| 62 | # The .oat with symbols |
| 63 | LIBART_TARGET_BOOT_OAT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)$(patsubst %.art,%.oat,$(LIBART_BOOT_IMAGE)) |
| 64 | |
| 65 | $(DEFAULT_DEX_PREOPT_BUILT_IMAGE): $(LIBART_TARGET_BOOT_DEX_FILES) $(DEX2OAT_DEPENDENCY) |
| 66 | @echo "target dex2oat: $@ ($?)" |
| 67 | @mkdir -p $(dir $@) |
| 68 | @mkdir -p $(dir $(LIBART_TARGET_BOOT_OAT_UNSTRIPPED)) |
| 69 | $(hide) $(DEX2OAT) --runtime-arg -Xms256m --runtime-arg -Xmx256m --image-classes=$(PRELOADED_CLASSES) \ |
| 70 | $(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \ |
| 71 | $(addprefix --dex-location=,$(LIBART_TARGET_BOOT_DEX_LOCATIONS)) \ |
| 72 | --oat-symbols=$(LIBART_TARGET_BOOT_OAT_UNSTRIPPED) \ |
| 73 | --oat-file=$(patsubst %.art,%.oat,$@) \ |
| 74 | --oat-location=$(patsubst %.art,%.oat,$(LIBART_BOOT_IMAGE)) \ |
| 75 | --image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \ |
| 76 | --instruction-set=$(TARGET_ARCH) --instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \ |
Nicolas Geoffray | 5fd9a32 | 2014-03-04 17:06:40 +0000 | [diff] [blame] | 77 | --android-root=$(PRODUCT_OUT)/system |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 78 | |
| 79 | |
| 80 | ######################################################################## |
| 81 | # For a single jar or APK |
| 82 | |
| 83 | # $(1): the boot image to use |
| 84 | # $(2): the input .jar or .apk file |
| 85 | # $(3): the input .jar or .apk target location |
| 86 | # $(4): the output .odex file |
| 87 | define dex2oat-one-file |
| 88 | $(hide) rm -f $(4) |
| 89 | $(hide) mkdir -p $(dir $(4)) |
| 90 | $(hide) $(DEX2OAT) \ |
| 91 | --runtime-arg -Xms64m --runtime-arg -Xmx64m \ |
| 92 | --boot-image=$(1) \ |
| 93 | --dex-file=$(2) \ |
| 94 | --dex-location=$(3) \ |
| 95 | --oat-file=$(4) \ |
Brian Carlstrom | ced4bff | 2013-11-14 23:44:56 -0800 | [diff] [blame] | 96 | --android-root=$(PRODUCT_OUT)/system \ |
| 97 | --instruction-set=$(TARGET_ARCH) \ |
| 98 | --instruction-set-features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) |
| 99 | endef |