2013-11-15 15:44:56 +08:00
|
|
|
####################################
|
|
|
|
# dexpreopt support for ART
|
|
|
|
#
|
|
|
|
####################################
|
|
|
|
|
|
|
|
DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
DEX2OATD := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
|
|
|
|
# By default, do not run rerun dex2oat if the tool changes.
|
|
|
|
# Comment out the | to force dex2oat to rerun on after all changes.
|
|
|
|
DEX2OAT_DEPENDENCY := art/runtime/oat.cc # dependency on oat version number
|
|
|
|
DEX2OAT_DEPENDENCY += art/runtime/image.cc # dependency on image version number
|
|
|
|
DEX2OAT_DEPENDENCY += |
|
|
|
|
DEX2OAT_DEPENDENCY += $(DEX2OAT)
|
|
|
|
|
2014-03-25 19:14:26 +08:00
|
|
|
DEX2OATD_DEPENDENCY := $(DEX2OAT_DEPENDENCY)
|
|
|
|
DEX2OATD_DEPENDENCY += $(DEX2OATD)
|
|
|
|
|
2013-11-15 15:44:56 +08:00
|
|
|
PRELOADED_CLASSES := frameworks/base/preloaded-classes
|
|
|
|
|
2014-10-06 21:53:59 +08:00
|
|
|
# Default to debug version to help find bugs.
|
|
|
|
# Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
|
|
|
|
ifneq ($(USE_DEX2OAT_DEBUG), false)
|
|
|
|
DEX2OAT = $(DEX2OATD)
|
2014-10-07 18:17:09 +08:00
|
|
|
DEX2OAT_DEPENDENCY = $(DEX2OATD_DEPENDENCY)
|
2014-10-06 21:53:59 +08:00
|
|
|
endif
|
|
|
|
|
2013-11-15 15:44:56 +08:00
|
|
|
# start of image reserved address space
|
|
|
|
LIBART_IMG_HOST_BASE_ADDRESS := 0x60000000
|
2014-03-06 06:45:18 +08:00
|
|
|
LIBART_IMG_TARGET_BASE_ADDRESS := 0x70000000
|
2013-11-15 15:44:56 +08:00
|
|
|
|
2014-07-10 13:09:50 +08:00
|
|
|
define get-product-default-property
|
|
|
|
$(strip $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))
|
2014-07-09 01:35:29 +08:00
|
|
|
endef
|
|
|
|
|
2014-07-10 13:09:50 +08:00
|
|
|
DEX2OAT_IMAGE_XMS := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xms)
|
|
|
|
DEX2OAT_IMAGE_XMX := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xmx)
|
|
|
|
DEX2OAT_XMS := $(call get-product-default-property,dalvik.vm.dex2oat-Xms)
|
|
|
|
DEX2OAT_XMX := $(call get-product-default-property,dalvik.vm.dex2oat-Xmx)
|
2014-07-09 01:35:29 +08:00
|
|
|
|
2014-07-17 09:06:02 +08:00
|
|
|
ifeq ($(TARGET_ARCH),mips)
|
|
|
|
# MIPS specific overrides.
|
|
|
|
# For MIPS the ART image is loaded at a lower address. This causes issues
|
|
|
|
# with the image overlapping with memory on the host cross-compiling and
|
|
|
|
# building the image. We therefore limit the Xmx value. This isn't done
|
|
|
|
# via a property as we want the larger Xmx value if we're running on a
|
|
|
|
# MIPS device.
|
|
|
|
LIBART_IMG_TARGET_BASE_ADDRESS := 0x30000000
|
2014-07-17 13:25:35 +08:00
|
|
|
DEX2OAT_XMX := 128m
|
2014-07-17 09:06:02 +08:00
|
|
|
endif
|
|
|
|
|
2013-11-15 15:44:56 +08:00
|
|
|
########################################################################
|
|
|
|
# The full system boot classpath
|
|
|
|
|
2014-05-14 04:57:28 +08:00
|
|
|
# Returns the path to the .odex file
|
|
|
|
# $(1): the arch name.
|
|
|
|
# $(2): the full path (including file name) of the corresponding .jar or .apk.
|
|
|
|
define get-odex-file-path
|
|
|
|
$(dir $(2))$(1)/$(basename $(notdir $(2))).odex
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Returns the path to the image file (such as "/system/framework/<arch>/boot.art"
|
|
|
|
# $(1): the arch name (such as "arm")
|
|
|
|
# $(2): the image location (such as "/system/framework/boot.art")
|
|
|
|
define get-image-file-path
|
|
|
|
$(dir $(2))$(1)/$(notdir $(2))
|
|
|
|
endef
|
|
|
|
|
2013-11-15 15:44:56 +08:00
|
|
|
# note we use core-libart.jar in place of core.jar for ART.
|
|
|
|
LIBART_TARGET_BOOT_JARS := $(patsubst core, core-libart,$(DEXPREOPT_BOOT_JARS_MODULES))
|
|
|
|
LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
|
|
|
|
LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar)
|
|
|
|
|
2014-05-14 04:57:28 +08:00
|
|
|
my_2nd_arch_prefix :=
|
|
|
|
include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
|
|
|
|
|
|
|
|
ifdef TARGET_2ND_ARCH
|
|
|
|
my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
|
|
|
|
include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
|
|
|
|
my_2nd_arch_prefix :=
|
|
|
|
endif
|
2013-11-15 15:44:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# For a single jar or APK
|
|
|
|
|
2014-05-14 04:57:28 +08:00
|
|
|
# $(1): the input .jar or .apk file
|
|
|
|
# $(2): the output .odex file
|
2013-11-15 15:44:56 +08:00
|
|
|
define dex2oat-one-file
|
2014-05-14 04:57:28 +08:00
|
|
|
$(hide) rm -f $(2)
|
|
|
|
$(hide) mkdir -p $(dir $(2))
|
2014-10-06 21:53:59 +08:00
|
|
|
$(hide) $(DEX2OAT) \
|
2014-07-10 13:09:50 +08:00
|
|
|
--runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
|
2014-05-14 04:57:28 +08:00
|
|
|
--boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \
|
|
|
|
--dex-file=$(1) \
|
|
|
|
--dex-location=$(PRIVATE_DEX_LOCATION) \
|
|
|
|
--oat-file=$(2) \
|
2013-11-15 15:44:56 +08:00
|
|
|
--android-root=$(PRODUCT_OUT)/system \
|
2014-05-14 04:57:28 +08:00
|
|
|
--instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
|
2014-10-17 16:05:50 +08:00
|
|
|
--instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \
|
2014-07-25 07:26:13 +08:00
|
|
|
--instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
|
2014-10-08 09:07:23 +08:00
|
|
|
--include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols \
|
|
|
|
$(PRIVATE_DEX_PREOPT_FLAGS)
|
2013-11-15 15:44:56 +08:00
|
|
|
endef
|