OSDN Git Service

am f682dd64: (-s ours) am 1dd6e412: am a028d87f: Always grow the limit address of...
[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
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 += -DDVM_SHOW_EXCEPTION=3
63   # add some extra stuff to make it easier to examine with GDB
64   LOCAL_CFLAGS += -DEASY_GDB
65   # overall config may be for a "release" build, so reconfigure these
66   LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
67 else  # !dvm_make_debug_vm
68   #
69   # "Performance" profile:
70   # - all development features disabled
71   # - compiler optimizations enabled (redundant for "release" builds)
72   # - (debugging and profiling still enabled)
73   #
74   #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
75   # "-O2" is redundant for device (release) but useful for sim (debug)
76   #LOCAL_CFLAGS += -O2 -Winline
77   #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
78   LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
79   # if you want to try with assertions on the device, add:
80   #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
81 endif  # !dvm_make_debug_vm
82
83 # bug hunting: checksum and verify interpreted stack when making JNI calls
84 #LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
85
86 LOCAL_SRC_FILES := \
87         AllocTracker.cpp \
88         Atomic.cpp.arm \
89         AtomicCache.cpp \
90         BitVector.cpp.arm \
91         CheckJni.cpp \
92         Ddm.cpp \
93         Debugger.cpp \
94         DvmDex.cpp \
95         Exception.cpp \
96         Hash.cpp \
97         IndirectRefTable.cpp.arm \
98         Init.cpp \
99         InitRefs.cpp \
100         InlineNative.cpp.arm \
101         Inlines.cpp \
102         Intern.cpp \
103         Jni.cpp \
104         JarFile.cpp \
105         LinearAlloc.cpp \
106         Misc.cpp \
107         Native.cpp \
108         PointerSet.cpp \
109         Profile.cpp \
110         Properties.cpp \
111         RawDexFile.cpp \
112         ReferenceTable.cpp \
113         SignalCatcher.cpp \
114         StdioConverter.cpp \
115         Sync.cpp \
116         Thread.cpp \
117         UtfString.cpp \
118         alloc/Alloc.cpp \
119         alloc/CardTable.cpp \
120         alloc/HeapBitmap.cpp.arm \
121         alloc/HeapDebug.cpp \
122         alloc/Heap.cpp.arm \
123         alloc/DdmHeap.cpp \
124         alloc/Verify.cpp \
125         alloc/Visit.cpp \
126         analysis/CodeVerify.cpp \
127         analysis/DexPrepare.cpp \
128         analysis/DexVerify.cpp \
129         analysis/Liveness.cpp \
130         analysis/Optimize.cpp \
131         analysis/RegisterMap.cpp \
132         analysis/VerifySubs.cpp \
133         analysis/VfyBasicBlock.cpp \
134         hprof/Hprof.cpp \
135         hprof/HprofClass.cpp \
136         hprof/HprofHeap.cpp \
137         hprof/HprofOutput.cpp \
138         hprof/HprofString.cpp \
139         interp/Interp.cpp.arm \
140         interp/Stack.cpp \
141         jdwp/ExpandBuf.cpp \
142         jdwp/JdwpAdb.cpp \
143         jdwp/JdwpConstants.cpp \
144         jdwp/JdwpEvent.cpp \
145         jdwp/JdwpHandler.cpp \
146         jdwp/JdwpMain.cpp \
147         jdwp/JdwpSocket.cpp \
148         mterp/Mterp.cpp.arm \
149         mterp/out/InterpC-portable.cpp.arm \
150         native/InternalNative.cpp \
151         native/dalvik_bytecode_OpcodeInfo.cpp \
152         native/dalvik_system_DexFile.cpp \
153         native/dalvik_system_VMDebug.cpp \
154         native/dalvik_system_VMRuntime.cpp \
155         native/dalvik_system_VMStack.cpp \
156         native/dalvik_system_Zygote.cpp \
157         native/java_lang_Class.cpp \
158         native/java_lang_Double.cpp \
159         native/java_lang_Float.cpp \
160         native/java_lang_Math.cpp \
161         native/java_lang_Object.cpp \
162         native/java_lang_Runtime.cpp \
163         native/java_lang_String.cpp \
164         native/java_lang_System.cpp \
165         native/java_lang_Throwable.cpp \
166         native/java_lang_VMClassLoader.cpp \
167         native/java_lang_VMThread.cpp \
168         native/java_lang_reflect_AccessibleObject.cpp \
169         native/java_lang_reflect_Array.cpp \
170         native/java_lang_reflect_Constructor.cpp \
171         native/java_lang_reflect_Field.cpp \
172         native/java_lang_reflect_Method.cpp \
173         native/java_lang_reflect_Proxy.cpp \
174         native/java_util_concurrent_atomic_AtomicLong.cpp \
175         native/org_apache_harmony_dalvik_NativeTestTarget.cpp \
176         native/org_apache_harmony_dalvik_ddmc_DdmServer.cpp \
177         native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cpp \
178         native/sun_misc_Unsafe.cpp \
179         oo/AccessCheck.cpp \
180         oo/Array.cpp \
181         oo/Class.cpp \
182         oo/Object.cpp \
183         oo/Resolve.cpp \
184         oo/TypeCheck.cpp \
185         reflect/Annotation.cpp \
186         reflect/Proxy.cpp \
187         reflect/Reflect.cpp \
188         test/AtomicTest.cpp.arm \
189         test/TestHash.cpp \
190         test/TestIndirectRefTable.cpp
191
192 WITH_COPYING_GC := $(strip $(WITH_COPYING_GC))
193
194 ifeq ($(WITH_COPYING_GC),true)
195   LOCAL_CFLAGS += -DWITH_COPYING_GC
196   LOCAL_SRC_FILES += \
197         alloc/Copying.cpp.arm
198 else
199   LOCAL_SRC_FILES += \
200         alloc/HeapSource.cpp \
201         alloc/MarkSweep.cpp.arm
202 endif
203
204 WITH_JIT := $(strip $(WITH_JIT))
205
206 ifeq ($(WITH_JIT),true)
207   LOCAL_CFLAGS += -DWITH_JIT
208   LOCAL_SRC_FILES += \
209         compiler/Compiler.cpp \
210         compiler/Frontend.cpp \
211         compiler/Utility.cpp \
212         compiler/InlineTransformation.cpp \
213         compiler/IntermediateRep.cpp \
214         compiler/Dataflow.cpp \
215         compiler/SSATransformation.cpp \
216         compiler/Loop.cpp \
217         compiler/Ralloc.cpp \
218         interp/Jit.cpp
219 endif
220
221 LOCAL_C_INCLUDES += \
222         $(JNI_H_INCLUDE) \
223         dalvik \
224         dalvik/vm \
225         external/zlib \
226         libcore/include \
227         $(KERNEL_HEADERS)
228
229 ifeq ($(dvm_simulator),true)
230   LOCAL_LDLIBS += -lpthread -ldl
231   ifeq ($(HOST_OS),linux)
232     # need this for clock_gettime() in profiling
233     LOCAL_LDLIBS += -lrt
234   endif
235 endif
236
237 MTERP_ARCH_KNOWN := false
238
239 ifeq ($(dvm_arch),arm)
240   #dvm_arch_variant := armv7-a
241   #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp
242   LOCAL_CFLAGS += -Werror
243   MTERP_ARCH_KNOWN := true
244   # Select architecture-specific sources (armv5te, armv7-a, etc.)
245   LOCAL_SRC_FILES += \
246                 arch/arm/CallOldABI.S \
247                 arch/arm/CallEABI.S \
248                 arch/arm/HintsEABI.cpp \
249                 mterp/out/InterpC-$(dvm_arch_variant).cpp.arm \
250                 mterp/out/InterpAsm-$(dvm_arch_variant).S
251
252   ifeq ($(WITH_JIT),true)
253     LOCAL_SRC_FILES += \
254                 compiler/codegen/RallocUtil.cpp \
255                 compiler/codegen/arm/$(dvm_arch_variant)/Codegen.cpp \
256                 compiler/codegen/arm/$(dvm_arch_variant)/CallingConvention.S \
257                 compiler/codegen/arm/Assemble.cpp \
258                 compiler/codegen/arm/ArchUtility.cpp \
259                 compiler/codegen/arm/LocalOptimizations.cpp \
260                 compiler/codegen/arm/GlobalOptimizations.cpp \
261                 compiler/codegen/arm/ArmRallocUtil.cpp \
262                 compiler/template/out/CompilerTemplateAsm-$(dvm_arch_variant).S
263   endif
264 endif
265
266 ifeq ($(dvm_arch),x86)
267   ifeq ($(dvm_os),linux)
268     MTERP_ARCH_KNOWN := true
269     LOCAL_CFLAGS += -DDVM_JMP_TABLE_MTERP=1
270     LOCAL_SRC_FILES += \
271                 arch/$(dvm_arch_variant)/Call386ABI.S \
272                 arch/$(dvm_arch_variant)/Hints386ABI.cpp \
273                 mterp/out/InterpC-$(dvm_arch_variant).cpp \
274                 mterp/out/InterpAsm-$(dvm_arch_variant).S
275     ifeq ($(WITH_JIT),true)
276       LOCAL_SRC_FILES += \
277                 compiler/codegen/x86/Assemble.cpp \
278                 compiler/codegen/x86/ArchUtility.cpp \
279                 compiler/codegen/x86/ia32/Codegen.cpp \
280                 compiler/codegen/x86/ia32/CallingConvention.S \
281                 compiler/template/out/CompilerTemplateAsm-ia32.S
282     endif
283   endif
284 endif
285
286 ifeq ($(dvm_arch),sh)
287   MTERP_ARCH_KNOWN := true
288   LOCAL_SRC_FILES += \
289                 arch/sh/CallSH4ABI.S \
290                 arch/generic/Hints.cpp \
291                 mterp/out/InterpC-allstubs.cpp \
292                 mterp/out/InterpAsm-allstubs.S
293 endif
294
295 ifeq ($(MTERP_ARCH_KNOWN),false)
296   # unknown architecture, try to use FFI
297   LOCAL_C_INCLUDES += external/libffi/$(dvm_os)-$(dvm_arch)
298
299   ifeq ($(dvm_os)-$(dvm_arch),darwin-x86)
300       # OSX includes libffi, so just make the linker aware of it directly.
301       LOCAL_LDLIBS += -lffi
302   else
303       LOCAL_SHARED_LIBRARIES += libffi
304   endif
305
306   LOCAL_SRC_FILES += \
307                 arch/generic/Call.cpp \
308                 arch/generic/Hints.cpp \
309                 mterp/out/InterpC-allstubs.cpp
310
311   # The following symbols are usually defined in the asm file, but
312   # since we don't have an asm file in this case, we instead just
313   # peg them at 0 here, and we add an #ifdef'able define for good
314   # measure, too.
315   LOCAL_CFLAGS += -DdvmAsmInstructionStart=0 -DdvmAsmInstructionEnd=0 \
316         -DdvmAsmSisterStart=0 -DdvmAsmSisterEnd=0 -DDVM_NO_ASM_INTERP=1
317 endif