[pypy-svn] rev 1499 - pypy/trunk/src/pypy/objspace/flow
arigo at codespeak.net
arigo at codespeak.net
Wed Oct 1 13:56:49 CEST 2003
Author: arigo
Date: Wed Oct 1 13:56:49 2003
New Revision: 1499
Modified:
pypy/trunk/src/pypy/objspace/flow/flowcontext.py
pypy/trunk/src/pypy/objspace/flow/wrapper.py
Log:
Different variables no longer compare equal
Modified: pypy/trunk/src/pypy/objspace/flow/flowcontext.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/flowcontext.py (original)
+++ pypy/trunk/src/pypy/objspace/flow/flowcontext.py Wed Oct 1 13:56:49 2003
@@ -5,6 +5,14 @@
from pypy.objspace.flow.wrapper import W_Variable, W_Constant, UnwrapException
from pypy.translator.flowmodel import *
+
+def constantsof(lst):
+ result = {}
+ for i in range(len(lst)):
+ if isinstance(lst[i], W_Constant):
+ result[i] = lst[i]
+ return result
+
class SpamBlock(BasicBlock):
dead = False
@@ -40,14 +48,14 @@
newstate = []
for w1, w2 in zip(mergeablestate1, mergeablestate2):
- if w1 == w2:
+ if w1 == w2 or isinstance(w1, W_Variable):
w = w1
else:
w = W_Variable()
newstate.append(w)
- if newstate == mergeablestate1:
+ if constantsof(newstate) == constantsof(mergeablestate1):
return self
- elif newstate == mergeablestate2:
+ elif constantsof(newstate) == constantsof(mergeablestate2):
return other
else:
return SpamBlock((newstate, unmergeablestate1))
@@ -86,8 +94,8 @@
self.index = 0
def append(self, operation):
- assert operation == self.listtoreplay[self.index]
operation.result = self.listtoreplay[self.index].result
+ assert operation == self.listtoreplay[self.index]
self.index += 1
def finished(self):
Modified: pypy/trunk/src/pypy/objspace/flow/wrapper.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/flow/wrapper.py (original)
+++ pypy/trunk/src/pypy/objspace/flow/wrapper.py Wed Oct 1 13:56:49 2003
@@ -40,12 +40,6 @@
# XXX Somehow importing this at module level doesn't work
raise UnwrapException(self)
- def __eq__(self, other):
- return type(other) is type(self)
-
- def __ne__(self, other):
- return not self.__eq__(other)
-
# ______________________________________________________________________
class W_Variable(W_Object, Variable):
More information about the Pypy-commit
mailing list