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,
19 # rebuild the VM with "make clean-libdvm && make -j4 libdvm".
26 LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps
27 #LOCAL_CFLAGS += -DUSE_INDIRECT_REF
30 # Optional features. These may impact the size or performance of the VM.
32 LOCAL_CFLAGS += -DWITH_PROFILER -DWITH_DEBUGGER
34 # 0=full cache, 1/2=reduced, 3=no cache
35 LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0
37 ifeq ($(WITH_DEADLOCK_PREDICTION),true)
38 LOCAL_CFLAGS += -DWITH_DEADLOCK_PREDICTION
39 WITH_MONITOR_TRACKING := true
41 ifeq ($(WITH_MONITOR_TRACKING),true)
42 LOCAL_CFLAGS += -DWITH_MONITOR_TRACKING
45 # Make a debugging version when building the simulator (if not told
46 # otherwise) and when explicitly asked.
47 dvm_make_debug_vm := false
48 ifeq ($(strip $(DEBUG_DALVIK_VM)),)
49 ifeq ($(dvm_simulator),true)
50 dvm_make_debug_vm := true
53 dvm_make_debug_vm := $(DEBUG_DALVIK_VM)
56 ifeq ($(dvm_make_debug_vm),true)
61 # - tracked-reference verification enabled
62 # - allocation limits enabled
63 # - GDB helpers enabled
67 LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
68 LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
69 LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
70 LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS
71 LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
72 #LOCAL_CFLAGS += -DCHECK_MUTEX
73 #LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS
74 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
75 # add some extra stuff to make it easier to examine with GDB
76 LOCAL_CFLAGS += -DEASY_GDB
77 # overall config may be for a "release" build, so reconfigure these
78 LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
79 else # !dvm_make_debug_vm
81 # "Performance" profile:
82 # - all development features disabled
83 # - compiler optimizations enabled (redundant for "release" builds)
84 # - (debugging and profiling still enabled)
86 #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
87 # "-O2" is redundant for device (release) but useful for sim (debug)
88 #LOCAL_CFLAGS += -O2 -Winline
89 #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
90 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
91 # if you want to try with assertions on the device, add:
92 #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
93 endif # !dvm_make_debug_vm
95 # bug hunting: checksum and verify interpreted stack when making JNI calls
96 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
107 IndirectRefTable.c.arm \
129 alloc/HeapBitmap.c.arm \
135 alloc/MarkSweep.c.arm \
137 analysis/CodeVerify.c \
138 analysis/DexOptimize.c \
139 analysis/DexVerify.c \
140 analysis/ReduceConstants.c \
141 analysis/RegisterMap.c \
142 analysis/VerifySubs.c \
143 interp/Interp.c.arm \
147 jdwp/JdwpConstants.c \
153 mterp/out/InterpC-portstd.c.arm \
154 mterp/out/InterpC-portdbg.c.arm \
155 native/InternalNative.c \
156 native/dalvik_system_DexFile.c \
157 native/dalvik_system_SamplingProfiler.c \
158 native/dalvik_system_VMDebug.c \
159 native/dalvik_system_VMRuntime.c \
160 native/dalvik_system_VMStack.c \
161 native/dalvik_system_Zygote.c \
162 native/java_lang_Class.c \
163 native/java_lang_Object.c \
164 native/java_lang_Runtime.c \
165 native/java_lang_String.c \
166 native/java_lang_System.c \
167 native/java_lang_SystemProperties.c \
168 native/java_lang_Throwable.c \
169 native/java_lang_VMClassLoader.c \
170 native/java_lang_VMThread.c \
171 native/java_lang_reflect_AccessibleObject.c \
172 native/java_lang_reflect_Array.c \
173 native/java_lang_reflect_Constructor.c \
174 native/java_lang_reflect_Field.c \
175 native/java_lang_reflect_Method.c \
176 native/java_lang_reflect_Proxy.c \
177 native/java_security_AccessController.c \
178 native/java_util_concurrent_atomic_AtomicLong.c \
179 native/org_apache_harmony_dalvik_NativeTestTarget.c \
180 native/org_apache_harmony_dalvik_ddmc_DdmServer.c \
181 native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \
182 native/sun_misc_Unsafe.c \
183 native/SystemThread.c \
190 reflect/Annotation.c \
195 test/TestIndirectRefTable.c
197 WITH_JIT := $(strip $(WITH_JIT))
199 ifeq ($(WITH_JIT),true)
200 LOCAL_CFLAGS += -DWITH_JIT
201 # Enable assert and JIT_TUNING for now
202 LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
203 WITH_JIT_TUNING := true
205 ../dexdump/OpCodeNames.c \
206 compiler/Compiler.c \
207 compiler/Frontend.c \
209 compiler/IntermediateRep.c \
210 compiler/Dataflow.c \
216 ifeq ($(strip $(WITH_JIT_TUNING)),true)
217 LOCAL_CFLAGS += -DWITH_JIT_TUNING
220 # Enable JIT self verification tool. Runs compiled traces natively, then replays
221 # them with the interpreter, and ensures memory and register state are the same.
222 ifeq ($(WITH_SELF_VERIFICATION),true)
223 LOCAL_CFLAGS += -DWITH_SELF_VERIFICATION
226 WITH_HPROF := $(strip $(WITH_HPROF))
227 ifeq ($(WITH_HPROF),)
230 ifeq ($(WITH_HPROF),true)
235 hprof/HprofOutput.c \
237 LOCAL_CFLAGS += -DWITH_HPROF=1
239 ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true)
240 LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1
243 ifeq ($(strip $(WITH_HPROF_STACK)),true)
246 hprof/HprofStackFrame.c
247 LOCAL_CFLAGS += -DWITH_HPROF_STACK=1
248 endif # WITH_HPROF_STACK
251 ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true)
252 LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1
255 LOCAL_C_INCLUDES += \
263 ifeq ($(dvm_simulator),true)
264 LOCAL_LDLIBS += -lpthread -ldl
265 ifeq ($(HOST_OS),linux)
266 # need this for clock_gettime() in profiling
270 ifeq ($(dvm_os),linux)
271 LOCAL_SHARED_LIBRARIES += libdl
275 MTERP_ARCH_KNOWN := false
277 ifeq ($(dvm_arch),arm)
278 #dvm_arch_variant := armv7-a
279 #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp
280 MTERP_ARCH_KNOWN := true
281 # Select architecture-specific sources (armv4t, armv5te etc.)
283 arch/arm/CallOldABI.S \
284 arch/arm/CallEABI.S \
285 arch/arm/HintsEABI.c \
286 mterp/out/InterpC-$(dvm_arch_variant).c.arm \
287 mterp/out/InterpAsm-$(dvm_arch_variant).S
289 ifeq ($(WITH_JIT),true)
291 compiler/codegen/arm/Codegen-$(dvm_arch_variant).c \
292 compiler/codegen/arm/Assemble.c \
293 compiler/codegen/arm/ArchUtility.c \
294 compiler/codegen/arm/LocalOptimizations.c \
295 compiler/codegen/arm/GlobalOptimizations.c \
296 compiler/template/out/CompilerTemplateAsm-$(dvm_arch_variant).S
300 ifeq ($(dvm_arch),x86)
301 ifeq ($(dvm_os),linux)
302 MTERP_ARCH_KNOWN := true
304 arch/x86/Call386ABI.S \
305 arch/x86/Hints386ABI.c \
306 mterp/out/InterpC-x86.c \
307 mterp/out/InterpAsm-x86.S
311 ifeq ($(dvm_arch),sh)
312 MTERP_ARCH_KNOWN := true
314 arch/sh/CallSH4ABI.S \
315 arch/generic/Hints.c \
316 mterp/out/InterpC-allstubs.c \
317 mterp/out/InterpAsm-allstubs.S
320 ifeq ($(MTERP_ARCH_KNOWN),false)
321 # unknown architecture, try to use FFI
322 LOCAL_C_INCLUDES += external/libffi/$(dvm_os)-$(dvm_arch)
324 ifeq ($(dvm_os)-$(dvm_arch),darwin-x86)
325 # OSX includes libffi, so just make the linker aware of it directly.
326 LOCAL_LDLIBS += -lffi
328 LOCAL_SHARED_LIBRARIES += libffi
332 arch/generic/Call.c \
333 arch/generic/Hints.c \
334 mterp/out/InterpC-allstubs.c
336 # The following symbols are usually defined in the asm file, but
337 # since we don't have an asm file in this case, we instead just
338 # peg them at 0 here, and we add an #ifdef'able define for good
340 LOCAL_CFLAGS += -DdvmAsmInstructionStart=0 -DdvmAsmInstructionEnd=0 \
341 -DdvmAsmSisterStart=0 -DdvmAsmSisterEnd=0 -DDVM_NO_ASM_INTERP=1