Author: Ronan Lamy <[email protected]>
Branch: framestate
Changeset: r74683:4d0aeb03a210
Date: 2013-05-06 15:51 +0100
http://bitbucket.org/pypy/pypy/changeset/4d0aeb03a210/
Log: handle POP_JUMP_IF_TRUE in the bc_flow() phase
diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py
--- a/rpython/flowspace/bytecode.py
+++ b/rpython/flowspace/bytecode.py
@@ -301,6 +301,13 @@
block.operations[-1] = SWITCH_BOOL(on_False, on_True, offset=self.offset)
block.set_exits([on_False, on_True])
+@flow_opcode
+def POP_JUMP_IF_TRUE(self, block, graph):
+ on_True, _ = graph.pos_index[self.arg]
+ on_False, _ = graph.pos_index[graph.next_pos(self)]
+ block.operations[-1] = SWITCH_BOOL(on_False, on_True, offset=self.offset)
+ block.set_exits([on_False, on_True])
+
class SWITCH_BOOL(BCInstruction):
def __init__(self, on_False, on_True, offset=-1):
self.on_False = on_False
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -697,11 +697,6 @@
if self.guessbool(op.bool(w_cond).eval(self)):
return target
- def POP_JUMP_IF_TRUE(self, target):
- w_value = self.popvalue()
- if self.guessbool(op.bool(w_value).eval(self)):
- return target
-
def JUMP_IF_FALSE_OR_POP(self, target):
w_value = self.peekvalue()
if not self.guessbool(op.bool(w_value).eval(self)):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit