[pypy-svn] r74940 - pypy/branch/blackhole-improvement/pypy/jit/codewriter

arigo at codespeak.net arigo at codespeak.net
Sun May 30 23:06:00 CEST 2010


Author: arigo
Date: Sun May 30 23:05:59 2010
New Revision: 74940

Modified:
   pypy/branch/blackhole-improvement/pypy/jit/codewriter/codewriter.py
Log:
Detect name collisions and create files called xxx.2, xxx.3, ...


Modified: pypy/branch/blackhole-improvement/pypy/jit/codewriter/codewriter.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/codewriter/codewriter.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/codewriter/codewriter.py	Sun May 30 23:05:59 2010
@@ -98,6 +98,11 @@
             elif ssarepr.name and ssarepr.name != '?':
                 name = ssarepr.name
             else:
-                name = 'unnamed_%x' % id(ssarepr)
-            dir.join(name).write(format_assembler(ssarepr))
+                name = 'unnamed' % id(ssarepr)
+            i = 1
+            extra = ''
+            while dir.join(name+extra).check(exists=1):
+                i += 1
+                extra = '.%d' % i
+            dir.join(name+extra).write(format_assembler(ssarepr))
             log.dot()



More information about the Pypy-commit mailing list