OSDN Git Service

Use GCC visibility to reduce the size of libdvm by 10%
[android-x86/dalvik.git] / vm / Dvm.mk
index 96298f0..ddc8519 100644 (file)
--- a/vm/Dvm.mk
+++ b/vm/Dvm.mk
@@ -15,8 +15,9 @@
 #
 # 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".
+# If you enable or disable optional features here, make sure you do
+# a "clean" build -- not everything depends on Dalvik.h.  (See Android.mk
+# for the exact command.)
 #
 
 
@@ -25,6 +26,7 @@
 #
 LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps
 #LOCAL_CFLAGS += -DUSE_INDIRECT_REF
+LOCAL_CFLAGS += -include "dalvikdefines.h"
 
 #
 # Optional features.  These may impact the size or performance of the VM.
@@ -63,6 +65,7 @@ ifeq ($(dvm_make_debug_vm),true)
   # - GDB helpers enabled
   # - LOGV
   # - assert()
+  # - full ELF symbols
   #
   LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
   LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
@@ -82,6 +85,7 @@ else  # !dvm_make_debug_vm
   # - all development features disabled
   # - compiler optimizations enabled (redundant for "release" builds)
   # - (debugging and profiling still enabled)
+  # - minimize ELF symbols to reduce code size by 10%
   #
   #LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
   # "-O2" is redundant for device (release) but useful for sim (debug)
@@ -90,6 +94,8 @@ else  # !dvm_make_debug_vm
   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
+  # use GCC Visibility to reduce the footprint of runtime library
+  LOCAL_CFLAGS += -fvisibility=hidden
 endif  # !dvm_make_debug_vm
 
 # bug hunting: checksum and verify interpreted stack when making JNI calls
@@ -122,6 +128,7 @@ LOCAL_SRC_FILES := \
        SignalCatcher.c \
        StdioConverter.c \
        Sync.c \
+       TestCompability.c \
        Thread.c \
        UtfString.c \
        alloc/clz.c.arm \
@@ -198,9 +205,6 @@ WITH_JIT := $(strip $(WITH_JIT))
 
 ifeq ($(WITH_JIT),true)
   LOCAL_CFLAGS += -DWITH_JIT
-  # Enable assert and JIT_TUNING for now
-  LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
-  WITH_JIT_TUNING := true
   LOCAL_SRC_FILES += \
        ../dexdump/OpCodeNames.c \
        compiler/Compiler.c \
@@ -209,19 +213,10 @@ ifeq ($(WITH_JIT),true)
        compiler/IntermediateRep.c \
        compiler/Dataflow.c \
        compiler/Loop.c \
+       compiler/Ralloc.c \
        interp/Jit.c
 endif
 
-ifeq ($(strip $(WITH_JIT_TUNING)),true)
-  LOCAL_CFLAGS += -DWITH_JIT_TUNING
-endif
-
-# Enable JIT self verification tool. Runs compiled traces natively, then replays
-# them with the interpreter, and ensures memory and register state are the same.
-ifeq ($(WITH_SELF_VERIFICATION),true)
-  LOCAL_CFLAGS += -DWITH_SELF_VERIFICATION
-endif
-
 WITH_HPROF := $(strip $(WITH_HPROF))
 ifeq ($(WITH_HPROF),)
   WITH_HPROF := true
@@ -287,7 +282,9 @@ ifeq ($(dvm_arch),arm)
 
   ifeq ($(WITH_JIT),true)
     LOCAL_SRC_FILES += \
-               compiler/codegen/arm/Codegen-$(dvm_arch_variant).c \
+               compiler/codegen/arm/RallocUtil.c \
+               compiler/codegen/arm/$(dvm_arch_variant)/Codegen.c \
+               compiler/codegen/arm/$(dvm_arch_variant)/CallingConvention.S \
                compiler/codegen/arm/Assemble.c \
                compiler/codegen/arm/ArchUtility.c \
                compiler/codegen/arm/LocalOptimizations.c \
@@ -300,10 +297,10 @@ 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
+               arch/$(dvm_arch_variant)/Call386ABI.S \
+               arch/$(dvm_arch_variant)/Hints386ABI.c \
+               mterp/out/InterpC-$(dvm_arch_variant).c \
+               mterp/out/InterpAsm-$(dvm_arch_variant).S
   endif
 endif
 
@@ -339,3 +336,7 @@ ifeq ($(MTERP_ARCH_KNOWN),false)
   LOCAL_CFLAGS += -DdvmAsmInstructionStart=0 -DdvmAsmInstructionEnd=0 \
        -DdvmAsmSisterStart=0 -DdvmAsmSisterEnd=0 -DDVM_NO_ASM_INTERP=1
 endif
+
+ifeq ($(TEST_VM_IN_ECLAIR),true)
+  LOCAL_CFLAGS += -DTEST_VM_IN_ECLAIR
+endif