[pypy-svn] r44563 - in pypy/dist/pypy: rpython rpython/lltypesystem rpython/ootypesystem rpython/test translator/cli/test

antocuni at codespeak.net antocuni at codespeak.net
Wed Jun 27 16:30:44 CEST 2007


Author: antocuni
Date: Wed Jun 27 16:30:43 2007
New Revision: 44563

Modified:
   pypy/dist/pypy/rpython/lltypesystem/typecache.py
   pypy/dist/pypy/rpython/ootypesystem/rpbc.py
   pypy/dist/pypy/rpython/rpbc.py
   pypy/dist/pypy/rpython/test/test_rclass.py
   pypy/dist/pypy/translator/cli/test/test_silverpython.py
Log:
append _variant0 to method names only when necessary



Modified: pypy/dist/pypy/rpython/lltypesystem/typecache.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/typecache.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/typecache.py	Wed Jun 27 16:30:43 2007
@@ -4,4 +4,5 @@
 ('', ('32bit', 'WindowsPE'), 'Windows'):{'short': 16, 'int': 32, 'unsigned char': 8, 'long': 32, 'char': 8, 'unsigned short': 16, 'unsigned long': 32, 'long long': 64, 'unsigned long long': 64, 'size_t': 32, 'unsigned int': 32},
 ('i386', ('32bit', ''), 'Darwin'):{'short': 16, 'int': 32, 'unsigned char': 8, 'long': 32, 'char': 8, 'unsigned short': 16, 'unsigned long': 32, 'long long': 64, 'mode_t': 16, 'unsigned long long': 64, 'size_t': 32, 'unsigned int': 32},
 ('Intel(R) Pentium(R) M processor 1.73GHz', ('32bit', ''), 'Linux'):{'short': 16, 'int': 32, 'unsigned char': 8, 'long': 32, 'char': 8, 'unsigned short': 16, 'unsigned long': 32, 'long long': 64, 'mode_t': 32, 'unsigned long long': 64, 'size_t': 32, 'unsigned int': 32},
+('Intel(R) Core(TM)2 CPU         T7200  @ 2.00GHz', ('32bit', ''), 'Linux'):{'short': 16, 'int': 32, 'unsigned char': 8, 'long': 32, 'char': 8, 'unsigned short': 16, 'unsigned long': 32, 'long long': 64, 'mode_t': 32, 'unsigned long long': 64, 'size_t': 32, 'unsigned int': 32},
 }

Modified: pypy/dist/pypy/rpython/ootypesystem/rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/ootypesystem/rpbc.py	(original)
+++ pypy/dist/pypy/rpython/ootypesystem/rpbc.py	Wed Jun 27 16:30:43 2007
@@ -56,7 +56,10 @@
 
 
 def row_method_name(methodname, rowname):
-    return "%s_%s" % (methodname, rowname)
+    if rowname is None:
+        return methodname
+    else:
+        return "%s_%s" % (methodname, rowname)
     
 class MethodImplementations(object):
 

Modified: pypy/dist/pypy/rpython/rpbc.py
==============================================================================
--- pypy/dist/pypy/rpython/rpbc.py	(original)
+++ pypy/dist/pypy/rpython/rpbc.py	Wed Jun 27 16:30:43 2007
@@ -147,8 +147,11 @@
         assert biggerrow == row   # otherwise, addrow() is broken
         concretetable[shape, index] = row
 
-    for finalindex, row in enumerate(uniquerows):
-        row.attrname = 'variant%d' % finalindex
+    if len(uniquerows) == 1:
+        uniquerows[0].attrname = None
+    else:
+        for finalindex, row in enumerate(uniquerows):
+            row.attrname = 'variant%d' % finalindex
 
     return concretetable, uniquerows
 

Modified: pypy/dist/pypy/rpython/test/test_rclass.py
==============================================================================
--- pypy/dist/pypy/rpython/test/test_rclass.py	(original)
+++ pypy/dist/pypy/rpython/test/test_rclass.py	Wed Jun 27 16:30:43 2007
@@ -700,7 +700,7 @@
         t.buildrtyper(type_system=self.type_system).specialize()
         graph = graphof(t, f)
         TYPE = graph.startblock.operations[0].args[0].value
-        _, meth = TYPE._lookup("o__del___variant0")
+        _, meth = TYPE._lookup("o__del__")
         assert meth.finalizer
 
     def test_del_inheritance(self):
@@ -734,9 +734,9 @@
         TYPEA = graph.startblock.operations[0].args[0].value
         TYPEB = graph.startblock.operations[2].args[0].value
         TYPEC = graph.startblock.operations[4].args[0].value
-        _, destra = TYPEA._lookup("o__del___variant0")
-        _, destrb = TYPEB._lookup("o__del___variant0")
-        _, destrc = TYPEC._lookup("o__del___variant0")
+        _, destra = TYPEA._lookup("o__del__")
+        _, destrb = TYPEB._lookup("o__del__")
+        _, destrc = TYPEC._lookup("o__del__")
         assert destra == destrc
         assert destrb is not None
         assert destra is not None

Modified: pypy/dist/pypy/translator/cli/test/test_silverpython.py
==============================================================================
--- pypy/dist/pypy/translator/cli/test/test_silverpython.py	(original)
+++ pypy/dist/pypy/translator/cli/test/test_silverpython.py	Wed Jun 27 16:30:43 2007
@@ -118,7 +118,7 @@
         dll.compile()
         res = self._csharp('test', """
             Test.MyClass obj = new Test.MyClass();
-            obj.__init___variant0(39);
-            Console.WriteLine(obj.add_variant0(1, 2));
+            obj.__init__(39);
+            Console.WriteLine(obj.add(1, 2));
         """)
         assert res == 42



More information about the Pypy-commit mailing list