[pypy-svn] r25245 - pypy/dist/pypy/translator/squeak

nik at codespeak.net nik at codespeak.net
Mon Apr 3 10:20:20 CEST 2006


Author: nik
Date: Mon Apr  3 10:20:19 2006
New Revision: 25245

Modified:
   pypy/dist/pypy/translator/squeak/node.py
   pypy/dist/pypy/translator/squeak/opformatter.py
Log:
argh, major thinking error. of course i can't really remove operations from
the graph that return a result with a type different from the argument.


Modified: pypy/dist/pypy/translator/squeak/node.py
==============================================================================
--- pypy/dist/pypy/translator/squeak/node.py	(original)
+++ pypy/dist/pypy/translator/squeak/node.py	Mon Apr  3 10:20:19 2006
@@ -197,7 +197,7 @@
                 yield "]"
 
     def apply_backendopt(self, graph):
-        remove_unaryops(graph, OpFormatter.noops)
+        remove_unaryops(graph, ["same_as"])
 
 class MethodNode(CallableNode):
 

Modified: pypy/dist/pypy/translator/squeak/opformatter.py
==============================================================================
--- pypy/dist/pypy/translator/squeak/opformatter.py	(original)
+++ pypy/dist/pypy/translator/squeak/opformatter.py	Mon Apr  3 10:20:19 2006
@@ -29,7 +29,6 @@
         'new':         'new',
         'runtimenew':  'new',
         'classof':     'class',
-        'same_as':     'yourself', 
         'bool_not':    'not',
 
         'cast_int_to_float': 'asFloat',
@@ -71,7 +70,7 @@
 
     wrapping_ops = "neg", "invert", "add", "sub", "mul", "lshift"
 
-    noops = "ooupcast", "oodowncast", "cast_char_to_int", \
+    noops = "same_as", "ooupcast", "oodowncast", "cast_char_to_int", \
             "cast_unichar_to_int", "cast_int_to_unichar", \
             "cast_int_to_char", "cast_int_to_longlong", \
             "truncate_longlong_to_int"
@@ -188,3 +187,8 @@
         truncated = Message("truncated").send_to(op.args[0], [])
         return Assignment(op.result, self.apply_mask_helper(truncated, "uint"))
 
+    def noop(self, op):
+        return Assignment(op.result, op.args[0])
+
+for opname in OpFormatter.noops:
+    setattr(OpFormatter, "op_%s" % opname, OpFormatter.noop)



More information about the Pypy-commit mailing list