OSDN Git Service

am af242824: Revert "Fix a type error in the allocation of non-moving arrays." per...
[android-x86/dalvik.git] / vm / Sync.c
index 26d4dd9..967a0d0 100644 (file)
--- a/vm/Sync.c
+++ b/vm/Sync.c
@@ -212,11 +212,9 @@ void dvmFreeMonitorList(void)
  */
 void dvmDumpMonitorInfo(const char* msg)
 {
-#if QUIET_ZYGOTE_MONITOR
     if (gDvm.zygote) {
         return;
     }
-#endif
 
     int totalCount;
     int liveCount;
@@ -410,9 +408,12 @@ static void logContentionEvent(Thread *self, u4 waitMs, u4 samplePercent,
     len = strlen(procName);
     cp = logWriteString(cp, procName, len);
 
-    /* Emit the main thread status, 5 bytes. */
-    bool isMainThread = (self->systemTid == getpid());
-    cp = logWriteInt(cp, isMainThread);
+    /* Emit the sensitive thread ("main thread") status, 5 bytes. */
+    bool isSensitive = false;
+    if (gDvm.isSensitiveThreadHook != NULL) {
+        isSensitive = gDvm.isSensitiveThreadHook();
+    }
+    cp = logWriteInt(cp, isSensitive);
 
     /* Emit self thread name string, <= 37 bytes. */
     selfName = dvmGetThreadName(self);
@@ -433,10 +434,10 @@ static void logContentionEvent(Thread *self, u4 waitMs, u4 samplePercent,
 
     /* Emit the lock owner source code file name, <= 37 bytes. */
     if (ownerFileName == NULL) {
-      ownerFileName = "";
+        ownerFileName = "";
     } else if (strcmp(fileName, ownerFileName) == 0) {
-      /* Common case, so save on log space. */
-      ownerFileName = "-";
+        /* Common case, so save on log space. */
+        ownerFileName = "-";
     }
     cp = logWriteString(cp, ownerFileName, strlen(ownerFileName));
 
@@ -660,7 +661,7 @@ static void waitSetRemove(Monitor *mon, Thread *thread)
 /*
  * Converts the given relative waiting time into an absolute time.
  */
-void absoluteTime(s8 msec, s4 nsec, struct timespec *ts)
+static void absoluteTime(s8 msec, s4 nsec, struct timespec *ts)
 {
     s8 endSec;
 
@@ -1009,7 +1010,7 @@ retry:
              * will have tried this before calling out to the VM.
              */
             newThin = thin | (threadId << LW_LOCK_OWNER_SHIFT);
-            if (android_atomic_release_cas(thin, newThin,
+            if (android_atomic_acquire_cas(thin, newThin,
                     (int32_t*)thinp) != 0) {
                 /*
                  * The acquire failed.  Try again.
@@ -1042,7 +1043,7 @@ retry:
                          * owner field.
                          */
                         newThin = thin | (threadId << LW_LOCK_OWNER_SHIFT);
-                        if (android_atomic_release_cas(thin, newThin,
+                        if (android_atomic_acquire_cas(thin, newThin,
                                 (int32_t *)thinp) == 0) {
                             /*
                              * The acquire succeed.  Break out of the
@@ -1249,8 +1250,7 @@ void dvmObjectWait(Thread* self, Object *obj, s8 msec, s4 nsec,
          * any other thread gets a chance.
          */
         inflateMonitor(self, obj);
-        LOG_THIN("(%d) lock %p fattened by wait() to count %d",
-                 self->threadId, &obj->lock, mon->lockCount);
+        LOG_THIN("(%d) lock %p fattened by wait()", self->threadId, &obj->lock);
     }
     mon = LW_MONITOR(obj->lock);
     waitMonitor(self, mon, msec, nsec, interruptShouldThrow);
@@ -1450,7 +1450,7 @@ retry:
              */
             lock = DVM_LOCK_INITIAL_THIN_VALUE;
             lock |= (LW_HASH_STATE_HASHED << LW_HASH_STATE_SHIFT);
-            if (android_atomic_release_cas(
+            if (android_atomic_acquire_cas(
                                 (int32_t)DVM_LOCK_INITIAL_THIN_VALUE,
                                 (int32_t)lock,
                                 (int32_t *)lw) == 0) {