[pypy-svn] r74167 - in pypy/branch/blackhole-improvement/pypy/jit: codewriter metainterp metainterp/test

arigo at codespeak.net arigo at codespeak.net
Wed Apr 28 14:33:16 CEST 2010


Author: arigo
Date: Wed Apr 28 14:33:15 2010
New Revision: 74167

Modified:
   pypy/branch/blackhole-improvement/pypy/jit/codewriter/jitter.py
   pypy/branch/blackhole-improvement/pypy/jit/metainterp/blackhole.py
   pypy/branch/blackhole-improvement/pypy/jit/metainterp/test/test_basic.py
Log:
Tweaks.  Now all of test_basic either passes or is skipped.


Modified: pypy/branch/blackhole-improvement/pypy/jit/codewriter/jitter.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/codewriter/jitter.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/codewriter/jitter.py	Wed Apr 28 14:33:15 2010
@@ -126,6 +126,8 @@
     def rewrite_op_cast_unichar_to_int(self, op): raise NoOp
     def rewrite_op_cast_bool_to_int(self, op): raise NoOp
     def rewrite_op_cast_pointer(self, op): raise NoOp
+    def rewrite_op_cast_int_to_uint(self, op): raise NoOp
+    def rewrite_op_cast_uint_to_int(self, op): raise NoOp
 
     def rewrite_op_direct_call(self, op):
         """Turn 'i0 = direct_call(fn, i1, i2, ref1, ref2)'

Modified: pypy/branch/blackhole-improvement/pypy/jit/metainterp/blackhole.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/metainterp/blackhole.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/metainterp/blackhole.py	Wed Apr 28 14:33:15 2010
@@ -180,8 +180,12 @@
             assert next_argcode == len(argcodes)
             return position
         #
-        verbose = self.verbose
+        # Get the opimpl_xxx method.  If we get an AttributeError here,
+        # it means that either the implementation is missing, or that it
+        # should not appear here at all but instead be transformed away
+        # by codewriter/jitter.py.
         unboundmethod = getattr(BlackholeInterpreter, 'opimpl_' + name)
+        verbose = self.verbose
         argtypes = unrolling_iterable(unboundmethod.argtypes)
         resulttype = unboundmethod.resulttype
         handler = func_with_new_name(handler, 'handler_' + name)

Modified: pypy/branch/blackhole-improvement/pypy/jit/metainterp/test/test_basic.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/metainterp/test/test_basic.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/metainterp/test/test_basic.py	Wed Apr 28 14:33:15 2010
@@ -40,7 +40,7 @@
             blackholeinterp.setarg_f(count_f, value)
             count_f += 1
         else:
-            raise TypeError(value)
+            raise TypeError(T)
     blackholeinterp.run(mainjitcode, 0)
     return blackholeinterp.result_i
 
@@ -246,9 +246,11 @@
         from pypy.rlib.rarithmetic import r_uint
         
         def f(a, b):
+            a = r_uint(a)
+            b = r_uint(b)
             return a/b
 
-        res = self.interp_operations(f, [r_uint(4), r_uint(3)])
+        res = self.interp_operations(f, [4, 3])
         assert res == 1
 
     def test_direct_call(self):
@@ -1473,16 +1475,17 @@
         from pypy.rpython.lltypesystem import lltype
         
         TP = lltype.Struct('x')
-        def f(p1, p2):
+        def f(i1, i2):
+            p1 = prebuilt[i1]
+            p2 = prebuilt[i2]
             a = p1 is p2
             b = p1 is not p2
             c = bool(p1)
             d = not bool(p2)
             return 1000*a + 100*b + 10*c + d
-        x = lltype.malloc(TP, flavor='raw')
-        expected = f(x, x)
-        assert self.interp_operations(f, [x, x]) == expected
-        lltype.free(x, flavor='raw')
+        prebuilt = [lltype.malloc(TP, flavor='raw')] * 2
+        expected = f(0, 1)
+        assert self.interp_operations(f, [0, 1]) == expected
 
     def test_casts(self):
         if not self.basic:



More information about the Pypy-commit mailing list