Author: Ronan Lamy <[email protected]>
Branch: translation-cleanup
Changeset: r57699:50cade423a45
Date: 2012-10-01 05:56 +0100
http://bitbucket.org/pypy/pypy/changeset/50cade423a45/
Log: Split FrameState.nonmergeable into blocklist and next_instr
diff --git a/pypy/objspace/flow/flowcontext.py
b/pypy/objspace/flow/flowcontext.py
--- a/pypy/objspace/flow/flowcontext.py
+++ b/pypy/objspace/flow/flowcontext.py
@@ -285,9 +285,7 @@
data.append(self.last_exception.w_type)
data.append(self.last_exception.w_value)
recursively_flatten(self.space, data)
- nonmergeable = (self.get_blocklist(),
- self.last_instr) # == next_instr when between bytecodes
- return FrameState(data, nonmergeable)
+ return FrameState(data, self.get_blocklist(), self.last_instr)
def setstate(self, state):
""" Reset the frame to the given state. """
@@ -299,8 +297,8 @@
self.last_exception = None
else:
self.last_exception = FSException(data[-2], data[-1])
- blocklist, self.last_instr = state.nonmergeable
- self.set_blocklist(blocklist)
+ self.last_instr = state.next_instr
+ self.set_blocklist(state.blocklist)
def recording(self, block):
""" Setup recording of the block and return the recorder. """
diff --git a/pypy/objspace/flow/framestate.py b/pypy/objspace/flow/framestate.py
--- a/pypy/objspace/flow/framestate.py
+++ b/pypy/objspace/flow/framestate.py
@@ -2,10 +2,10 @@
from pypy.objspace.flow.model import *
class FrameState:
- def __init__(self, mergeable, nonmergeable):
+ def __init__(self, mergeable, blocklist, next_instr):
self.mergeable = mergeable
- self.nonmergeable = nonmergeable
- self.next_instr = self.nonmergeable[1]
+ self.blocklist = blocklist
+ self.next_instr = next_instr
for w1 in self.mergeable:
assert isinstance(w1, (Variable, Constant)) or w1 is None, (
'%r found in frame state' % w1)
@@ -17,7 +17,7 @@
if isinstance(w, Variable):
w = Variable()
newstate.append(w)
- return FrameState(newstate, self.nonmergeable)
+ return FrameState(newstate, self.blocklist, self.next_instr)
def getvariables(self):
return [w for w in self.mergeable if isinstance(w, Variable)]
@@ -29,7 +29,8 @@
# nonmergeable states
assert isinstance(other, FrameState)
assert len(self.mergeable) == len(other.mergeable)
- assert self.nonmergeable == other.nonmergeable
+ assert self.blocklist == other.blocklist
+ assert self.next_instr == other.next_instr
for w1, w2 in zip(self.mergeable, other.mergeable):
if not (w1 == w2 or (isinstance(w1, Variable) and
isinstance(w2, Variable))):
@@ -50,7 +51,7 @@
newstate.append(union(w1, w2))
except UnionError:
return None
- return FrameState(newstate, self.nonmergeable)
+ return FrameState(newstate, self.blocklist, self.next_instr)
def getoutputargs(self, targetstate):
"Return the output arguments needed to link self to targetstate."
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit