[pypy-svn] pypy jit-unroll-loops: hg merge default

hakanardo commits-noreply at bitbucket.org
Mon Dec 27 17:16:35 CET 2010


Author: Hakan Ardo <hakan at debian.org>
Branch: jit-unroll-loops
Changeset: r40240:3c5d982e9516
Date: 2010-12-27 11:39 +0100
http://bitbucket.org/pypy/pypy/changeset/3c5d982e9516/

Log:	hg merge default

diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -679,8 +679,12 @@
         def test_mknod(self):
             import stat
             os = self.posix
-            # not very useful: os.mknod() without specifying 'mode'
-            os.mknod(self.path2 + 'test_mknod-1')
+            # os.mknod() may require root priviledges to work at all
+            try:
+                # not very useful: os.mknod() without specifying 'mode'
+                os.mknod(self.path2 + 'test_mknod-1')
+            except OSError, e:
+                skip("os.mknod(): got %r" % (e,))
             st = os.lstat(self.path2 + 'test_mknod-1')
             assert stat.S_ISREG(st.st_mode)
             # os.mknod() with S_IFIFO

diff --git a/pypy/rlib/jit.py b/pypy/rlib/jit.py
--- a/pypy/rlib/jit.py
+++ b/pypy/rlib/jit.py
@@ -387,8 +387,7 @@
         from pypy.annotation import model as annmodel
 
         if self.instance.__name__ == 'jit_merge_point':
-            if not self.annotate_hooks(**kwds_s):
-                return None      # wrong order, try again later
+            self.annotate_hooks(**kwds_s)
 
         driver = self.instance.im_self
         keys = kwds_s.keys()
@@ -424,13 +423,13 @@
         driver = self.instance.im_self
         s_jitcell = self.bookkeeper.valueoftype(BaseJitCell)
         h = self.annotate_hook
-        return (h(driver.get_jitcell_at, driver.greens, **kwds_s)
-            and h(driver.set_jitcell_at, driver.greens, [s_jitcell], **kwds_s)
-            and h(driver.get_printable_location, driver.greens, **kwds_s))
+        h(driver.get_jitcell_at, driver.greens, **kwds_s)
+        h(driver.set_jitcell_at, driver.greens, [s_jitcell], **kwds_s)
+        h(driver.get_printable_location, driver.greens, **kwds_s)
 
     def annotate_hook(self, func, variables, args_s=[], **kwds_s):
         if func is None:
-            return True
+            return
         bk = self.bookkeeper
         s_func = bk.immutablevalue(func)
         uniquekey = 'jitdriver.%s' % func.func_name
@@ -441,12 +440,13 @@
             else:
                 objname, fieldname = name.split('.')
                 s_instance = kwds_s['s_' + objname]
-                s_arg = s_instance.classdef.about_attribute(fieldname)
-                if s_arg is None:
-                    return False     # wrong order, try again later
+                attrdef = s_instance.classdef.find_attribute(fieldname)
+                position = self.bookkeeper.position_key
+                attrdef.read_locations[position] = True
+                s_arg = attrdef.getvalue()
+                assert s_arg is not None
             args_s.append(s_arg)
         bk.emulate_pbc_call(uniquekey, s_func, args_s)
-        return True
 
     def specialize_call(self, hop, **kwds_i):
         # XXX to be complete, this could also check that the concretetype

diff --git a/pypy/jit/metainterp/optimizeutil.py b/pypy/jit/metainterp/optimizeutil.py
--- a/pypy/jit/metainterp/optimizeutil.py
+++ b/pypy/jit/metainterp/optimizeutil.py
@@ -3,6 +3,7 @@
 from pypy.rlib.unroll import unrolling_iterable
 from pypy.jit.metainterp import resoperation, history
 from pypy.jit.metainterp.jitexc import JitException
+from pypy.rlib.debug import make_sure_not_resized
 
 class InvalidLoop(JitException):
     """Raised when the optimize*.py detect that the loop that
@@ -77,6 +78,8 @@
 # ____________________________________________________________
 
 def args_eq(args1, args2):
+    make_sure_not_resized(args1)
+    make_sure_not_resized(args2)
     if len(args1) != len(args2):
         return False
     for i in range(len(args1)):
@@ -93,6 +96,7 @@
     return True
 
 def args_hash(args):
+    make_sure_not_resized(args)
     res = 0x345678
     for arg in args:
         if isinstance(arg, history.Const):
@@ -104,5 +108,3 @@
 
 def args_dict():
     return r_dict(args_eq, args_hash)
-
-

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
@@ -463,14 +463,18 @@
         return op
 
     def make_args_key(self, op):
-        args = []
-        for i in range(op.numargs()):
+        n = op.numargs()
+        args = [None] * (n + 1)
+        for i in range(n):
             arg = op.getarg(i)
-            if arg in self.values:
-                args.append(self.values[arg].get_key_box())
+            try:
+                value = self.values[arg]
+            except KeyError:
+                pass
             else:
-                args.append(arg)
-        args.append(ConstInt(op.getopnum()))
+                arg = value.get_key_box()
+            args[i] = arg
+        args[n] = ConstInt(op.getopnum())
         return args
 
     def optimize_default(self, op):


More information about the Pypy-commit mailing list