[pypy-svn] r65201 - pypy/trunk/pypy/translator/c/gcc
arigo at codespeak.net
arigo at codespeak.net
Sun May 10 17:02:14 CEST 2009
Author: arigo
Date: Sun May 10 17:02:12 2009
New Revision: 65201
Modified:
pypy/trunk/pypy/translator/c/gcc/trackgcroot.py
Log:
Derive a name for these symbols from the filename,
instead of using a counter. (The latter fails to
work with the way the Makefile calls trackgcroot:
all files are number 0 in this case.)
Modified: pypy/trunk/pypy/translator/c/gcc/trackgcroot.py
==============================================================================
--- pypy/trunk/pypy/translator/c/gcc/trackgcroot.py (original)
+++ pypy/trunk/pypy/translator/c/gcc/trackgcroot.py Sun May 10 17:02:12 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