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 += -Wall -Wextra -Wno-unused-parameter -Wc++-compat
29 LOCAL_CFLAGS += -DARCH_VARIANT=\"$(dvm_arch_variant)\"
32 # Optional features. These may impact the size or performance of the VM.
35 # Make a debugging version when building the simulator (if not told
36 # otherwise) and when explicitly asked.
37 dvm_make_debug_vm := false
38 ifeq ($(strip $(DEBUG_DALVIK_VM)),)
39 ifeq ($(dvm_simulator),true)
40 dvm_make_debug_vm := true
43 dvm_make_debug_vm := $(DEBUG_DALVIK_VM)
46 ifeq ($(dvm_make_debug_vm),true)
51 # - tracked-reference verification enabled
52 # - allocation limits enabled
53 # - GDB helpers enabled
57 LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
58 LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
59 LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
60 LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
61 #LOCAL_CFLAGS += -DCHECK_MUTEX
62 #LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS
63 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
64 # add some extra stuff to make it easier to examine with GDB
65 LOCAL_CFLAGS += -DEASY_GDB
66 # overall config may be for a "release" build, so reconfigure these
67 LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
68 else # !dvm_make_debug_vm
70 # "Performance" profile:
71 # - all development features disabled
72 # - compiler optimizations enabled (redundant for "release" builds)
73 # - (debugging and profiling still enabled)
75 #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
76 # "-O2" is redundant for device (release) but useful for sim (debug)
77 #LOCAL_CFLAGS += -O2 -Winline
78 #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
79 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
80 # if you want to try with assertions on the device, add:
81 #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
82 endif # !dvm_make_debug_vm
84 # bug hunting: checksum and verify interpreted stack when making JNI calls
85 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
98 IndirectRefTable.c.arm \
120 alloc/CardTable.cpp \
121 alloc/HeapBitmap.cpp.arm \
122 alloc/HeapDebug.cpp \
127 analysis/CodeVerify.cpp \
128 analysis/DexPrepare.cpp \
129 analysis/DexVerify.cpp \
130 analysis/Liveness.cpp \
131 analysis/Optimize.cpp \
132 analysis/RegisterMap.cpp \
133 analysis/VerifySubs.cpp \
134 analysis/VfyBasicBlock.cpp \
136 hprof/HprofClass.cpp \
137 hprof/HprofHeap.cpp \
138 hprof/HprofOutput.cpp \
139 hprof/HprofString.cpp \
140 interp/Interp.cpp.arm \
144 jdwp/JdwpConstants.cpp \
146 jdwp/JdwpHandler.cpp \
148 jdwp/JdwpSocket.cpp \
150 mterp/out/InterpC-portable.c.arm \
151 native/InternalNative.cpp \
152 native/dalvik_bytecode_OpcodeInfo.cpp \
153 native/dalvik_system_DexFile.cpp \
154 native/dalvik_system_VMDebug.cpp \
155 native/dalvik_system_VMRuntime.cpp \
156 native/dalvik_system_VMStack.cpp \
157 native/dalvik_system_Zygote.cpp \
158 native/java_lang_Class.cpp \
159 native/java_lang_Double.cpp \
160 native/java_lang_Float.cpp \
161 native/java_lang_Math.cpp \
162 native/java_lang_Object.cpp \
163 native/java_lang_Runtime.cpp \
164 native/java_lang_String.cpp \
165 native/java_lang_System.cpp \
166 native/java_lang_Throwable.cpp \
167 native/java_lang_VMClassLoader.cpp \
168 native/java_lang_VMThread.cpp \
169 native/java_lang_reflect_AccessibleObject.cpp \
170 native/java_lang_reflect_Array.cpp \
171 native/java_lang_reflect_Constructor.cpp \
172 native/java_lang_reflect_Field.cpp \
173 native/java_lang_reflect_Method.cpp \
174 native/java_lang_reflect_Proxy.cpp \
175 native/java_util_concurrent_atomic_AtomicLong.cpp \
176 native/org_apache_harmony_dalvik_NativeTestTarget.cpp \
177 native/org_apache_harmony_dalvik_ddmc_DdmServer.cpp \
178 native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cpp \
179 native/sun_misc_Unsafe.cpp \
186 reflect/Annotation.cpp \
188 reflect/Reflect.cpp \
189 test/AtomicTest.c.arm \
191 test/TestIndirectRefTable.c
193 WITH_COPYING_GC := $(strip $(WITH_COPYING_GC))
195 ifeq ($(WITH_COPYING_GC),true)
196 LOCAL_CFLAGS += -DWITH_COPYING_GC
198 alloc/Copying.cpp.arm
201 alloc/HeapSource.cpp \
202 alloc/MarkSweep.cpp.arm
205 WITH_JIT := $(strip $(WITH_JIT))
207 ifeq ($(WITH_JIT),true)
208 LOCAL_CFLAGS += -DWITH_JIT
210 compiler/Compiler.c \
211 compiler/Frontend.c \
213 compiler/InlineTransformation.c \
214 compiler/IntermediateRep.c \
215 compiler/Dataflow.c \
216 compiler/SSATransformation.c \
222 LOCAL_C_INCLUDES += \
230 ifeq ($(dvm_simulator),true)
231 LOCAL_LDLIBS += -lpthread -ldl
232 ifeq ($(HOST_OS),linux)
233 # need this for clock_gettime() in profiling
238 MTERP_ARCH_KNOWN := false
240 ifeq ($(dvm_arch),arm)
241 #dvm_arch_variant := armv7-a
242 #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp
243 LOCAL_CFLAGS += -Werror
244 MTERP_ARCH_KNOWN := true
245 # Select architecture-specific sources (armv5te, armv7-a, etc.)
247 arch/arm/CallOldABI.S \
248 arch/arm/CallEABI.S \
249 arch/arm/HintsEABI.c \
250 mterp/out/InterpC-$(dvm_arch_variant).c.arm \
251 mterp/out/InterpAsm-$(dvm_arch_variant).S
253 ifeq ($(WITH_JIT),true)
255 compiler/codegen/RallocUtil.c \
256 compiler/codegen/arm/$(dvm_arch_variant)/Codegen.c \
257 compiler/codegen/arm/$(dvm_arch_variant)/CallingConvention.S \
258 compiler/codegen/arm/Assemble.c \
259 compiler/codegen/arm/ArchUtility.c \
260 compiler/codegen/arm/LocalOptimizations.c \
261 compiler/codegen/arm/GlobalOptimizations.c \
262 compiler/codegen/arm/ArmRallocUtil.c \
263 compiler/template/out/CompilerTemplateAsm-$(dvm_arch_variant).S
267 ifeq ($(dvm_arch),x86)
268 ifeq ($(dvm_os),linux)
269 MTERP_ARCH_KNOWN := true
270 LOCAL_CFLAGS += -DDVM_JMP_TABLE_MTERP=1
272 arch/$(dvm_arch_variant)/Call386ABI.S \
273 arch/$(dvm_arch_variant)/Hints386ABI.c \
274 mterp/out/InterpC-$(dvm_arch_variant).c \
275 mterp/out/InterpAsm-$(dvm_arch_variant).S
276 ifeq ($(WITH_JIT),true)
278 compiler/codegen/x86/Assemble.c \
279 compiler/codegen/x86/ArchUtility.c \
280 compiler/codegen/x86/ia32/Codegen.c \
281 compiler/codegen/x86/ia32/CallingConvention.S \
282 compiler/template/out/CompilerTemplateAsm-ia32.S
287 ifeq ($(dvm_arch),sh)
288 MTERP_ARCH_KNOWN := true
290 arch/sh/CallSH4ABI.S \
291 arch/generic/Hints.c \
292 mterp/out/InterpC-allstubs.c \
293 mterp/out/InterpAsm-allstubs.S
296 ifeq ($(MTERP_ARCH_KNOWN),false)
297 # unknown architecture, try to use FFI
298 LOCAL_C_INCLUDES += external/libffi/$(dvm_os)-$(dvm_arch)
300 ifeq ($(dvm_os)-$(dvm_arch),darwin-x86)
301 # OSX includes libffi, so just make the linker aware of it directly.
302 LOCAL_LDLIBS += -lffi
304 LOCAL_SHARED_LIBRARIES += libffi
308 arch/generic/Call.c \
309 arch/generic/Hints.c \
310 mterp/out/InterpC-allstubs.c
312 # The following symbols are usually defined in the asm file, but
313 # since we don't have an asm file in this case, we instead just
314 # peg them at 0 here, and we add an #ifdef'able define for good
316 LOCAL_CFLAGS += -DdvmAsmInstructionStart=0 -DdvmAsmInstructionEnd=0 \
317 -DdvmAsmSisterStart=0 -DdvmAsmSisterEnd=0 -DDVM_NO_ASM_INTERP=1