Author: Alex Gaynor <[email protected]>
Branch: python-loop-unroll
Changeset: r64649:27fd933bbf5e
Date: 2013-05-28 15:30 -0700
http://bitbucket.org/pypy/pypy/changeset/27fd933bbf5e/
Log: whack at random stuff, now maybe works?
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -877,7 +877,12 @@
return next_instr
def GET_ITER(self, oparg, next_instr):
+ from pypy.module.__pypy__.interp_unroll import W_LoopUnroller
w_iterable = self.popvalue()
+ if isinstance(w_iterable, W_LoopUnroller):
+ lastblock = self.lastblock
+ assert isinstance(lastblock, LoopBlock)
+ lastblock.should_unroll = True
w_iterator = self.space.iter(w_iterable)
self.pushvalue(w_iterator)
@@ -1240,6 +1245,7 @@
"""
raise NotImplementedError
+
class LoopBlock(FrameBlock):
"""A loop block. Stores the end-of-loop pointer in case of 'break'."""
@@ -1247,6 +1253,10 @@
_opname = 'SETUP_LOOP'
handling_mask = SBreakLoop.kind | SContinueLoop.kind
+ def __init__(self, frame, handlerposition, previous):
+ FrameBlock.__init__(self, frame, handlerposition, previous)
+ self.should_unroll = False
+
def handle(self, frame, unroller):
if isinstance(unroller, SContinueLoop):
# re-push the loop block without cleaning up the value stack,
diff --git a/pypy/module/pypyjit/interp_jit.py
b/pypy/module/pypyjit/interp_jit.py
--- a/pypy/module/pypyjit/interp_jit.py
+++ b/pypy/module/pypyjit/interp_jit.py
@@ -77,6 +77,8 @@
return self.popvalue()
def jump_absolute(self, jumpto, ec):
+ from pypy.interpreter.pyopcode import LoopBlock
+
if we_are_jitted():
#
# assume that only threads are using the bytecode counter
@@ -89,9 +91,11 @@
ec.bytecode_trace(self, decr_by)
jumpto = r_uint(self.last_instr)
#
- pypyjitdriver.can_enter_jit(frame=self, ec=ec, next_instr=jumpto,
- pycode=self.getcode(),
- is_being_profiled=self.is_being_profiled)
+ lastblock = self.lastblock
+ if not (isinstance(lastblock, LoopBlock) and lastblock.should_unroll
and we_are_jitted()):
+ pypyjitdriver.can_enter_jit(frame=self, ec=ec, next_instr=jumpto,
+ pycode=self.getcode(),
+
is_being_profiled=self.is_being_profiled)
return jumpto
def _get_adapted_tick_counter():
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit