OSDN Git Service

[JIT] Fix profile trace dump
authorbuzbee <buzbee@google.com>
Fri, 18 Feb 2011 19:13:56 +0000 (11:13 -0800)
committerbuzbee <buzbee@google.com>
Fri, 18 Feb 2011 19:13:56 +0000 (11:13 -0800)
The debugging profile mode prints out a list of the top ten traces,
followed by recompilations.  In some cases, it is possible that a trace
was requested, but did not finish compiling before the run ended.  If
so, that could cause the dump to fail.  This CL adds a check for null
codeAddress to detect those cases.

Change-Id: I415fd94d8fa9e270f75d5114fa5cc5d993bd6997

vm/compiler/codegen/arm/Assemble.c

index f5fecbc..34793ee 100644 (file)
@@ -1991,7 +1991,8 @@ JitTraceDescription *dvmCopyTraceDescriptor(const u2 *pc,
 {
     const JitEntry *jitEntry = knownEntry ? knownEntry
                                           : dvmJitFindEntry(pc, false);
-    if (jitEntry == NULL) return NULL;
+    if ((jitEntry == NULL) || (jitEntry->codeAddress == 0))
+        return NULL;
 
     /* Find out the startint point */
     char *traceBase = getTraceBase(jitEntry);
@@ -2078,8 +2079,10 @@ void dvmCompilerSortAndPrintTraceProfiles()
         }
         JitTraceDescription* desc =
             dvmCopyTraceDescriptor(NULL, &sortedEntries[i]);
-        dvmCompilerWorkEnqueue(sortedEntries[i].dPC,
-                               kWorkOrderTraceDebug, desc);
+        if (desc) {
+            dvmCompilerWorkEnqueue(sortedEntries[i].dPC,
+                                   kWorkOrderTraceDebug, desc);
+        }
     }
 
     free(sortedEntries);