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 # Common definitions for host or target builds of libdvm.
18 # If you enable or disable optional features here, make sure you do
19 # a "clean" build -- not everything depends on Dalvik.h. (See Android.mk
20 # for the exact command.)
27 LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps
28 #LOCAL_CFLAGS += -DUSE_INDIRECT_REF
31 # Optional features. These may impact the size or performance of the VM.
33 LOCAL_CFLAGS += -DWITH_PROFILER -DWITH_DEBUGGER
35 # 0=full cache, 1/2=reduced, 3=no cache
36 LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0
38 ifeq ($(WITH_DEADLOCK_PREDICTION),true)
39 LOCAL_CFLAGS += -DWITH_DEADLOCK_PREDICTION
40 WITH_MONITOR_TRACKING := true
42 ifeq ($(WITH_MONITOR_TRACKING),true)
43 LOCAL_CFLAGS += -DWITH_MONITOR_TRACKING
46 # Make a debugging version when building the simulator (if not told
47 # otherwise) and when explicitly asked.
48 dvm_make_debug_vm := false
49 ifeq ($(strip $(DEBUG_DALVIK_VM)),)
50 ifeq ($(dvm_simulator),true)
51 dvm_make_debug_vm := true
54 dvm_make_debug_vm := $(DEBUG_DALVIK_VM)
57 ifeq ($(dvm_make_debug_vm),true)
62 # - tracked-reference verification enabled
63 # - allocation limits enabled
64 # - GDB helpers enabled
68 LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
69 LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
70 LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
71 LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS
72 LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
73 #LOCAL_CFLAGS += -DCHECK_MUTEX
74 #LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS
75 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
76 # add some extra stuff to make it easier to examine with GDB
77 LOCAL_CFLAGS += -DEASY_GDB
78 # overall config may be for a "release" build, so reconfigure these
79 LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
80 else # !dvm_make_debug_vm
82 # "Performance" profile:
83 # - all development features disabled
84 # - compiler optimizations enabled (redundant for "release" builds)
85 # - (debugging and profiling still enabled)
87 #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
88 # "-O2" is redundant for device (release) but useful for sim (debug)
89 #LOCAL_CFLAGS += -O2 -Winline
90 #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
91 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
92 # if you want to try with assertions on the device, add:
93 #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
94 endif # !dvm_make_debug_vm
96 # bug hunting: checksum and verify interpreted stack when making JNI calls
97 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
108 IndirectRefTable.c.arm \
131 alloc/HeapBitmap.c.arm \
137 alloc/MarkSweep.c.arm \
139 analysis/CodeVerify.c \
140 analysis/DexOptimize.c \
141 analysis/DexVerify.c \
142 analysis/ReduceConstants.c \
143 analysis/RegisterMap.c \
144 analysis/VerifySubs.c \
145 interp/Interp.c.arm \
149 jdwp/JdwpConstants.c \
155 mterp/out/InterpC-portstd.c.arm \
156 mterp/out/InterpC-portdbg.c.arm \
157 native/InternalNative.c \
158 native/dalvik_system_DexFile.c \
159 native/dalvik_system_SamplingProfiler.c \
160 native/dalvik_system_VMDebug.c \
161 native/dalvik_system_VMRuntime.c \
162 native/dalvik_system_VMStack.c \
163 native/dalvik_system_Zygote.c \
164 native/java_lang_Class.c \
165 native/java_lang_Object.c \
166 native/java_lang_Runtime.c \
167 native/java_lang_String.c \
168 native/java_lang_System.c \
169 native/java_lang_SystemProperties.c \
170 native/java_lang_Throwable.c \
171 native/java_lang_VMClassLoader.c \
172 native/java_lang_VMThread.c \
173 native/java_lang_reflect_AccessibleObject.c \
174 native/java_lang_reflect_Array.c \
175 native/java_lang_reflect_Constructor.c \
176 native/java_lang_reflect_Field.c \
177 native/java_lang_reflect_Method.c \
178 native/java_lang_reflect_Proxy.c \
179 native/java_security_AccessController.c \
180 native/java_util_concurrent_atomic_AtomicLong.c \
181 native/org_apache_harmony_dalvik_NativeTestTarget.c \
182 native/org_apache_harmony_dalvik_ddmc_DdmServer.c \
183 native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \
184 native/sun_misc_Unsafe.c \
185 native/SystemThread.c \
192 reflect/Annotation.c \
197 test/TestIndirectRefTable.c
199 WITH_JIT := $(strip $(WITH_JIT))
201 ifeq ($(WITH_JIT),true)
202 LOCAL_CFLAGS += -DWITH_JIT
204 ../dexdump/OpCodeNames.c \
205 compiler/Compiler.c \
206 compiler/Frontend.c \
208 compiler/IntermediateRep.c \
209 compiler/Dataflow.c \
215 WITH_HPROF := $(strip $(WITH_HPROF))
216 ifeq ($(WITH_HPROF),)
219 ifeq ($(WITH_HPROF),true)
224 hprof/HprofOutput.c \
226 LOCAL_CFLAGS += -DWITH_HPROF=1
228 ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true)
229 LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1
232 ifeq ($(strip $(WITH_HPROF_STACK)),true)
235 hprof/HprofStackFrame.c
236 LOCAL_CFLAGS += -DWITH_HPROF_STACK=1
237 endif # WITH_HPROF_STACK
240 ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true)
241 LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1
244 LOCAL_C_INCLUDES += \
252 ifeq ($(dvm_simulator),true)
253 LOCAL_LDLIBS += -lpthread -ldl
254 ifeq ($(HOST_OS),linux)
255 # need this for clock_gettime() in profiling
259 ifeq ($(dvm_os),linux)
260 LOCAL_SHARED_LIBRARIES += libdl
264 MTERP_ARCH_KNOWN := false
266 ifeq ($(dvm_arch),arm)
267 #dvm_arch_variant := armv7-a
268 #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp
269 MTERP_ARCH_KNOWN := true
270 # Select architecture-specific sources (armv4t, armv5te etc.)
272 arch/arm/CallOldABI.S \
273 arch/arm/CallEABI.S \
274 arch/arm/HintsEABI.c \
275 mterp/out/InterpC-$(dvm_arch_variant).c.arm \
276 mterp/out/InterpAsm-$(dvm_arch_variant).S
278 ifeq ($(WITH_JIT),true)
280 compiler/codegen/arm/RallocUtil.c \
281 compiler/codegen/arm/$(dvm_arch_variant)/Codegen.c \
282 compiler/codegen/arm/$(dvm_arch_variant)/CallingConvention.S \
283 compiler/codegen/arm/Assemble.c \
284 compiler/codegen/arm/ArchUtility.c \
285 compiler/codegen/arm/LocalOptimizations.c \
286 compiler/codegen/arm/GlobalOptimizations.c \
287 compiler/template/out/CompilerTemplateAsm-$(dvm_arch_variant).S
291 ifeq ($(dvm_arch),x86)
292 ifeq ($(dvm_os),linux)
293 MTERP_ARCH_KNOWN := true
295 arch/x86/Call386ABI.S \
296 arch/x86/Hints386ABI.c \
297 mterp/out/InterpC-x86.c \
298 mterp/out/InterpAsm-x86.S
302 ifeq ($(dvm_arch),sh)
303 MTERP_ARCH_KNOWN := true
305 arch/sh/CallSH4ABI.S \
306 arch/generic/Hints.c \
307 mterp/out/InterpC-allstubs.c \
308 mterp/out/InterpAsm-allstubs.S
311 ifeq ($(MTERP_ARCH_KNOWN),false)
312 # unknown architecture, try to use FFI
313 LOCAL_C_INCLUDES += external/libffi/$(dvm_os)-$(dvm_arch)
315 ifeq ($(dvm_os)-$(dvm_arch),darwin-x86)
316 # OSX includes libffi, so just make the linker aware of it directly.
317 LOCAL_LDLIBS += -lffi
319 LOCAL_SHARED_LIBRARIES += libffi
323 arch/generic/Call.c \
324 arch/generic/Hints.c \
325 mterp/out/InterpC-allstubs.c
327 # The following symbols are usually defined in the asm file, but
328 # since we don't have an asm file in this case, we instead just
329 # peg them at 0 here, and we add an #ifdef'able define for good
331 LOCAL_CFLAGS += -DdvmAsmInstructionStart=0 -DdvmAsmInstructionEnd=0 \
332 -DdvmAsmSisterStart=0 -DdvmAsmSisterEnd=0 -DDVM_NO_ASM_INTERP=1
335 ifeq ($(TEST_VM_IN_ECLAIR),true)
336 LOCAL_CFLAGS += -DTEST_VM_IN_ECLAIR