You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ap...@apache.org on 2006/12/26 13:08:22 UTC

svn commit: r490289 - in /harmony/enhanced/drlvm/trunk/vm/jitrino/src: optimizer/inliner.cpp shared/methodtable.cpp shared/methodtable.h

Author: apetrenko
Date: Tue Dec 26 04:08:21 2006
New Revision: 490289

URL: http://svn.apache.org/viewvc?view=rev&rev=490289
Log:
Patch for HARMONY-2839 "[drlvm][jit] Memory leaks and logical fixes in Jitrino.OPT inliner's method filters table"

Modified:
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/methodtable.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/methodtable.h

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp?view=diff&rev=490289&r1=490288&r2=490289
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp Tue Dec 26 04:08:21 2006
@@ -117,17 +117,16 @@
 
     _inlineSkipExceptionPath = argSource->getBoolArg("skip_exception_path", INLINE_SKIP_EXCEPTION_PATH);
 #if defined  (_EM64T_) || defined (_IPF_)
-    _inlineSkipApiMagicMethods  = true;
+    _inlineSkipApiMagicMethods  = false;
 #else
-    _inlineSkipApiMagicMethods = argSource->getBoolArg("skip_api_magics", false);
+    _inlineSkipApiMagicMethods = argSource->getBoolArg("skip_api_magics", true);
 #endif 
 
-    const char* skipMethods = argSource->getStringArg("skip_methods", "");
+    const char* skipMethods = argSource->getStringArg("skip_methods", NULL);
     _inlineSkipMethodTable = NULL;
-    if(skipMethods != NULL || !_inlineSkipApiMagicMethods) {
-        std::string skipMethodsStr = skipMethods;
-        _inlineSkipMethodTable = new (_tmpMM) Method_Table(_tmpMM, skipMethodsStr.c_str(), "SKIP_METHODS", true);
-        if (!_inlineSkipApiMagicMethods) {
+    if(skipMethods != NULL || _inlineSkipApiMagicMethods) {
+        _inlineSkipMethodTable = new (_tmpMM) Method_Table(_tmpMM, skipMethods, "SKIP_METHODS", false);
+        if (_inlineSkipApiMagicMethods) {
 #if defined  (_EM64T_) || defined (_IPF_)
 //TODO: IA32 helpers should work on EM64T too -> TODO test
 #else

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/methodtable.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/methodtable.cpp?view=diff&rev=490289&r1=490288&r2=490289
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/methodtable.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/methodtable.cpp Tue Dec 26 04:08:21 2006
@@ -74,6 +74,14 @@
 #define FILE_CHAR ':'
 
 
+char* strdup(MemoryManager& mm , const char* str) {
+    size_t len  = strlen(str);
+    char* newstr = new (mm) char[len+1];
+    strncpy(newstr, str, len);
+    newstr[len]='\0';
+    return newstr;
+}
+
 void Method_Table::make_filename(char *str, int len)
 {
     _method_file = new (_mm) char[1+len];
@@ -145,7 +153,7 @@
     if (i >= len) // no class or descriptor
     {
         if (str[0] != '\0')
-            rec->method_name = strdup(str);
+            rec->method_name = strdup(_mm, str);
         return;
     }
     if (is_at_class_method_separator)
@@ -165,7 +173,7 @@
         if (i >= len) // no descriptor
         {
             if (str[0] != '\0')
-                rec->method_name = strdup(str);
+                rec->method_name = strdup(_mm, str);
             return;
         }
     }
@@ -176,7 +184,7 @@
         strncpy(rec->method_name, str, i);
         rec->method_name[i] = '\0';
     }
-    rec->signature = strdup(&str[i]);
+    rec->signature = strdup(_mm, &str[i]);
 }
 
 // Returns true on success, false on failure
@@ -226,7 +234,6 @@
 
     if (envvar == NULL || envvar[0] == '\0')
     {
-        _accept_all = true;
         return;
     }
     // strip away double-quote characters
@@ -257,7 +264,6 @@
     }
     if (i == 0) // no legitimate filename given
     {
-        _accept_all = true;
         return;
     }
     else if (i == evlen-1) // filename only, no ranges
@@ -269,7 +275,6 @@
         {
             fprintf(stderr, "Couldn't truncate method table file %s\n",
                 _method_file);
-            _accept_all = true;
             _dump_to_file = false;
         }
         else
@@ -342,12 +347,10 @@
   _mm(memManager),
   _method_table     (_mm),
   _decision_table   (_mm),
-  _default_decision (mt_accepted),
-  _accept_all       (false),
   _dump_to_file     (false),
-  _method_file      (NULL),
-  _accept_by_default(accept_by_default)
+  _method_file      (NULL)
 {
+    _default_decision = accept_by_default ? mt_accepted : mt_rejected;
     init(default_envvar, envvarname);
 }
   
@@ -363,9 +366,7 @@
 {
     int i;
     
-    if (_accept_all)
-        return _accept_by_default;
-
+    
     if (_dump_to_file)
     {
         FILE *file = fopen(_method_file, "a");

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/methodtable.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/methodtable.h?view=diff&rev=490289&r1=490288&r2=490289
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/methodtable.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/shared/methodtable.h Tue Dec 26 04:08:21 2006
@@ -67,10 +67,8 @@
     Records _method_table;
     Records _decision_table;
     Decision _default_decision;
-    bool _accept_all;
     bool _dump_to_file;
     char *_method_file;
-    bool _accept_by_default;
 
     void init(const char *default_envvar, const char *envvarname);
     void make_filename(char *str, int len);