Author: Ronan Lamy <[email protected]>
Branch: framestate
Changeset: r74734:d5cab6a66583
Date: 2014-11-26 14:25 +0100
http://bitbucket.org/pypy/pypy/changeset/d5cab6a66583/
Log: return positions from handle_bytecode()
diff --git a/rpython/flowspace/bytecode.py b/rpython/flowspace/bytecode.py
--- a/rpython/flowspace/bytecode.py
+++ b/rpython/flowspace/bytecode.py
@@ -234,15 +234,15 @@
bc_block, i = self.pos_index[pos]
return bc_block[i]
- def next_pos(self, instr):
- block, i = self.pos_index[instr.offset]
+ def next_pos(self):
+ block, i = self.curr_position
i = i + 1
if i >= len(block.operations):
assert len(block._exits) == 1
assert block._exits[0] is not block
- return block._exits[0].startpos
+ return (block._exits[0], 0)
else:
- return block.operations[i].offset
+ return block, i
def get_position(self, offset):
return self.pos_index[offset]
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -354,8 +354,7 @@
try:
for instr in bc_graph.iter_instr():
self.last_offset = instr.offset
- next_offset = self.handle_bytecode(instr)
- position = bc_graph.get_position(next_offset)
+ position = self.handle_bytecode(instr)
bc_graph.curr_position = position
self.recorder.final_state = self.getstate(position)
@@ -459,11 +458,12 @@
try:
next_offset = instr.eval(self)
except FlowSignal as signal:
- return self.unroll(signal)
+ return bc_graph.get_position(self.unroll(signal))
if next_offset is None:
- next_offset = bc_graph.next_pos(instr)
- elif isinstance(next_offset, BytecodeBlock):
- next_offset = next_offset.startpos
+ next_offset = bc_graph.next_pos()
+ else:
+ assert isinstance(next_offset, BytecodeBlock)
+ next_offset = next_offset, 0
return next_offset
def unroll(self, signal):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit