OSDN Git Service

am 0f0e6f10: Merge "The ICU data is no longer compiled directly into the shared libra...
authorJoe Onorato <joeo@android.com>
Thu, 15 Jul 2010 18:12:43 +0000 (11:12 -0700)
committerAndroid Git Automerger <android-git-automerger@android.com>
Thu, 15 Jul 2010 18:12:43 +0000 (11:12 -0700)
Merge commit '0f0e6f10f9029a958683b0830d47b21bc993a067' into gingerbread-plus-aosp

* commit '0f0e6f10f9029a958683b0830d47b21bc993a067':
  The ICU data is no longer compiled directly into the shared library.

vm/Android.mk
vm/Thread.c
vm/arch/x86-atom/Call386ABI.S
vm/native/java_lang_Runtime.c

index 45f15e5..ff20a17 100644 (file)
@@ -47,9 +47,11 @@ host_smp_flag := -DANDROID_SMP=1
 include $(LOCAL_PATH)/ReconfigureDvm.mk
 
 # Overwrite default settings
+ifneq ($(TARGET_ARCH),x86)
 ifeq ($(TARGET_SIMULATOR),false)
     LOCAL_PRELINK_MODULE := true
 endif
+endif
 LOCAL_MODULE_TAGS := user
 LOCAL_MODULE := libdvm
 LOCAL_CFLAGS += $(target_smp_flag)
index f15b5dc..50f5416 100644 (file)
@@ -1313,7 +1313,6 @@ static bool createFakeRunFrame(Thread* thread)
  */
 static void setThreadName(const char *threadName)
 {
-#if defined(HAVE_PRCTL)
     int hasAt = 0;
     int hasDot = 0;
     const char *s = threadName;
@@ -1328,7 +1327,13 @@ static void setThreadName(const char *threadName)
     } else {
         s = threadName + len - 15;
     }
+#if defined(HAVE_PTHREAD_SETNAME_NP)
+    if (pthread_setname_np(pthread_self(), s) != 0)
+        LOGW("Unable to set the name of the current thread\n");
+#elif defined(HAVE_PRCTL)
     prctl(PR_SET_NAME, (unsigned long) s, 0, 0, 0);
+#else
+    LOGD("Unable to set current thread's name: %s\n", s);
 #endif
 }
 
index 9e3b916..1146c2d 100644 (file)
@@ -149,8 +149,42 @@ CallABI_ENTER:
     movl        32(%ebp), %ecx          # %ecx<- return pointer
     je          2f                      # handle double return
     jl          1f                      # handle float return
+
+   /*
+    *  If a native function returns a result smaller than 8-bytes
+    *  then higher bytes may contain garbage.
+    *  This code does type-checking based on size of return result.
+    *  We zero higher bytes instead of allowing the garbage to go through.
+    */
+
+    cmpl        $3,%ebx
+    je  S8
+    cmpl        $4,%ebx
+    je          S4
+    cmpl        $7,%ebx
+    je          S1
+    cmpl        $6,%ebx
+    jne S2
+U2:
+    movzwl      %ax, %eax
+    movl        %eax, (%ecx)            # save 32-bit return
+    jmp         CallABI_EXIT            # exit call
+
+S1:
+    movsbl      %al, %eax
     movl        %eax, (%ecx)            # save 32-bit return
+    jmp         CallABI_EXIT            # exit call
+S2:
+    movswl      %ax, %eax
+    movl        %eax, (%ecx)            # save 32-bit return
+    jmp         CallABI_EXIT            # exit call
+S4:
+    cltd
+    movl        %eax, (%ecx)            # save 32-bit return
+    jmp         CallABI_EXIT            # exit call
+S8:
     movl        %edx, 4(%ecx)           # save 64-bit return
+    movl        %eax, (%ecx)            # save 32-bit return
     jmp         CallABI_EXIT            # exit call
 
 2:
index b5c0aee..5170eed 100644 (file)
@@ -19,7 +19,8 @@
  */
 #include "Dalvik.h"
 #include "native/InternalNativePriv.h"
-
+#include <unistd.h>
+#include <limits.h>
 
 /*
  * public void gc()
@@ -109,6 +110,26 @@ static void Dalvik_java_lang_Runtime_runFinalization(const u4* args,
 }
 
 /*
+ * public int availableProcessors()
+ *
+ * Returns the number of online processors, at least one.
+ *
+ */
+static void Dalvik_java_lang_Runtime_availableProcessors(const u4* args,
+    JValue* pResult)
+{
+    long result = 1;
+#ifdef _SC_NPROCESSORS_ONLN
+    result = sysconf(_SC_NPROCESSORS_ONLN);
+    if (result > INT_MAX) {
+        result = INT_MAX;
+    } else if (result < 1 ) {
+        result = 1;
+    }
+#endif
+    RETURN_INT((int)result);
+}
+/*
  * public void maxMemory()
  *
  * Returns GC heap max memory in bytes.
@@ -152,6 +173,8 @@ const DalvikNativeMethod dvm_java_lang_Runtime[] = {
         Dalvik_java_lang_Runtime_freeMemory },
     { "gc",                 "()V",
         Dalvik_java_lang_Runtime_gc },
+    { "availableProcessors", "()I",
+        Dalvik_java_lang_Runtime_availableProcessors },
     { "maxMemory",          "()J",
         Dalvik_java_lang_Runtime_maxMemory },
     { "nativeExit",         "(IZ)V",