1 # Copyright (C) 2008 The Android Open Source Project
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
16 # Android.mk for Dalvik VM. If you enable or disable optional features here,
17 # rebuild the VM with "make clean-libdvm && make -j4 libdvm".
19 LOCAL_PATH:= $(call my-dir)
26 LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps
29 # Optional features. These may impact the size or performance of the VM.
31 LOCAL_CFLAGS += -DWITH_PROFILER -DWITH_DEBUGGER
33 # 0=full cache, 1/2=reduced, 3=no cache
34 LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0
36 ifeq ($(WITH_DEADLOCK_PREDICTION),true)
37 LOCAL_CFLAGS += -DWITH_DEADLOCK_PREDICTION
38 WITH_MONITOR_TRACKING := true
40 ifeq ($(WITH_MONITOR_TRACKING),true)
41 LOCAL_CFLAGS += -DWITH_MONITOR_TRACKING
44 # Make DEBUG_DALVIK_VM default to true when building the simulator.
45 ifeq ($(TARGET_SIMULATOR),true)
46 ifeq ($(strip $(DEBUG_DALVIK_VM)),)
47 DEBUG_DALVIK_VM := true
51 ifeq ($(strip $(DEBUG_DALVIK_VM)),true)
56 # - tracked-reference verification enabled
57 # - allocation limits enabled
58 # - GDB helpers enabled
62 LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
63 LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
64 LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
65 LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS
66 LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
67 #LOCAL_CFLAGS += -DCHECK_MUTEX
68 #LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS
69 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
70 # add some extra stuff to make it easier to examine with GDB
71 LOCAL_CFLAGS += -DEASY_GDB
72 # overall config may be for a "release" build, so reconfigure these
73 LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
74 else # !DALVIK_VM_DEBUG
76 # "Performance" profile:
77 # - all development features disabled
78 # - compiler optimizations enabled (redundant for "release" builds)
79 # - (debugging and profiling still enabled)
81 #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
82 # "-O2" is redundant for device (release) but useful for sim (debug)
83 #LOCAL_CFLAGS += -O2 -Winline
84 #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
85 LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
86 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
87 # if you want to try with assertions on the device, add:
88 #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
89 endif # !DALVIK_VM_DEBUG
91 # bug hunting: checksum and verify interpreted stack when making JNI calls
92 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
103 IndirectRefTable.c.arm \
125 alloc/HeapBitmap.c.arm \
131 alloc/MarkSweep.c.arm \
133 analysis/CodeVerify.c \
134 analysis/DexOptimize.c \
135 analysis/DexVerify.c \
136 analysis/ReduceConstants.c \
137 analysis/RegisterMap.c \
138 analysis/VerifySubs.c \
139 interp/Interp.c.arm \
143 jdwp/JdwpConstants.c \
149 mterp/out/InterpC-portstd.c.arm \
150 mterp/out/InterpC-portdbg.c.arm \
151 native/InternalNative.c \
152 native/dalvik_system_DexFile.c \
153 native/dalvik_system_VMDebug.c \
154 native/dalvik_system_VMRuntime.c \
155 native/dalvik_system_VMStack.c \
156 native/dalvik_system_Zygote.c \
157 native/java_lang_Class.c \
158 native/java_lang_Object.c \
159 native/java_lang_Runtime.c \
160 native/java_lang_String.c \
161 native/java_lang_System.c \
162 native/java_lang_SystemProperties.c \
163 native/java_lang_Throwable.c \
164 native/java_lang_VMClassLoader.c \
165 native/java_lang_VMThread.c \
166 native/java_lang_reflect_AccessibleObject.c \
167 native/java_lang_reflect_Array.c \
168 native/java_lang_reflect_Constructor.c \
169 native/java_lang_reflect_Field.c \
170 native/java_lang_reflect_Method.c \
171 native/java_lang_reflect_Proxy.c \
172 native/java_security_AccessController.c \
173 native/java_util_concurrent_atomic_AtomicLong.c \
174 native/org_apache_harmony_dalvik_NativeTestTarget.c \
175 native/org_apache_harmony_dalvik_ddmc_DdmServer.c \
176 native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \
177 native/sun_misc_Unsafe.c \
184 reflect/Annotation.c \
189 test/TestIndirectRefTable.c
191 ifeq ($(WITH_JIT_TUNING),true)
192 LOCAL_CFLAGS += -DWITH_JIT_TUNING
195 ifeq ($(WITH_JIT),true)
196 # NOTE: Turn on assertion for JIT for now
197 LOCAL_CFLAGS += -DWITH_DALVIK_ASSERT
198 # NOTE: Also turn on tuning when JIT is enabled for now
199 LOCAL_CFLAGS += -DWITH_JIT_TUNING
200 LOCAL_CFLAGS += -DWITH_JIT
202 ../dexdump/OpCodeNames.c \
203 compiler/Compiler.c \
204 compiler/Frontend.c \
206 compiler/IntermediateRep.c \
210 WITH_HPROF := $(strip $(WITH_HPROF))
211 ifeq ($(WITH_HPROF),)
214 ifeq ($(WITH_HPROF),true)
219 hprof/HprofOutput.c \
221 LOCAL_CFLAGS += -DWITH_HPROF=1
223 ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true)
224 LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1
227 ifeq ($(strip $(WITH_HPROF_STACK)),true)
230 hprof/HprofStackFrame.c
231 LOCAL_CFLAGS += -DWITH_HPROF_STACK=1
232 endif # WITH_HPROF_STACK
235 ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true)
236 LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1
239 LOCAL_C_INCLUDES += \
247 ifeq ($(TARGET_SIMULATOR),true)
248 LOCAL_LDLIBS += -lpthread -ldl
249 ifeq ($(HOST_OS),linux)
250 # need this for clock_gettime() in profiling
254 LOCAL_SHARED_LIBRARIES += libdl
257 MTERP_ARCH_KNOWN := false
259 ifeq ($(TARGET_ARCH),arm)
260 #TARGET_ARCH_VARIANT := armv7-a
261 #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp
262 MTERP_ARCH_KNOWN := true
263 # Select architecture-specific sources (armv4t, armv5te etc.)
265 arch/arm/CallOldABI.S \
266 arch/arm/CallEABI.S \
267 arch/arm/HintsEABI.c \
268 mterp/out/InterpC-$(TARGET_ARCH_VARIANT).c.arm \
269 mterp/out/InterpAsm-$(TARGET_ARCH_VARIANT).S
271 ifeq ($(WITH_JIT),true)
273 compiler/codegen/arm/Codegen-$(TARGET_ARCH_VARIANT).c \
274 compiler/codegen/arm/Assemble.c \
275 compiler/codegen/arm/ArchUtility.c \
276 compiler/codegen/arm/LocalOptimizations.c \
277 compiler/codegen/arm/GlobalOptimizations.c \
278 compiler/template/out/CompilerTemplateAsm-$(TARGET_ARCH_VARIANT).S
282 ifeq ($(TARGET_ARCH),x86)
283 MTERP_ARCH_KNOWN := true
285 arch/x86/Call386ABI.S \
286 arch/x86/Hints386ABI.c \
287 mterp/out/InterpC-x86.c \
288 mterp/out/InterpAsm-x86.S
291 ifeq ($(TARGET_ARCH),sh)
292 MTERP_ARCH_KNOWN := true
294 arch/sh/CallSH4ABI.S \
295 arch/generic/Hints.c \
296 mterp/out/InterpC-allstubs.c \
297 mterp/out/InterpAsm-allstubs.S
300 ifeq ($(MTERP_ARCH_KNOWN),false)
301 # unknown architecture, try to use FFI
302 LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH)
303 LOCAL_SHARED_LIBRARIES += libffi
306 arch/generic/Call.c \
307 arch/generic/Hints.c \
308 mterp/out/InterpC-allstubs.c \
309 mterp/out/InterpAsm-allstubs.S
313 LOCAL_MODULE := libdvm
315 LOCAL_SHARED_LIBRARIES += \
321 LOCAL_STATIC_LIBRARIES += \
324 include $(BUILD_SHARED_LIBRARY)