OSDN Git Service

[DO NOT MERGE] Updating Security String to 2017-03-01 on lmp-dev am: 28dae4b62b ...
[android-x86/build.git] / core / dex_preopt_libart.mk
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 # By default, do not run rerun dex2oat if the tool changes.
10 # Comment out the | to force dex2oat to rerun on after all changes.
11 DEX2OAT_DEPENDENCY := art/runtime/oat.cc # dependency on oat version number
12 DEX2OAT_DEPENDENCY += art/runtime/image.cc # dependency on image version number
13 DEX2OAT_DEPENDENCY += |
14 DEX2OAT_DEPENDENCY += $(DEX2OAT)
15
16 DEX2OATD_DEPENDENCY := $(DEX2OAT_DEPENDENCY)
17 DEX2OATD_DEPENDENCY += $(DEX2OATD)
18
19 # Use the first preloaded-classes file in PRODUCT_COPY_FILES.
20 PRELOADED_CLASSES := $(call word-colon,1,$(firstword \
21     $(filter %system/etc/preloaded-classes,$(PRODUCT_COPY_FILES))))
22
23 # Use the first compiled-classes file in PRODUCT_COPY_FILES.
24 COMPILED_CLASSES := $(call word-colon,1,$(firstword \
25     $(filter %system/etc/compiled-classes,$(PRODUCT_COPY_FILES))))
26
27 # Default to debug version to help find bugs.
28 # Set USE_DEX2OAT_DEBUG to false for only building non-debug versions.
29 ifneq ($(USE_DEX2OAT_DEBUG), false)
30 DEX2OAT = $(DEX2OATD)
31 DEX2OAT_DEPENDENCY = $(DEX2OATD_DEPENDENCY)
32 endif
33
34 # start of image reserved address space
35 LIBART_IMG_HOST_BASE_ADDRESS   := 0x60000000
36 LIBART_IMG_TARGET_BASE_ADDRESS := 0x70000000
37
38 define get-product-default-property
39 $(strip $(patsubst $(1)=%,%,$(filter $(1)=%,$(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))))
40 endef
41
42 DEX2OAT_IMAGE_XMS := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xms)
43 DEX2OAT_IMAGE_XMX := $(call get-product-default-property,dalvik.vm.image-dex2oat-Xmx)
44 DEX2OAT_XMS := $(call get-product-default-property,dalvik.vm.dex2oat-Xms)
45 DEX2OAT_XMX := $(call get-product-default-property,dalvik.vm.dex2oat-Xmx)
46
47 ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),mips mips64))
48 # 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.
54 LIBART_IMG_TARGET_BASE_ADDRESS := 0x30000000
55 DEX2OAT_XMX := 128m
56 endif
57
58 ########################################################################
59 # The full system boot classpath
60
61 # 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.
64 define get-odex-file-path
65 $(dir $(2))oat/$(1)/$(basename $(notdir $(2))).odex
66 endef
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")
71 define get-image-file-path
72 $(dir $(2))$(1)/$(notdir $(2))
73 endef
74
75 # note we use core-libart.jar in place of core.jar for ART.
76 LIBART_TARGET_BOOT_JARS := $(patsubst core, core-libart,$(DEXPREOPT_BOOT_JARS_MODULES))
77 LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
78 LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar)
79
80 my_2nd_arch_prefix :=
81 include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
82
83 ifdef TARGET_2ND_ARCH
84 my_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
85 include $(BUILD_SYSTEM)/dex_preopt_libart_boot.mk
86 my_2nd_arch_prefix :=
87 endif
88
89
90 ########################################################################
91 # For a single jar or APK
92
93 # $(1): the input .jar or .apk file
94 # $(2): the output .odex file
95 define dex2oat-one-file
96 $(hide) rm -f $(2)
97 $(hide) mkdir -p $(dir $(2))
98 $(hide) $(DEX2OAT) \
99         --runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
100         --boot-image=$(PRIVATE_DEX_PREOPT_IMAGE_LOCATION) \
101         --dex-file=$(1) \
102         --dex-location=$(PRIVATE_DEX_LOCATION) \
103         --oat-file=$(2) \
104         --android-root=$(PRODUCT_OUT)/system \
105         --instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
106         --instruction-set-variant=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT) \
107         --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
108         --include-patch-information --runtime-arg -Xnorelocate --no-generate-debug-info \
109         --abort-on-hard-verifier-error \
110         $(PRIVATE_DEX_PREOPT_FLAGS)
111 endef