OSDN Git Service

am 0161e158: Merge "Add missing JUMBO opcodes to volatile rewriting"
[android-x86/dalvik.git] / vm / Dvm.mk
1 # Copyright (C) 2008 The Android Open Source Project
2 #
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
6 #
7 #      http://www.apache.org/licenses/LICENSE-2.0
8 #
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.
14
15 #
16 # Common definitions for host or target builds of libdvm.
17 #
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.)
21 #
22
23
24 #
25 # Compiler defines.
26 #
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)\"
30
31 #
32 # Optional features.  These may impact the size or performance of the VM.
33 #
34
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
41   endif
42 else
43   dvm_make_debug_vm := $(DEBUG_DALVIK_VM)
44 endif
45
46 ifeq ($(dvm_make_debug_vm),true)
47   #
48   # "Debug" profile:
49   # - debugger enabled
50   # - profiling enabled
51   # - tracked-reference verification enabled
52   # - allocation limits enabled
53   # - GDB helpers enabled
54   # - LOGV
55   # - assert()
56   #
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
69   #
70   # "Performance" profile:
71   # - all development features disabled
72   # - compiler optimizations enabled (redundant for "release" builds)
73   # - (debugging and profiling still enabled)
74   #
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
83
84 # bug hunting: checksum and verify interpreted stack when making JNI calls
85 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
86
87 LOCAL_SRC_FILES := \
88         AllocTracker.c \
89         Atomic.c.arm \
90         AtomicCache.c \
91         BitVector.c.arm \
92         CheckJni.c \
93         Ddm.c \
94         Debugger.c \
95         DvmDex.c \
96         Exception.c \
97         Hash.c \
98         IndirectRefTable.c.arm \
99         Init.c \
100         InitRefs.c \
101         InlineNative.c.arm \
102         Inlines.c \
103         Intern.c \
104         Jni.c \
105         JarFile.c \
106         LinearAlloc.c \
107         Misc.c \
108         Native.c \
109         PointerSet.c \
110         Profile.c \
111         Properties.c \
112         RawDexFile.c \
113         ReferenceTable.c \
114         SignalCatcher.c \
115         StdioConverter.c \
116         Sync.c \
117         Thread.c \
118         UtfString.c \
119         alloc/Alloc.cpp \
120         alloc/CardTable.cpp \
121         alloc/HeapBitmap.cpp.arm \
122         alloc/HeapDebug.cpp \
123         alloc/Heap.cpp.arm \
124         alloc/DdmHeap.cpp \
125         alloc/Verify.cpp \
126         alloc/Visit.cpp \
127         analysis/CodeVerify.c \
128         analysis/DexPrepare.c \
129         analysis/DexVerify.c \
130         analysis/Liveness.c \
131         analysis/Optimize.c \
132         analysis/RegisterMap.c \
133         analysis/VerifySubs.c \
134         analysis/VfyBasicBlock.c \
135         hprof/Hprof.cpp \
136         hprof/HprofClass.cpp \
137         hprof/HprofHeap.cpp \
138         hprof/HprofOutput.cpp \
139         hprof/HprofString.cpp \
140         interp/Interp.c.arm \
141         interp/Stack.c \
142         jdwp/ExpandBuf.c \
143         jdwp/JdwpAdb.c \
144         jdwp/JdwpConstants.c \
145         jdwp/JdwpEvent.c \
146         jdwp/JdwpHandler.c \
147         jdwp/JdwpMain.c \
148         jdwp/JdwpSocket.c \
149         mterp/Mterp.c.arm \
150         mterp/out/InterpC-portable.c.arm \
151         native/InternalNative.c \
152         native/dalvik_bytecode_OpcodeInfo.c \
153         native/dalvik_system_DexFile.c \
154         native/dalvik_system_VMDebug.c \
155         native/dalvik_system_VMRuntime.c \
156         native/dalvik_system_VMStack.c \
157         native/dalvik_system_Zygote.c \
158         native/java_lang_Class.c \
159         native/java_lang_Double.c \
160         native/java_lang_Float.c \
161         native/java_lang_Math.c \
162         native/java_lang_Object.c \
163         native/java_lang_Runtime.c \
164         native/java_lang_String.c \
165         native/java_lang_System.c \
166         native/java_lang_Throwable.c \
167         native/java_lang_VMClassLoader.c \
168         native/java_lang_VMThread.c \
169         native/java_lang_reflect_AccessibleObject.c \
170         native/java_lang_reflect_Array.c \
171         native/java_lang_reflect_Constructor.c \
172         native/java_lang_reflect_Field.c \
173         native/java_lang_reflect_Method.c \
174         native/java_lang_reflect_Proxy.c \
175         native/java_util_concurrent_atomic_AtomicLong.c \
176         native/org_apache_harmony_dalvik_NativeTestTarget.c \
177         native/org_apache_harmony_dalvik_ddmc_DdmServer.c \
178         native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \
179         native/sun_misc_Unsafe.c \
180         oo/AccessCheck.c \
181         oo/Array.c \
182         oo/Class.c \
183         oo/Object.c \
184         oo/Resolve.c \
185         oo/TypeCheck.c \
186         reflect/Annotation.c \
187         reflect/Proxy.c \
188         reflect/Reflect.c \
189         test/AtomicTest.c.arm \
190         test/TestHash.c \
191         test/TestIndirectRefTable.c
192
193 WITH_COPYING_GC := $(strip $(WITH_COPYING_GC))
194
195 ifeq ($(WITH_COPYING_GC),true)
196   LOCAL_CFLAGS += -DWITH_COPYING_GC
197   LOCAL_SRC_FILES += \
198         alloc/Copying.cpp.arm
199 else
200   LOCAL_SRC_FILES += \
201         alloc/HeapSource.cpp \
202         alloc/MarkSweep.cpp.arm
203 endif
204
205 WITH_JIT := $(strip $(WITH_JIT))
206
207 ifeq ($(WITH_JIT),true)
208   LOCAL_CFLAGS += -DWITH_JIT
209   LOCAL_SRC_FILES += \
210         compiler/Compiler.c \
211         compiler/Frontend.c \
212         compiler/Utility.c \
213         compiler/InlineTransformation.c \
214         compiler/IntermediateRep.c \
215         compiler/Dataflow.c \
216         compiler/SSATransformation.c \
217         compiler/Loop.c \
218         compiler/Ralloc.c \
219         interp/Jit.c
220 endif
221
222 LOCAL_C_INCLUDES += \
223         $(JNI_H_INCLUDE) \
224         dalvik \
225         dalvik/vm \
226         external/zlib \
227         $(KERNEL_HEADERS)
228
229
230 ifeq ($(dvm_simulator),true)
231   LOCAL_LDLIBS += -lpthread -ldl
232   ifeq ($(HOST_OS),linux)
233     # need this for clock_gettime() in profiling
234     LOCAL_LDLIBS += -lrt
235   endif
236 endif
237
238 MTERP_ARCH_KNOWN := false
239
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.)
246   LOCAL_SRC_FILES += \
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
252
253   ifeq ($(WITH_JIT),true)
254     LOCAL_SRC_FILES += \
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
264   endif
265 endif
266
267 ifeq ($(dvm_arch),x86)
268   ifeq ($(dvm_os),linux)
269     MTERP_ARCH_KNOWN := true
270     LOCAL_CFLAGS += -DDVM_JMP_TABLE_MTERP=1
271     LOCAL_SRC_FILES += \
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)
277       LOCAL_SRC_FILES += \
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
283     endif
284   endif
285 endif
286
287 ifeq ($(dvm_arch),sh)
288   MTERP_ARCH_KNOWN := true
289   LOCAL_SRC_FILES += \
290                 arch/sh/CallSH4ABI.S \
291                 arch/generic/Hints.c \
292                 mterp/out/InterpC-allstubs.c \
293                 mterp/out/InterpAsm-allstubs.S
294 endif
295
296 ifeq ($(MTERP_ARCH_KNOWN),false)
297   # unknown architecture, try to use FFI
298   LOCAL_C_INCLUDES += external/libffi/$(dvm_os)-$(dvm_arch)
299
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
303   else
304       LOCAL_SHARED_LIBRARIES += libffi
305   endif
306
307   LOCAL_SRC_FILES += \
308                 arch/generic/Call.c \
309                 arch/generic/Hints.c \
310                 mterp/out/InterpC-allstubs.c
311
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
315   # measure, too.
316   LOCAL_CFLAGS += -DdvmAsmInstructionStart=0 -DdvmAsmInstructionEnd=0 \
317         -DdvmAsmSisterStart=0 -DdvmAsmSisterEnd=0 -DDVM_NO_ASM_INTERP=1
318 endif