[pypy-svn] r77167 - pypy/trunk/pypy/jit/metainterp/optimizeopt

benjamin at codespeak.net benjamin at codespeak.net
Sat Sep 18 04:55:08 CEST 2010


Author: benjamin
Date: Sat Sep 18 04:55:07 2010
New Revision: 77167

Modified:
   pypy/trunk/pypy/jit/metainterp/optimizeopt/optimizer.py
Log:
this default could just as well be None

Modified: pypy/trunk/pypy/jit/metainterp/optimizeopt/optimizer.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/optimizeopt/optimizer.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/optimizeopt/optimizer.py	Sat Sep 18 04:55:07 2010
@@ -187,7 +187,7 @@
     
 class Optimizer(Optimization):
 
-    def __init__(self, metainterp_sd, loop, optimizations=[], virtuals=True):
+    def __init__(self, metainterp_sd, loop, optimizations=None, virtuals=True):
         self.metainterp_sd = metainterp_sd
         self.cpu = metainterp_sd.cpu
         self.loop = loop
@@ -199,10 +199,8 @@
         self.pure_operations = args_dict()
         self.producer = {}
         self.pendingfields = []
-        
-        if len(optimizations) == 0:
-            self.first_optimization = self
-        else:
+
+        if optimizations:
             self.first_optimization = optimizations[0]
             for i in range(1, len(optimizations)):
                 optimizations[i - 1].next_optimization = optimizations[i]
@@ -210,6 +208,8 @@
             for o in optimizations:
                 o.optimizer = self
                 o.setup(virtuals)
+        else:
+            self.first_optimization = self
 
     def forget_numberings(self, virtualbox):
         self.metainterp_sd.profiler.count(jitprof.OPT_FORCINGS)



More information about the Pypy-commit mailing list