Commit 4abefc8f authored by Carl Friedrich Bolz's avatar Carl Friedrich Bolz

replace for loop by while loop

in theory, an rpython for x in range loop should be exactly equivalent
to a while loop. The only difference is if it contains a JIT driver, in
which case the for loop is slower :-(
parent e6acc57b
...@@ -225,7 +225,9 @@ def _toDo(ivkbl, frame, interpreter): ...@@ -225,7 +225,9 @@ def _toDo(ivkbl, frame, interpreter):
block_method = block.get_method() block_method = block.get_method()
context = block.get_context() context = block.get_context()
for i in range(self.get_embedded_integer(), limit.get_embedded_integer() + 1): i = self.get_embedded_integer()
top = limit.get_embedded_integer()
while i <= top:
jitdriver.jit_merge_point(interpreter=interpreter, jitdriver.jit_merge_point(interpreter=interpreter,
block_method=block_method) block_method=block_method)
...@@ -234,6 +236,7 @@ def _toDo(ivkbl, frame, interpreter): ...@@ -234,6 +236,7 @@ def _toDo(ivkbl, frame, interpreter):
frame.push(universe.new_integer(i)) frame.push(universe.new_integer(i))
block_evaluate(b, interpreter, frame) block_evaluate(b, interpreter, frame)
frame.pop() frame.pop()
i += 1
frame.push(self) frame.push(self)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment