First parts of enabling a host Dalvik build.
Most of this is just factoring out common make defs to include both on
the host and device side, though there is a little bit of code change
to be slightly POSIX friendlier and to avoid unnecessary sanity checks
when compiling without an asm version of the interpreter.
This patch should cause no difference in build results, except if you
turn on the newly-defined WITH_HOST_DALVIK build flag. If you do turn
it on, at this point you should probably expect the build to fail due
to insufficient dependencies, which I of course expect to address in
upcoming patches.
diff --git a/libnativehelper/Android.mk b/libnativehelper/Android.mk
index 5f553c5..aa4be86 100644
--- a/libnativehelper/Android.mk
+++ b/libnativehelper/Android.mk
@@ -1,20 +1,36 @@
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
-LOCAL_SRC_FILES := \
+
+LOCAL_PATH := $(call my-dir)
+
+#
+# Common definitions for host and device.
+#
+
+src_files := \
JNIHelp.c \
Register.c
-LOCAL_C_INCLUDES += \
+c_includes := \
$(JNI_H_INCLUDE)
# Any shared/static libs required by libjavacore
# need to be mentioned here as well.
# TODO: fix this requirement
-LOCAL_SHARED_LIBRARIES := \
- liblog \
- libcutils \
+shared_libraries := \
libexpat \
libssl \
libutils \
@@ -25,10 +41,51 @@
libicui18n \
libsqlite
-LOCAL_STATIC_LIBRARIES := \
+static_libraries := \
libjavacore \
libfdlibm
+
+
+#
+# Build for the target (device).
+#
+
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(src_files)
+LOCAL_C_INCLUDES := $(c_includes)
+LOCAL_SHARED_LIBRARIES := $(shared_libraries)
+LOCAL_STATIC_LIBRARIES := $(static_libraries)
+
+# liblog and libcutils are shared for target.
+LOCAL_SHARED_LIBRARIES += \
+ liblog libcutils
+
LOCAL_MODULE := libnativehelper
include $(BUILD_SHARED_LIBRARY)
+
+
+#
+# Build for the host.
+#
+
+ifeq ($(WITH_HOST_DALVIK),true)
+
+ include $(CLEAR_VARS)
+
+ LOCAL_SRC_FILES := $(src_files)
+ LOCAL_C_INCLUDES := $(c_includes)
+ LOCAL_SHARED_LIBRARIES := $(shared_libraries)
+ LOCAL_STATIC_LIBRARIES := $(static_libraries)
+
+ # liblog and libcutils are static for host.
+ LOCAL_STATIC_LIBRARIES += \
+ liblog libcutils
+
+ LOCAL_MODULE := libnativehelper-host
+
+ include $(BUILD_HOST_SHARED_LIBRARY)
+
+endif
diff --git a/vm/Android.mk b/vm/Android.mk
index 713c781..5c276aa 100644
--- a/vm/Android.mk
+++ b/vm/Android.mk
@@ -12,314 +12,71 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+
#
-# Android.mk for Dalvik VM. If you enable or disable optional features here,
+# Android.mk for Dalvik VM.
+#
+# This makefile builds both for host and target, and so the very large
+# swath of common definitions are factored out into a separate file to
+# minimize duplication.
+#
+# Also, if you enable or disable optional features here (or Dvm.mk),
# rebuild the VM with "make clean-libdvm && make -j4 libdvm".
#
+
LOCAL_PATH:= $(call my-dir)
+
+#
+# Build for the target (device).
+#
+
include $(CLEAR_VARS)
+# Variables used in the included Dvm.mk.
+dvm_os := $(TARGET_OS)
+dvm_arch := $(TARGET_ARCH)
+dvm_arch_variant := $(TARGET_ARCH_VARIANT)
+dvm_simulator := $(TARGET_SIMULATOR)
-#
-# Compiler defines.
-#
-LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps
+include $(LOCAL_PATH)/Dvm.mk
-#
-# Optional features. These may impact the size or performance of the VM.
-#
-LOCAL_CFLAGS += -DWITH_PROFILER -DWITH_DEBUGGER
-
-# 0=full cache, 1/2=reduced, 3=no cache
-LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0
-
-ifeq ($(WITH_DEADLOCK_PREDICTION),true)
- LOCAL_CFLAGS += -DWITH_DEADLOCK_PREDICTION
- WITH_MONITOR_TRACKING := true
-endif
-ifeq ($(WITH_MONITOR_TRACKING),true)
- LOCAL_CFLAGS += -DWITH_MONITOR_TRACKING
-endif
-
-# Make DEBUG_DALVIK_VM default to true when building the simulator.
-ifeq ($(TARGET_SIMULATOR),true)
- ifeq ($(strip $(DEBUG_DALVIK_VM)),)
- DEBUG_DALVIK_VM := true
- endif
-endif
-
-ifeq ($(strip $(DEBUG_DALVIK_VM)),true)
- #
- # "Debug" profile:
- # - debugger enabled
- # - profiling enabled
- # - tracked-reference verification enabled
- # - allocation limits enabled
- # - GDB helpers enabled
- # - LOGV
- # - assert()
- #
- LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
- LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
- LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
- LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS
- LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
- #LOCAL_CFLAGS += -DCHECK_MUTEX
- #LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS
- LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
- # add some extra stuff to make it easier to examine with GDB
- LOCAL_CFLAGS += -DEASY_GDB
- # overall config may be for a "release" build, so reconfigure these
- LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
-else # !DALVIK_VM_DEBUG
- #
- # "Performance" profile:
- # - all development features disabled
- # - compiler optimizations enabled (redundant for "release" builds)
- # - (debugging and profiling still enabled)
- #
- #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
- # "-O2" is redundant for device (release) but useful for sim (debug)
- #LOCAL_CFLAGS += -O2 -Winline
- #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
- LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
- LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
- # if you want to try with assertions on the device, add:
- #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
-endif # !DALVIK_VM_DEBUG
-
-# bug hunting: checksum and verify interpreted stack when making JNI calls
-#LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
-
-LOCAL_SRC_FILES := \
- AllocTracker.c \
- AtomicCache.c \
- CheckJni.c \
- Ddm.c \
- Debugger.c \
- DvmDex.c \
- Exception.c \
- Hash.c \
- IndirectRefTable.c.arm \
- Init.c \
- InlineNative.c.arm \
- Inlines.c \
- Intern.c \
- Jni.c \
- JarFile.c \
- LinearAlloc.c \
- Misc.c.arm \
- Native.c \
- PointerSet.c \
- Profile.c \
- Properties.c \
- RawDexFile.c \
- ReferenceTable.c \
- SignalCatcher.c \
- StdioConverter.c \
- Sync.c \
- Thread.c \
- UtfString.c \
- alloc/clz.c.arm \
- alloc/Alloc.c \
- alloc/HeapBitmap.c.arm \
- alloc/HeapDebug.c \
- alloc/HeapSource.c \
- alloc/HeapTable.c \
- alloc/HeapWorker.c \
- alloc/Heap.c.arm \
- alloc/MarkSweep.c.arm \
- alloc/DdmHeap.c \
- analysis/CodeVerify.c \
- analysis/DexOptimize.c \
- analysis/DexVerify.c \
- analysis/ReduceConstants.c \
- analysis/RegisterMap.c \
- analysis/VerifySubs.c \
- interp/Interp.c.arm \
- interp/Stack.c \
- jdwp/ExpandBuf.c \
- jdwp/JdwpAdb.c \
- jdwp/JdwpConstants.c \
- jdwp/JdwpEvent.c \
- jdwp/JdwpHandler.c \
- jdwp/JdwpMain.c \
- jdwp/JdwpSocket.c \
- mterp/Mterp.c.arm \
- mterp/out/InterpC-portstd.c.arm \
- mterp/out/InterpC-portdbg.c.arm \
- native/InternalNative.c \
- native/dalvik_system_DexFile.c \
- native/dalvik_system_SamplingProfiler.c \
- native/dalvik_system_VMDebug.c \
- native/dalvik_system_VMRuntime.c \
- native/dalvik_system_VMStack.c \
- native/dalvik_system_Zygote.c \
- native/java_lang_Class.c \
- native/java_lang_Object.c \
- native/java_lang_Runtime.c \
- native/java_lang_String.c \
- native/java_lang_System.c \
- native/java_lang_SystemProperties.c \
- native/java_lang_Throwable.c \
- native/java_lang_VMClassLoader.c \
- native/java_lang_VMThread.c \
- native/java_lang_reflect_AccessibleObject.c \
- native/java_lang_reflect_Array.c \
- native/java_lang_reflect_Constructor.c \
- native/java_lang_reflect_Field.c \
- native/java_lang_reflect_Method.c \
- native/java_lang_reflect_Proxy.c \
- native/java_security_AccessController.c \
- native/java_util_concurrent_atomic_AtomicLong.c \
- native/org_apache_harmony_dalvik_NativeTestTarget.c \
- native/org_apache_harmony_dalvik_ddmc_DdmServer.c \
- native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \
- native/sun_misc_Unsafe.c \
- oo/AccessCheck.c \
- oo/Array.c \
- oo/Class.c \
- oo/Object.c \
- oo/Resolve.c \
- oo/TypeCheck.c \
- reflect/Annotation.c \
- reflect/Proxy.c \
- reflect/Reflect.c \
- test/AtomicSpeed.c \
- test/TestHash.c \
- test/TestIndirectRefTable.c
-
-ifeq ($(WITH_JIT_TUNING),true)
- LOCAL_CFLAGS += -DWITH_JIT_TUNING
-endif
-
-ifeq ($(WITH_JIT),true)
- # NOTE: Turn on assertion for JIT for now
- LOCAL_CFLAGS += -DWITH_DALVIK_ASSERT
- # NOTE: Also turn on tuning when JIT is enabled for now
- LOCAL_CFLAGS += -DWITH_JIT_TUNING
- LOCAL_CFLAGS += -DWITH_JIT
- LOCAL_SRC_FILES += \
- ../dexdump/OpCodeNames.c \
- compiler/Compiler.c \
- compiler/Frontend.c \
- compiler/Utility.c \
- compiler/IntermediateRep.c \
- interp/Jit.c
-endif
-
-WITH_HPROF := $(strip $(WITH_HPROF))
-ifeq ($(WITH_HPROF),)
- WITH_HPROF := true
-endif
-ifeq ($(WITH_HPROF),true)
- LOCAL_SRC_FILES += \
- hprof/Hprof.c \
- hprof/HprofClass.c \
- hprof/HprofHeap.c \
- hprof/HprofOutput.c \
- hprof/HprofString.c
- LOCAL_CFLAGS += -DWITH_HPROF=1
-
- ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true)
- LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1
- endif
-
- ifeq ($(strip $(WITH_HPROF_STACK)),true)
- LOCAL_SRC_FILES += \
- hprof/HprofStack.c \
- hprof/HprofStackFrame.c
- LOCAL_CFLAGS += -DWITH_HPROF_STACK=1
- endif # WITH_HPROF_STACK
-endif # WITH_HPROF
-
-ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true)
- LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1
-endif
-
-LOCAL_C_INCLUDES += \
- $(JNI_H_INCLUDE) \
- dalvik \
- dalvik/vm \
- external/zlib \
- $(KERNEL_HEADERS)
-
-
-ifeq ($(TARGET_SIMULATOR),true)
- LOCAL_LDLIBS += -lpthread -ldl
- ifeq ($(HOST_OS),linux)
- # need this for clock_gettime() in profiling
- LOCAL_LDLIBS += -lrt
- endif
-else
- LOCAL_SHARED_LIBRARIES += libdl
-endif
-
-MTERP_ARCH_KNOWN := false
-
-ifeq ($(TARGET_ARCH),arm)
- #TARGET_ARCH_VARIANT := armv7-a
- #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp
- MTERP_ARCH_KNOWN := true
- # Select architecture-specific sources (armv4t, armv5te etc.)
- LOCAL_SRC_FILES += \
- arch/arm/CallOldABI.S \
- arch/arm/CallEABI.S \
- arch/arm/HintsEABI.c \
- mterp/out/InterpC-$(TARGET_ARCH_VARIANT).c.arm \
- mterp/out/InterpAsm-$(TARGET_ARCH_VARIANT).S
-
- ifeq ($(WITH_JIT),true)
- LOCAL_SRC_FILES += \
- compiler/codegen/arm/Codegen-$(TARGET_ARCH_VARIANT).c \
- compiler/codegen/arm/Assemble.c \
- compiler/codegen/arm/ArchUtility.c \
- compiler/codegen/arm/LocalOptimizations.c \
- compiler/codegen/arm/GlobalOptimizations.c \
- compiler/template/out/CompilerTemplateAsm-$(TARGET_ARCH_VARIANT).S
- endif
-endif
-
-ifeq ($(TARGET_ARCH),x86)
- MTERP_ARCH_KNOWN := true
- LOCAL_SRC_FILES += \
- arch/x86/Call386ABI.S \
- arch/x86/Hints386ABI.c \
- mterp/out/InterpC-x86.c \
- mterp/out/InterpAsm-x86.S
-endif
-
-ifeq ($(TARGET_ARCH),sh)
- MTERP_ARCH_KNOWN := true
- LOCAL_SRC_FILES += \
- arch/sh/CallSH4ABI.S \
- arch/generic/Hints.c \
- mterp/out/InterpC-allstubs.c \
- mterp/out/InterpAsm-allstubs.S
-endif
-
-ifeq ($(MTERP_ARCH_KNOWN),false)
- # unknown architecture, try to use FFI
- LOCAL_C_INCLUDES += external/libffi/$(TARGET_OS)-$(TARGET_ARCH)
- LOCAL_SHARED_LIBRARIES += libffi
-
- LOCAL_SRC_FILES += \
- arch/generic/Call.c \
- arch/generic/Hints.c \
- mterp/out/InterpC-allstubs.c \
- mterp/out/InterpAsm-allstubs.S
-endif
-
+# liblog and libcutils are shared for target.
+LOCAL_SHARED_LIBRARIES += \
+ liblog libcutils
LOCAL_MODULE := libdvm
-LOCAL_SHARED_LIBRARIES += \
- liblog \
- libcutils \
- libnativehelper \
- libz
-
-LOCAL_STATIC_LIBRARIES += \
- libdex
-
include $(BUILD_SHARED_LIBRARY)
+
+
+#
+# Build for the host.
+#
+
+ifeq ($(WITH_HOST_DALVIK),true)
+
+ include $(CLEAR_VARS)
+
+ # Variables used in the included Dvm.mk.
+ dvm_os := $(HOST_OS)
+ dvm_arch := $(HOST_ARCH)
+ dvm_arch_variant := $(HOST_ARCH_VARIANT)
+ dvm_simulator := false
+
+ include $(LOCAL_PATH)/Dvm.mk
+
+ # liblog and libcutils are static for host.
+ LOCAL_STATIC_LIBRARIES += \
+ liblog libcutils
+
+ # libffi is called libffi-host on the host. Similarly libnativehelper.
+ LOCAL_SHARED_LIBRARIES := \
+ $(patsubst libffi,libffi-host,$(LOCAL_SHARED_LIBRARIES))
+ LOCAL_SHARED_LIBRARIES := \
+ $(patsubst libnativehelper,libnativehelper-host,$(LOCAL_SHARED_LIBRARIES))
+
+ LOCAL_MODULE := libdvm-host
+
+ include $(BUILD_HOST_SHARED_LIBRARY)
+
+endif
diff --git a/vm/Dvm.mk b/vm/Dvm.mk
new file mode 100644
index 0000000..1280c17
--- /dev/null
+++ b/vm/Dvm.mk
@@ -0,0 +1,332 @@
+# Copyright (C) 2008 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#
+# Common definitions for host or target builds of libdvm.
+#
+# If you enable or disable optional features here,
+# rebuild the VM with "make clean-libdvm && make -j4 libdvm".
+#
+
+
+#
+# Compiler defines.
+#
+LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps
+
+#
+# Optional features. These may impact the size or performance of the VM.
+#
+LOCAL_CFLAGS += -DWITH_PROFILER -DWITH_DEBUGGER
+
+# 0=full cache, 1/2=reduced, 3=no cache
+LOCAL_CFLAGS += -DDVM_RESOLVER_CACHE=0
+
+ifeq ($(WITH_DEADLOCK_PREDICTION),true)
+ LOCAL_CFLAGS += -DWITH_DEADLOCK_PREDICTION
+ WITH_MONITOR_TRACKING := true
+endif
+ifeq ($(WITH_MONITOR_TRACKING),true)
+ LOCAL_CFLAGS += -DWITH_MONITOR_TRACKING
+endif
+
+# Make a debugging version when building the simulator (if not told
+# otherwise) and when explicitly asked.
+dvm_make_debug_vm := false
+ifeq ($(strip $(DEBUG_DALVIK_VM)),)
+ ifeq ($(dvm_simulator),true)
+ dvm_make_debug_vm := true
+ endif
+else
+ dvm_make_debug_vm := $(DEBUG_DALVIK_VM)
+endif
+
+ifeq ($(dvm_make_debug_vm),true)
+ #
+ # "Debug" profile:
+ # - debugger enabled
+ # - profiling enabled
+ # - tracked-reference verification enabled
+ # - allocation limits enabled
+ # - GDB helpers enabled
+ # - LOGV
+ # - assert()
+ #
+ LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
+ LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
+ LOCAL_CFLAGS += -DWITH_TRACKREF_CHECKS
+ LOCAL_CFLAGS += -DWITH_ALLOC_LIMITS
+ LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
+ #LOCAL_CFLAGS += -DCHECK_MUTEX
+ #LOCAL_CFLAGS += -DPROFILE_FIELD_ACCESS
+ LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=3
+ # add some extra stuff to make it easier to examine with GDB
+ LOCAL_CFLAGS += -DEASY_GDB
+ # overall config may be for a "release" build, so reconfigure these
+ LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
+else # !dvm_make_debug_vm
+ #
+ # "Performance" profile:
+ # - all development features disabled
+ # - compiler optimizations enabled (redundant for "release" builds)
+ # - (debugging and profiling still enabled)
+ #
+ #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
+ # "-O2" is redundant for device (release) but useful for sim (debug)
+ #LOCAL_CFLAGS += -O2 -Winline
+ #LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
+ LOCAL_CFLAGS += -DWITH_EXTRA_GC_CHECKS=1
+ LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
+ # if you want to try with assertions on the device, add:
+ #LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
+endif # !dvm_make_debug_vm
+
+# bug hunting: checksum and verify interpreted stack when making JNI calls
+#LOCAL_CFLAGS += -DWITH_JNI_STACK_CHECK
+
+LOCAL_SRC_FILES := \
+ AllocTracker.c \
+ AtomicCache.c \
+ CheckJni.c \
+ Ddm.c \
+ Debugger.c \
+ DvmDex.c \
+ Exception.c \
+ Hash.c \
+ IndirectRefTable.c.arm \
+ Init.c \
+ InlineNative.c.arm \
+ Inlines.c \
+ Intern.c \
+ Jni.c \
+ JarFile.c \
+ LinearAlloc.c \
+ Misc.c.arm \
+ Native.c \
+ PointerSet.c \
+ Profile.c \
+ Properties.c \
+ RawDexFile.c \
+ ReferenceTable.c \
+ SignalCatcher.c \
+ StdioConverter.c \
+ Sync.c \
+ Thread.c \
+ UtfString.c \
+ alloc/clz.c.arm \
+ alloc/Alloc.c \
+ alloc/HeapBitmap.c.arm \
+ alloc/HeapDebug.c \
+ alloc/HeapSource.c \
+ alloc/HeapTable.c \
+ alloc/HeapWorker.c \
+ alloc/Heap.c.arm \
+ alloc/MarkSweep.c.arm \
+ alloc/DdmHeap.c \
+ analysis/CodeVerify.c \
+ analysis/DexOptimize.c \
+ analysis/DexVerify.c \
+ analysis/ReduceConstants.c \
+ analysis/RegisterMap.c \
+ analysis/VerifySubs.c \
+ interp/Interp.c.arm \
+ interp/Stack.c \
+ jdwp/ExpandBuf.c \
+ jdwp/JdwpAdb.c \
+ jdwp/JdwpConstants.c \
+ jdwp/JdwpEvent.c \
+ jdwp/JdwpHandler.c \
+ jdwp/JdwpMain.c \
+ jdwp/JdwpSocket.c \
+ mterp/Mterp.c.arm \
+ mterp/out/InterpC-portstd.c.arm \
+ mterp/out/InterpC-portdbg.c.arm \
+ native/InternalNative.c \
+ native/dalvik_system_DexFile.c \
+ native/dalvik_system_SamplingProfiler.c \
+ native/dalvik_system_VMDebug.c \
+ native/dalvik_system_VMRuntime.c \
+ native/dalvik_system_VMStack.c \
+ native/dalvik_system_Zygote.c \
+ native/java_lang_Class.c \
+ native/java_lang_Object.c \
+ native/java_lang_Runtime.c \
+ native/java_lang_String.c \
+ native/java_lang_System.c \
+ native/java_lang_SystemProperties.c \
+ native/java_lang_Throwable.c \
+ native/java_lang_VMClassLoader.c \
+ native/java_lang_VMThread.c \
+ native/java_lang_reflect_AccessibleObject.c \
+ native/java_lang_reflect_Array.c \
+ native/java_lang_reflect_Constructor.c \
+ native/java_lang_reflect_Field.c \
+ native/java_lang_reflect_Method.c \
+ native/java_lang_reflect_Proxy.c \
+ native/java_security_AccessController.c \
+ native/java_util_concurrent_atomic_AtomicLong.c \
+ native/org_apache_harmony_dalvik_NativeTestTarget.c \
+ native/org_apache_harmony_dalvik_ddmc_DdmServer.c \
+ native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.c \
+ native/sun_misc_Unsafe.c \
+ oo/AccessCheck.c \
+ oo/Array.c \
+ oo/Class.c \
+ oo/Object.c \
+ oo/Resolve.c \
+ oo/TypeCheck.c \
+ reflect/Annotation.c \
+ reflect/Proxy.c \
+ reflect/Reflect.c \
+ test/AtomicSpeed.c \
+ test/TestHash.c \
+ test/TestIndirectRefTable.c
+
+ifeq ($(WITH_JIT_TUNING),true)
+ LOCAL_CFLAGS += -DWITH_JIT_TUNING
+endif
+
+ifeq ($(WITH_JIT),true)
+ # NOTE: Turn on assertion for JIT for now
+ LOCAL_CFLAGS += -DWITH_DALVIK_ASSERT
+ # NOTE: Also turn on tuning when JIT is enabled for now
+ LOCAL_CFLAGS += -DWITH_JIT_TUNING
+ LOCAL_CFLAGS += -DWITH_JIT
+ LOCAL_SRC_FILES += \
+ ../dexdump/OpCodeNames.c \
+ compiler/Compiler.c \
+ compiler/Frontend.c \
+ compiler/Utility.c \
+ compiler/IntermediateRep.c \
+ interp/Jit.c
+endif
+
+WITH_HPROF := $(strip $(WITH_HPROF))
+ifeq ($(WITH_HPROF),)
+ WITH_HPROF := true
+endif
+ifeq ($(WITH_HPROF),true)
+ LOCAL_SRC_FILES += \
+ hprof/Hprof.c \
+ hprof/HprofClass.c \
+ hprof/HprofHeap.c \
+ hprof/HprofOutput.c \
+ hprof/HprofString.c
+ LOCAL_CFLAGS += -DWITH_HPROF=1
+
+ ifeq ($(strip $(WITH_HPROF_UNREACHABLE)),true)
+ LOCAL_CFLAGS += -DWITH_HPROF_UNREACHABLE=1
+ endif
+
+ ifeq ($(strip $(WITH_HPROF_STACK)),true)
+ LOCAL_SRC_FILES += \
+ hprof/HprofStack.c \
+ hprof/HprofStackFrame.c
+ LOCAL_CFLAGS += -DWITH_HPROF_STACK=1
+ endif # WITH_HPROF_STACK
+endif # WITH_HPROF
+
+ifeq ($(strip $(DVM_TRACK_HEAP_MARKING)),true)
+ LOCAL_CFLAGS += -DDVM_TRACK_HEAP_MARKING=1
+endif
+
+LOCAL_C_INCLUDES += \
+ $(JNI_H_INCLUDE) \
+ dalvik \
+ dalvik/vm \
+ external/zlib \
+ $(KERNEL_HEADERS)
+
+
+ifeq ($(dvm_simulator),true)
+ LOCAL_LDLIBS += -lpthread -ldl
+ ifeq ($(HOST_OS),linux)
+ # need this for clock_gettime() in profiling
+ LOCAL_LDLIBS += -lrt
+ endif
+else
+ ifeq ($(dvm_os),linux)
+ LOCAL_SHARED_LIBRARIES += libdl
+ endif
+endif
+
+MTERP_ARCH_KNOWN := false
+
+ifeq ($(dvm_arch),arm)
+ #dvm_arch_variant := armv7-a
+ #LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp
+ MTERP_ARCH_KNOWN := true
+ # Select architecture-specific sources (armv4t, armv5te etc.)
+ LOCAL_SRC_FILES += \
+ arch/arm/CallOldABI.S \
+ arch/arm/CallEABI.S \
+ arch/arm/HintsEABI.c \
+ mterp/out/InterpC-$(dvm_arch_variant).c.arm \
+ mterp/out/InterpAsm-$(dvm_arch_variant).S
+
+ ifeq ($(WITH_JIT),true)
+ LOCAL_SRC_FILES += \
+ compiler/codegen/arm/Codegen-$(dvm_arch_variant).c \
+ compiler/codegen/arm/Assemble.c \
+ compiler/codegen/arm/ArchUtility.c \
+ compiler/codegen/arm/LocalOptimizations.c \
+ compiler/codegen/arm/GlobalOptimizations.c \
+ compiler/template/out/CompilerTemplateAsm-$(dvm_arch_variant).S
+ endif
+endif
+
+ifeq ($(dvm_arch),x86)
+ ifeq ($(dvm_os),linux)
+ MTERP_ARCH_KNOWN := true
+ LOCAL_SRC_FILES += \
+ arch/x86/Call386ABI.S \
+ arch/x86/Hints386ABI.c \
+ mterp/out/InterpC-x86.c \
+ mterp/out/InterpAsm-x86.S
+ endif
+endif
+
+ifeq ($(dvm_arch),sh)
+ MTERP_ARCH_KNOWN := true
+ LOCAL_SRC_FILES += \
+ arch/sh/CallSH4ABI.S \
+ arch/generic/Hints.c \
+ mterp/out/InterpC-allstubs.c \
+ mterp/out/InterpAsm-allstubs.S
+endif
+
+ifeq ($(MTERP_ARCH_KNOWN),false)
+ # unknown architecture, try to use FFI
+ LOCAL_C_INCLUDES += external/libffi/$(dvm_os)-$(dvm_arch)
+ LOCAL_SHARED_LIBRARIES += libffi
+
+ LOCAL_SRC_FILES += \
+ arch/generic/Call.c \
+ arch/generic/Hints.c \
+ mterp/out/InterpC-allstubs.c
+
+ # The following symbols are usually defined in the asm file, but
+ # since we don't have an asm file in this case, we instead just
+ # peg them at 0 here, and we add an #ifdef'able define for good
+ # measure, too.
+ LOCAL_CFLAGS += -DdvmAsmInstructionStart=0 -DdvmAsmInstructionEnd=0 \
+ -DdvmAsmSisterStart=0 -DdvmAsmSisterEnd=0 -DDVM_NO_ASM_INTERP=1
+endif
+
+LOCAL_SHARED_LIBRARIES += \
+ libnativehelper \
+ libz
+
+LOCAL_STATIC_LIBRARIES += \
+ libdex
diff --git a/vm/alloc/HeapDebug.c b/vm/alloc/HeapDebug.c
index fc3655f..54b5cb6 100644
--- a/vm/alloc/HeapDebug.c
+++ b/vm/alloc/HeapDebug.c
@@ -15,7 +15,7 @@
*/
#include <fcntl.h>
-#include <malloc.h>
+#include <stdlib.h>
#include "Dalvik.h"
#include "HeapInternal.h"
diff --git a/vm/mterp/Mterp.c b/vm/mterp/Mterp.c
index 60e2de8..053f544 100644
--- a/vm/mterp/Mterp.c
+++ b/vm/mterp/Mterp.c
@@ -27,13 +27,15 @@
*/
bool dvmCheckAsmConstants(void)
{
+ bool failed = false;
+
+#ifndef DVM_NO_ASM_INTERP
+
extern char dvmAsmInstructionStart[];
extern char dvmAsmInstructionEnd[];
extern char dvmAsmSisterStart[];
extern char dvmAsmSisterEnd[];
- bool failed = false;
-
#define ASM_DEF_VERIFY
#include "mterp/common/asm-constants.h"
@@ -57,6 +59,8 @@
LOGV("mterp: interp is %d bytes, sisters are %d bytes\n",
interpSize, sisterSize);
+#endif // ndef DVM_NO_ASM_INTERP
+
return !failed;
}