2013-11-15 08:44:56 +01:00
|
|
|
####################################
|
|
|
|
# dexpreopt support for ART
|
|
|
|
#
|
|
|
|
####################################
|
|
|
|
|
2015-07-27 21:48:39 +02:00
|
|
|
# Default to debug version to help find bugs.
|
|
|
|
# Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
|
|
|
|
ifeq ($(USE_DEX2OAT_DEBUG),false)
|
2013-11-15 08:44:56 +01:00
|
|
|
DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oat$(HOST_EXECUTABLE_SUFFIX)
|
2015-07-27 21:48:39 +02:00
|
|
|
else
|
|
|
|
DEX2OAT := $(HOST_OUT_EXECUTABLES)/dex2oatd$(HOST_EXECUTABLE_SUFFIX)
|
|
|
|
endif
|
2013-11-15 08:44:56 +01:00
|
|
|
|
2016-06-14 01:53:11 +02:00
|
|
|
# Pass special classpath to skip uses library check.
|
|
|
|
# Should modify build system to pass used libraries properly later.
|
|
|
|
DEX2OAT_CLASSPATH := "&"
|
|
|
|
|
2013-11-15 08:44:56 +01:00
|
|
|
DEX2OAT_DEPENDENCY += $(DEX2OAT)
|
|
|
|
|
2014-11-14 00:19:12 +01:00
|
|
|
# Use the first preloaded-classes file in PRODUCT_COPY_FILES.
|
|
|
|
PRELOADED_CLASSES := $(call word-colon,1,$(firstword \
|
|
|
|
$(filter %system/etc/preloaded-classes,$(PRODUCT_COPY_FILES))))
|
2013-11-15 08:44:56 +01:00
|
|
|
|
2014-11-18 20:45:10 +01:00
|
|
|
# Use the first compiled-classes file in PRODUCT_COPY_FILES.
|
|
|
|
COMPILED_CLASSES := $(call word-colon,1,$(firstword \
|
|
|
|
$(filter %system/etc/compiled-classes,$(PRODUCT_COPY_FILES))))
|
|
|
|
|
2014-07-10 07:09:50 +02:00
|
|
|
define get-product-default-property
|
|
|
|
$(strip $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))
|
2014-07-08 19:35:29 +02:00
|
|
|
endef
|
|
|
|
|
2014-07-10 07:09:50 +02: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-08 19:35:29 +02:00
|
|
|
|
2014-12-23 13:50:18 +01:00
|
|
|
ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64))
|
2014-07-17 03:06:02 +02:00
|
|
|
# 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.
|
2014-07-17 07:25:35 +02:00
|
|
|
DEX2OAT_XMX := 128m
|
2014-07-17 03:06:02 +02:00
|
|
|
endif
|
|
|
|
|
2013-11-15 08:44:56 +01:00
|
|
|
########################################################################
|
|
|
|
# The full system boot classpath
|
|
|
|
|
2014-05-13 22:57:28 +02: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
|
2015-03-16 22:38:17 +01:00
|
|
|
$(dir $(2))oat/$(1)/$(basename $(notdir $(2))).odex
|
2014-05-13 22:57:28 +02:00
|
|
|
endef
|
|
|
|
|
2016-06-16 23:47:10 +02:00
|
|
|
# Returns the full path to the installed .odex file.
|
|
|
|
# This handles BOARD_USES_SYSTEM_OTHER_ODEX to install odex files into another
|
|
|
|
# partition.
|
|
|
|
# $(1): the arch name.
|
|
|
|
# $(2): the full install path (including file name) of the corresponding .apk.
|
|
|
|
ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
|
|
|
|
define get-odex-installed-file-path
|
|
|
|
$(if $(filter $(foreach f,$(SYSTEM_OTHER_ODEX_FILTER),$(TARGET_OUT)/$(f)),$(2)),
|
|
|
|
$(call get-odex-file-path,$(1),$(patsubst $(TARGET_OUT)/%,$(TARGET_OUT_SYSTEM_OTHER)/%,$(2))),
|
|
|
|
$(call get-odex-file-path,$(1),$(2)))
|
|
|
|
endef
|
|
|
|
else
|
|
|
|
get-odex-installed-file-path = $(get-odex-file-path)
|
|
|
|
endif
|
|
|
|
|
2014-05-13 22:57:28 +02:00
|
|
|
# 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 08:44:56 +01: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)
|
|
|
|
|
2016-03-08 22:21:49 +01:00
|
|
|
# dex preopt on the bootclasspath produces multiple files. The first dex file
|
|
|
|
# is converted into to boot.art (to match the legacy assumption that boot.art
|
|
|
|
# exists), and the rest are converted to boot-<name>.art.
|
|
|
|
# In addition, each .art file has an associated .oat file.
|
2016-08-25 14:50:15 +02:00
|
|
|
LIBART_TARGET_BOOT_ART_EXTRA_FILES := $(foreach jar,$(wordlist 2,999,$(LIBART_TARGET_BOOT_JARS)),boot-$(jar).art boot-$(jar).oat boot-$(jar).vdex)
|
|
|
|
LIBART_TARGET_BOOT_ART_EXTRA_FILES += boot.oat boot.vdex
|
2016-03-08 22:21:49 +01:00
|
|
|
|
2014-05-13 22:57:28 +02:00
|
|
|
my_2nd_arch_prefix :=
|
|
|
|
include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
|
|
|
|
|
2016-03-17 03:53:19 +01:00
|
|
|
ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
|
2014-05-13 22:57:28 +02:00
|
|
|
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
|
2016-03-17 03:53:19 +01:00
|
|
|
endif
|
2013-11-15 08:44:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# For a single jar or APK
|
|
|
|
|
2014-05-13 22:57:28 +02:00
|
|
|
# $(1): the input .jar or .apk file
|
|
|
|
# $(2): the output .odex file
|
2013-11-15 08:44:56 +01:00
|
|
|
define dex2oat-one-file
|
2014-05-13 22:57:28 +02:00
|
|
|
$(hide) rm -f $(2)
|
|
|
|
$(hide) mkdir -p $(dir $(2))
|
2016-03-09 23:48:46 +01:00
|
|
|
$(hide) ANDROID_LOG_TAGS="*:e" $(DEX2OAT) \
|
2014-07-10 07:09:50 +02:00
|
|
|
--runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
|
2016-06-14 01:53:11 +02:00
|
|
|
--runtime-arg -classpath --runtime-arg $(DEX2OAT_CLASSPATH) \
|
2014-05-13 22:57:28 +02:00
|
|
|
--boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \
|
|
|
|
--dex-file=$(1) \
|
|
|
|
--dex-location=$(PRIVATE_DEX_LOCATION) \
|
|
|
|
--oat-file=$(2) \
|
2013-11-15 08:44:56 +01:00
|
|
|
--android-root=$(PRODUCT_OUT)/system \
|
2014-05-13 22:57:28 +02:00
|
|
|
--instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
|
2014-10-17 10:05:50 +02:00
|
|
|
--instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \
|
2014-07-25 01:26:13 +02:00
|
|
|
--instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
|
2016-12-05 12:47:02 +01:00
|
|
|
--include-patch-information --runtime-arg -Xnorelocate --compile-pic \
|
2016-09-19 19:54:21 +02:00
|
|
|
--no-generate-debug-info --generate-build-id \
|
2015-03-06 04:18:18 +01:00
|
|
|
--abort-on-hard-verifier-error \
|
2015-12-17 02:20:11 +01:00
|
|
|
--no-inline-from=core-oj.jar \
|
2016-03-11 19:32:01 +01:00
|
|
|
$(PRIVATE_DEX_PREOPT_FLAGS) \
|
|
|
|
$(GLOBAL_DEXPREOPT_FLAGS)
|
2013-11-15 08:44:56 +01:00
|
|
|
endef
|