blob: 1de72b785f17146fb9911f42e7a501ae2d2ca6e8 [file] [log] [blame]
Brian Carlstromced4bff2013-11-14 23:44:56 -08001####################################
2# dexpreopt support for ART
3#
4####################################
5
6DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX)
7DEX2OATD := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
8
Brian Carlstromced4bff2013-11-14 23:44:56 -08009# By default, do not run rerun dex2oat if the tool changes.
10# Comment out the | to force dex2oat to rerun on after all changes.
11DEX2OAT_DEPENDENCY := art/runtime/oat.cc # dependency on oat version number
12DEX2OAT_DEPENDENCY += art/runtime/image.cc # dependency on image version number
13DEX2OAT_DEPENDENCY += |
14DEX2OAT_DEPENDENCY += $(DEX2OAT)
Brian Carlstromced4bff2013-11-14 23:44:56 -080015
Nicolas Geoffrayed154c32014-03-25 11:14:26 +000016DEX2OATD_DEPENDENCY := $(DEX2OAT_DEPENDENCY)
17DEX2OATD_DEPENDENCY += $(DEX2OATD)
Nicolas Geoffrayed154c32014-03-25 11:14:26 +000018
Ying Wang0c9b3ba2014-11-13 15:19:12 -080019# Use the first preloaded-classes file in PRODUCT_COPY_FILES.
20PRELOADED_CLASSES := $(call word-colon,1,$(firstword \
21 $(filter %system/etc/preloaded-classes,$(PRODUCT_COPY_FILES))))
Brian Carlstromced4bff2013-11-14 23:44:56 -080022
Andreas Gampe96a52202014-11-18 11:45:10 -080023# Use the first compiled-classes file in PRODUCT_COPY_FILES.
24COMPILED_CLASSES := $(call word-colon,1,$(firstword \
25 $(filter %system/etc/compiled-classes,$(PRODUCT_COPY_FILES))))
26
Nicolas Geoffray75c08b22014-10-06 14:53:59 +010027# Default to debug version to help find bugs.
28# Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
29ifneq ($(USE_DEX2OAT_DEBUG), false)
30DEX2OAT = $(DEX2OATD)
Nicolas Geoffray4c0c3902014-10-07 11:17:09 +010031DEX2OAT_DEPENDENCY = $(DEX2OATD_DEPENDENCY)
Nicolas Geoffray75c08b22014-10-06 14:53:59 +010032endif
33
Brian Carlstromced4bff2013-11-14 23:44:56 -080034# start of image reserved address space
35LIBART_IMG_HOST_BASE_ADDRESS := 0x60000000
Mathieu Chartier3408ca02014-03-05 14:45:18 -080036LIBART_IMG_TARGET_BASE_ADDRESS := 0x70000000
Brian Carlstromced4bff2013-11-14 23:44:56 -080037
Colin Crossdd2ff552014-07-09 22:09:50 -070038define get-product-default-property
39$(strip $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))
Brian Carlstromcffe2892014-07-08 10:35:29 -070040endef
41
Colin Crossdd2ff552014-07-09 22:09:50 -070042DEX2OAT_IMAGE_XMS := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xms)
43DEX2OAT_IMAGE_XMX := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xmx)
44DEX2OAT_XMS := $(call get-product-default-property,dalvik.vm.dex2oat-Xms)
45DEX2OAT_XMX := $(call get-product-default-property,dalvik.vm.dex2oat-Xmx)
Brian Carlstromcffe2892014-07-08 10:35:29 -070046
Nikola Veljkovica57aaa32014-12-23 13:50:18 +010047ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64))
Ian Rogers7d70f832014-07-16 18:06:02 -070048# MIPS specific overrides.
49# For MIPS the ART image is loaded at a lower address. This causes issues
50# with the image overlapping with memory on the host cross-compiling and
51# building the image. We therefore limit the Xmx value. This isn't done
52# via a property as we want the larger Xmx value if we're running on a
53# MIPS device.
54LIBART_IMG_TARGET_BASE_ADDRESS := 0x30000000
Ian Rogers87f0d002014-07-16 22:25:35 -070055DEX2OAT_XMX := 128m
Ian Rogers7d70f832014-07-16 18:06:02 -070056endif
57
Brian Carlstromced4bff2013-11-14 23:44:56 -080058########################################################################
59# The full system boot classpath
60
Ying Wangb9aa5d42014-05-13 13:57:28 -070061# Returns the path to the .odex file
62# $(1): the arch name.
63# $(2): the full path (including file name) of the corresponding .jar or .apk.
64define get-odex-file-path
Richard Uhler820fe322015-03-16 14:38:17 -070065$(dir $(2))oat/$(1)/$(basename $(notdir $(2))).odex
Ying Wangb9aa5d42014-05-13 13:57:28 -070066endef
67
68# Returns the path to the image file (such as "/system/framework/<arch>/boot.art"
69# $(1): the arch name (such as "arm")
70# $(2): the image location (such as "/system/framework/boot.art")
71define get-image-file-path
72$(dir $(2))$(1)/$(notdir $(2))
73endef
74
Brian Carlstromced4bff2013-11-14 23:44:56 -080075# note we use core-libart.jar in place of core.jar for ART.
76LIBART_TARGET_BOOT_JARS := $(patsubst core, core-libart,$(DEXPREOPT_BOOT_JARS_MODULES))
77LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
78LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar)
79
Ying Wangb9aa5d42014-05-13 13:57:28 -070080my_2nd_arch_prefix :=
81include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
Brian Carlstromced4bff2013-11-14 23:44:56 -080082
Ying Wangb9aa5d42014-05-13 13:57:28 -070083ifdef TARGET_2ND_ARCH
84my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
85include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
86my_2nd_arch_prefix :=
87endif
Brian Carlstromced4bff2013-11-14 23:44:56 -080088
89
90########################################################################
91# For a single jar or APK
92
Ying Wangb9aa5d42014-05-13 13:57:28 -070093# $(1): the input .jar or .apk file
94# $(2): the output .odex file
Brian Carlstromced4bff2013-11-14 23:44:56 -080095define dex2oat-one-file
Ying Wangb9aa5d42014-05-13 13:57:28 -070096$(hide) rm -f $(2)
97$(hide) mkdir -p $(dir $(2))
Nicolas Geoffray75c08b22014-10-06 14:53:59 +010098$(hide) $(DEX2OAT) \
Colin Crossdd2ff552014-07-09 22:09:50 -070099 --runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
Ying Wangb9aa5d42014-05-13 13:57:28 -0700100 --boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \
101 --dex-file=$(1) \
102 --dex-location=$(PRIVATE_DEX_LOCATION) \
103 --oat-file=$(2) \
Brian Carlstromced4bff2013-11-14 23:44:56 -0800104 --android-root=$(PRODUCT_OUT)/system \
Ying Wangb9aa5d42014-05-13 13:57:28 -0700105 --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
Ian Rogersa18a2832014-10-17 01:05:50 -0700106 --instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \
Alex Lightce090d32014-07-24 16:26:13 -0700107 --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
David Srbeckyab139752015-05-28 16:32:55 +0100108 --include-patch-information --runtime-arg -Xnorelocate --no-generate-debug-info \
Andreas Gampe06d86e92015-03-05 19:18:18 -0800109 --abort-on-hard-verifier-error \
Ying Wang20ebd2e2014-10-07 18:07:23 -0700110 $(PRIVATE_DEX_PREOPT_FLAGS)
Brian Carlstromced4bff2013-11-14 23:44:56 -0800111endef