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
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 ifneq ($(strip $(DEBUG_DALVIK_VM)),)
39 dvm_make_debug_vm := $(DEBUG_DALVIK_VM)
42 ifeq ($(dvm_make_debug_vm),true)
47 # - tracked-reference verification enabled
48 # - allocation limits enabled
49 # - GDB helpers enabled
53 LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
54 LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
55 LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
56 LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
57 #LOCAL_CFLAGS += -DCHECK_MUTEX
58 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
59 # add some extra stuff to make it easier to examine with GDB
60 LOCAL_CFLAGS += -DEASY_GDB
61 # overall config may be for a "release" build, so reconfigure these
62 LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
63 else # !dvm_make_debug_vm
65 # "Performance" profile:
66 # - all development features disabled
67 # - compiler optimizations enabled (redundant for "release" builds)
68 # - (debugging and profiling still enabled)
70 #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
71 # "-O2" is redundant for device (release) but useful for sim (debug)
72 #LOCAL_CFLAGS += -O2 -Winline
73 #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
74 LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
75 # if you want to try with assertions on the device, add:
76 #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
77 endif # !dvm_make_debug_vm
79 # bug hunting: checksum and verify interpreted stack when making JNI calls
80 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
93 IndirectRefTable.cpp.arm \
96 InlineNative.cpp.arm \
114 alloc/CardTable.cpp \
115 alloc/HeapBitmap.cpp.arm \
116 alloc/HeapDebug.cpp \
121 analysis/CodeVerify.cpp \
122 analysis/DexPrepare.cpp \
123 analysis/DexVerify.cpp \
124 analysis/Liveness.cpp \
125 analysis/Optimize.cpp \
126 analysis/RegisterMap.cpp \
127 analysis/VerifySubs.cpp \
128 analysis/VfyBasicBlock.cpp \
130 hprof/HprofClass.cpp \
131 hprof/HprofHeap.cpp \
132 hprof/HprofOutput.cpp \
133 hprof/HprofString.cpp \
134 interp/Interp.cpp.arm \
138 jdwp/JdwpConstants.cpp \
140 jdwp/JdwpHandler.cpp \
142 jdwp/JdwpSocket.cpp \
143 mterp/Mterp.cpp.arm \
144 mterp/out/InterpC-portable.cpp.arm \
145 native/InternalNative.cpp \
146 native/dalvik_bytecode_OpcodeInfo.cpp \
147 native/dalvik_system_DexFile.cpp \
148 native/dalvik_system_VMDebug.cpp \
149 native/dalvik_system_VMRuntime.cpp \
150 native/dalvik_system_VMStack.cpp \
151 native/dalvik_system_Zygote.cpp \
152 native/java_lang_Class.cpp \
153 native/java_lang_Double.cpp \
154 native/java_lang_Float.cpp \
155 native/java_lang_Math.cpp \
156 native/java_lang_Object.cpp \
157 native/java_lang_Runtime.cpp \
158 native/java_lang_String.cpp \
159 native/java_lang_System.cpp \
160 native/java_lang_Throwable.cpp \
161 native/java_lang_VMClassLoader.cpp \
162 native/java_lang_VMThread.cpp \
163 native/java_lang_reflect_AccessibleObject.cpp \
164 native/java_lang_reflect_Array.cpp \
165 native/java_lang_reflect_Constructor.cpp \
166 native/java_lang_reflect_Field.cpp \
167 native/java_lang_reflect_Method.cpp \
168 native/java_lang_reflect_Proxy.cpp \
169 native/java_util_concurrent_atomic_AtomicLong.cpp \
170 native/org_apache_harmony_dalvik_NativeTestTarget.cpp \
171 native/org_apache_harmony_dalvik_ddmc_DdmServer.cpp \
172 native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cpp \
173 native/sun_misc_Unsafe.cpp \
180 reflect/Annotation.cpp \
182 reflect/Reflect.cpp \
183 test/AtomicTest.cpp.arm \
185 test/TestIndirectRefTable.cpp
187 # TODO: this is the wrong test, but what's the right one?
188 ifneq ($(filter arm mips,$(dvm_arch)),)
189 LOCAL_SRC_FILES += os/android.cpp
191 LOCAL_SRC_FILES += os/linux.cpp
194 WITH_COPYING_GC := $(strip $(WITH_COPYING_GC))
196 ifeq ($(WITH_COPYING_GC),true)
197 LOCAL_CFLAGS += -DWITH_COPYING_GC
199 alloc/Copying.cpp.arm
203 alloc/HeapSource.cpp \
204 alloc/MarkSweep.cpp.arm
207 WITH_JIT := $(strip $(WITH_JIT))
209 ifeq ($(WITH_JIT),true)
210 LOCAL_CFLAGS += -DWITH_JIT
212 compiler/Compiler.cpp \
213 compiler/Frontend.cpp \
214 compiler/Utility.cpp \
215 compiler/InlineTransformation.cpp \
216 compiler/IntermediateRep.cpp \
217 compiler/Dataflow.cpp \
218 compiler/SSATransformation.cpp \
220 compiler/Ralloc.cpp \
224 LOCAL_C_INCLUDES += \
231 MTERP_ARCH_KNOWN := false
233 ifeq ($(dvm_arch),arm)
234 #dvm_arch_variant := armv7-a
235 #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp
236 LOCAL_CFLAGS += -Werror
237 MTERP_ARCH_KNOWN := true
238 # Select architecture-specific sources (armv5te, armv7-a, etc.)
240 arch/arm/CallOldABI.S \
241 arch/arm/CallEABI.S \
242 arch/arm/HintsEABI.cpp \
243 mterp/out/InterpC-$(dvm_arch_variant).cpp.arm \
244 mterp/out/InterpAsm-$(dvm_arch_variant).S
246 ifeq ($(WITH_JIT),true)
248 compiler/codegen/RallocUtil.cpp \
249 compiler/codegen/arm/$(dvm_arch_variant)/Codegen.cpp \
250 compiler/codegen/arm/$(dvm_arch_variant)/CallingConvention.S \
251 compiler/codegen/arm/Assemble.cpp \
252 compiler/codegen/arm/ArchUtility.cpp \
253 compiler/codegen/arm/LocalOptimizations.cpp \
254 compiler/codegen/arm/GlobalOptimizations.cpp \
255 compiler/codegen/arm/ArmRallocUtil.cpp \
256 compiler/template/out/CompilerTemplateAsm-$(dvm_arch_variant).S
260 ifeq ($(dvm_arch),mips)
261 MTERP_ARCH_KNOWN := true
262 LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH)
263 LOCAL_SHARED_LIBRARIES += libffi
265 arch/mips/CallO32.S \
266 arch/mips/HintsO32.cpp \
267 arch/generic/Call.cpp \
268 mterp/out/InterpC-mips.cpp \
269 mterp/out/InterpAsm-mips.S
271 ifeq ($(WITH_JIT),true)
272 dvm_arch_variant := mips
274 compiler/codegen/mips/RallocUtil.cpp \
275 compiler/codegen/mips/$(dvm_arch_variant)/Codegen.cpp \
276 compiler/codegen/mips/$(dvm_arch_variant)/CallingConvention.S \
277 compiler/codegen/mips/Assemble.cpp \
278 compiler/codegen/mips/ArchUtility.cpp \
279 compiler/codegen/mips/LocalOptimizations.cpp \
280 compiler/codegen/mips/GlobalOptimizations.cpp \
281 compiler/template/out/CompilerTemplateAsm-$(dvm_arch_variant).S
285 ifeq ($(dvm_arch),x86)
286 ifeq ($(dvm_os),linux)
287 MTERP_ARCH_KNOWN := true
288 LOCAL_CFLAGS += -DDVM_JMP_TABLE_MTERP=1 \
291 arch/$(dvm_arch_variant)/Call386ABI.S \
292 arch/$(dvm_arch_variant)/Hints386ABI.cpp \
293 mterp/out/InterpC-$(dvm_arch_variant).cpp \
294 mterp/out/InterpAsm-$(dvm_arch_variant).S
295 ifeq ($(WITH_JIT),true)
296 LOCAL_CFLAGS += -DARCH_IA32
298 compiler/codegen/x86/LowerAlu.cpp \
299 compiler/codegen/x86/LowerConst.cpp \
300 compiler/codegen/x86/LowerMove.cpp \
301 compiler/codegen/x86/Lower.cpp \
302 compiler/codegen/x86/LowerHelper.cpp \
303 compiler/codegen/x86/LowerJump.cpp \
304 compiler/codegen/x86/LowerObject.cpp \
305 compiler/codegen/x86/AnalysisO1.cpp \
306 compiler/codegen/x86/BytecodeVisitor.cpp \
307 compiler/codegen/x86/NcgAot.cpp \
308 compiler/codegen/x86/CodegenInterface.cpp \
309 compiler/codegen/x86/LowerInvoke.cpp \
310 compiler/codegen/x86/LowerReturn.cpp \
311 compiler/codegen/x86/NcgHelper.cpp \
312 compiler/codegen/x86/LowerGetPut.cpp
314 # need apache harmony x86 encoder/decoder
315 LOCAL_C_INCLUDES += \
316 dalvik/vm/compiler/codegen/x86/libenc
318 compiler/codegen/x86/libenc/enc_base.cpp \
319 compiler/codegen/x86/libenc/dec_base.cpp \
320 compiler/codegen/x86/libenc/enc_wrapper.cpp \
321 compiler/codegen/x86/libenc/enc_tabl.cpp
327 ifeq ($(MTERP_ARCH_KNOWN),false)
328 # unknown architecture, try to use FFI
329 LOCAL_C_INCLUDES += external/libffi/$(dvm_os)-$(dvm_arch)
331 ifeq ($(dvm_os)-$(dvm_arch),darwin-x86)
332 # OSX includes libffi, so just make the linker aware of it directly.
333 LOCAL_LDLIBS += -lffi
335 LOCAL_SHARED_LIBRARIES += libffi
339 arch/generic/Call.cpp \
340 arch/generic/Hints.cpp \
341 mterp/out/InterpC-allstubs.cpp
343 # The following symbols are usually defined in the asm file, but
344 # since we don't have an asm file in this case, we instead just
345 # peg them at 0 here, and we add an #ifdef'able define for good
347 LOCAL_CFLAGS += -DdvmAsmInstructionStart=0 -DdvmAsmInstructionEnd=0 \
348 -DdvmAsmSisterStart=0 -DdvmAsmSisterEnd=0 -DDVM_NO_ASM_INTERP=1