[pypy-svn] r65202 - pypy/branch/pyjitpl5/pypy/translator/c/gcc

arigo at codespeak.net arigo at codespeak.net
Sun May 10 17:03:55 CEST 2009


Author: arigo
Date: Sun May 10 17:03:54 2009
New Revision: 65202

Modified:
   pypy/branch/pyjitpl5/pypy/translator/c/gcc/trackgcroot.py
Log:
Merge from the trunk.  Fix test failures (which don't fail
on the trunk, but only on this branch... I'm not sure why).


Modified: pypy/branch/pyjitpl5/pypy/translator/c/gcc/trackgcroot.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/translator/c/gcc/trackgcroot.py	(original)
+++ pypy/branch/pyjitpl5/pypy/translator/c/gcc/trackgcroot.py	Sun May 10 17:03:54 2009
@@ -34,7 +34,6 @@
     def clear(self):
         self.gcmaptable = []
         self.seen_main = False
-        self.files_seen = 0
 
     def dump_raw_table(self, output):
         print >> output, "seen_main = %d" % (self.seen_main,)
@@ -130,10 +129,9 @@
             if in_function:
                 lines = self.process_function(lines, entrypoint, filename)
             newfile.writelines(lines)
-        self.files_seen += 1
 
     def process_function(self, lines, entrypoint, filename):
-        tracker = FunctionGcRootTracker(lines, filetag = self.files_seen)
+        tracker = FunctionGcRootTracker(lines, filetag=getidentifier(filename))
         tracker.is_main = tracker.funcname == entrypoint
         if self.verbose:
             print >> sys.stderr, '[trackgcroot:%s] %s' % (filename,
@@ -408,7 +406,7 @@
         if label is None:
             k = call.lineno
             while 1:
-                label = '__gcmap_IN%d_%s_%d' % (self.filetag, self.funcname, k)
+                label = '__gcmap_%s__%s_%d' % (self.filetag, self.funcname, k)
                 if label not in self.labels:
                     break
                 k += 1
@@ -989,6 +987,19 @@
     del result[5]
     return result
 
+def getidentifier(s):
+    def mapchar(c):
+        if c.isalnum():
+            return c
+        else:
+            return '_'
+    if s.endswith('.s'):
+        s = s[:-2]
+    s = ''.join([mapchar(c) for c in s])
+    while s.endswith('__'):
+        s = s[:-1]
+    return s
+
 
 if __name__ == '__main__':
     verbose = 1



More information about the Pypy-commit mailing list