harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From var...@apache.org
Subject svn commit: r666020 - /harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.cpp
Date Tue, 10 Jun 2008 09:04:37 GMT
Author: varlax
Date: Tue Jun 10 02:04:36 2008
New Revision: 666020

URL: http://svn.apache.org/viewvc?rev=666020&view=rev
Log:
Quickfix for logging method with too long signature (met at SPECjvm2008/derby)

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.cpp?rev=666020&r1=666019&r2=666020&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.cpp Tue Jun 10 02:04:36 2008
@@ -336,18 +336,18 @@
 
     void replace_class  ()      
     {
-        insert(Str(classname), true);
+        if (classname) insert(Str(classname), true);
     }
 
     void replace_tree   ()      
     {
-        insert(Str(classname), false);
+        if (classname) insert(Str(classname), false);
     }
 
     void replace_method ()      
     {
-        insert(Str(methodname), true);
-        insert(Str(signature), true);
+        if (methodname) insert(Str(methodname), true);
+        if (signature) insert(Str(signature), true);
     }
 
     void replace_seqnb  ()      
@@ -423,7 +423,9 @@
 
 void StrSubstitution::insert (Str s, bool fix)
 {
-    assert(dptr + s.count < dend);
+    bool truncate = !(dptr + s.count < dend);
+    int max_len = truncate ? dend - dptr - 1 : s.count;
+    assert(max_len > 0);
 
     if (s.empty())
     {
@@ -433,7 +435,7 @@
 
     if (fix)
     {
-        for (const char* sptr = s.ptr, * send = s.ptr + s.count; sptr != send;)
+        for (const char* sptr = s.ptr, * send = s.ptr + max_len; sptr != send;)
         {
             char c = *sptr++;
             if (c == '/')
@@ -443,8 +445,8 @@
     }
     else
     {
-        memcpy(dptr, s.ptr, s.count);
-        dptr += s.count;
+        memcpy(dptr, s.ptr, max_len);
+        dptr += max_len;
     }
 }
 



Mime
View raw message