Author: Hakan Ardo <ha...@debian.org>
Branch: jit-optimizeopt-cleanups
Changeset: r47687:596523ebd60e
Date: 2011-09-29 18:43 +0200
http://bitbucket.org/pypy/pypy/changeset/596523ebd60e/

Log:    make OptEarlyForce the place where unroll inserts ops from forcing
        boxes at loop boundaries

diff --git a/pypy/jit/metainterp/optimizeopt/earlyforce.py 
b/pypy/jit/metainterp/optimizeopt/earlyforce.py
--- a/pypy/jit/metainterp/optimizeopt/earlyforce.py
+++ b/pypy/jit/metainterp/optimizeopt/earlyforce.py
@@ -13,4 +13,7 @@
     def new(self):
         return OptEarlyForce()
 
+    def setup(self):
+        self.optimizer.optearlyforce = self
+
     
diff --git a/pypy/jit/metainterp/optimizeopt/optimizer.py 
b/pypy/jit/metainterp/optimizeopt/optimizer.py
--- a/pypy/jit/metainterp/optimizeopt/optimizer.py
+++ b/pypy/jit/metainterp/optimizeopt/optimizer.py
@@ -338,6 +338,7 @@
         self.volatile = {}
         self.optimizer = self
         self.optpure = None
+        self.optearlyforce = None
         if loop is not None:
             self.call_pure_results = loop.call_pure_results
 
diff --git a/pypy/jit/metainterp/optimizeopt/pure.py 
b/pypy/jit/metainterp/optimizeopt/pure.py
--- a/pypy/jit/metainterp/optimizeopt/pure.py
+++ b/pypy/jit/metainterp/optimizeopt/pure.py
@@ -6,9 +6,6 @@
         self.posponedop = None
 
     def propagate_forward(self, op):
-        self.emit_operation(op)
-        
-    def emit_operation(self, op):    
         canfold = op.is_always_pure()
         if op.is_ovf():
             self.posponedop = op
@@ -46,11 +43,11 @@
                 self.optimizer.remember_emitting_pure(op)
 
         # otherwise, the operation remains
-        self.next_optimization.propagate_forward(op)
+        self.emit_operation(op)
         if op.returns_bool_result():
             self.optimizer.bool_boxes[self.getvalue(op.result)] = None        
         if nextop:
-            self.next_optimization.propagate_forward(nextop)
+            self.emit_operation(nextop)
 
     def flush(self):
         assert self.posponedop is None
diff --git a/pypy/jit/metainterp/optimizeopt/virtualstate.py 
b/pypy/jit/metainterp/optimizeopt/virtualstate.py
--- a/pypy/jit/metainterp/optimizeopt/virtualstate.py
+++ b/pypy/jit/metainterp/optimizeopt/virtualstate.py
@@ -378,8 +378,8 @@
                                           cpu, extra_guards, renum)
 
     def make_inputargs(self, values, optimizer, keyboxes=False):
-        if optimizer.optpure:
-            optimizer = optimizer.optpure
+        if optimizer.optearlyforce:
+            optimizer = optimizer.optearlyforce
         assert len(values) == len(self.state)
         inputargs = [None] * len(self.notvirtuals)
         for i in range(len(values)):
@@ -436,8 +436,8 @@
     def get_virtual_state(self, jump_args):
         self.optimizer.force_at_end_of_preamble()
         already_forced = {}
-        if self.optimizer.optpure:
-            opt = self.optimizer.optpure
+        if self.optimizer.optearlyforce:
+            opt = self.optimizer.optearlyforce
         else:
             opt = self.optimizer
         values = [self.getvalue(box).force_at_end_of_preamble(already_forced,
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to