[pypy-svn] r41077 - in pypy/dist/pypy/module/pypyjit: . test

pedronis at codespeak.net pedronis at codespeak.net
Thu Mar 22 15:38:13 CET 2007


Author: pedronis
Date: Thu Mar 22 15:38:10 2007
New Revision: 41077

Modified:
   pypy/dist/pypy/module/pypyjit/newbool.py
   pypy/dist/pypy/module/pypyjit/test/test_newbool.py
Log:
- oops, we don't have support for fixedarray in the jit (-> broken c code)

- the test was broken by the signature change fixed before (newbool takes a space, use None in the test)



Modified: pypy/dist/pypy/module/pypyjit/newbool.py
==============================================================================
--- pypy/dist/pypy/module/pypyjit/newbool.py	(original)
+++ pypy/dist/pypy/module/pypyjit/newbool.py	Thu Mar 22 15:38:10 2007
@@ -19,8 +19,8 @@
         self.ll_False = r_w_bool.convert_const(W_BoolObject.w_False)
         self.ll_True  = r_w_bool.convert_const(W_BoolObject.w_True)
 
-        A = lltype.FixedSizeArray(lltype.typeOf(self.ll_False), 2)
-        self.ll_bools = lltype.malloc(A, immortal=True)
+        A = lltype.Array(lltype.typeOf(self.ll_False))
+        self.ll_bools = lltype.malloc(A, 2, immortal=True)
         self.ll_bools[0] = self.ll_False
         self.ll_bools[1] = self.ll_True
         self.gv_bools = RGenOp.constPrebuiltGlobal(self.ll_bools)

Modified: pypy/dist/pypy/module/pypyjit/test/test_newbool.py
==============================================================================
--- pypy/dist/pypy/module/pypyjit/test/test_newbool.py	(original)
+++ pypy/dist/pypy/module/pypyjit/test/test_newbool.py	Thu Mar 22 15:38:10 2007
@@ -109,7 +109,7 @@
 from pypy.objspace.std.boolobject import W_BoolObject
 from pypy.interpreter.baseobjspace import W_Root
 
-def newbool(flag):
+def newbool(space, flag):
     if flag:
         return W_BoolObject.w_True
     else:
@@ -128,7 +128,7 @@
 
     def test_simple(self):
         def f(n):
-            w_res = newbool(n > 5)
+            w_res = newbool(None, n > 5)
             return int(w_res.boolval)
 
         res = self.timeshift(f, [7], policy=MyPolicy())
@@ -137,7 +137,7 @@
 
     def test_ptreq1(self):
         def f(n):
-            w_res = newbool(n > 5)
+            w_res = newbool(None, n > 5)
             return int(w_res is W_BoolObject.w_True)
 
         res = self.timeshift(f, [3], policy=MyPolicy())
@@ -146,7 +146,7 @@
 
     def test_ptreq2(self):
         def f(n):
-            w_res = newbool(n > 5)
+            w_res = newbool(None, n > 5)
             return int(w_res is W_BoolObject.w_False)
 
         res = self.timeshift(f, [3], policy=MyPolicy())
@@ -155,7 +155,7 @@
 
     def test_force(self):
         def f(n):
-            w_res = newbool(n > 5)
+            w_res = newbool(None, n > 5)
             return w_res
         f.convert_result = lambda res: 'foo'
 
@@ -167,9 +167,9 @@
     def test_merge_bools(self):
         def f(n):
             if n > 5:
-                w_res = newbool(n >= 10)
+                w_res = newbool(None, n >= 10)
             else:
-                w_res = newbool(n < -10)
+                w_res = newbool(None, n < -10)
             return int(w_res.boolval)
 
         res = self.timeshift(f, [-3], policy=MyPolicy())
@@ -180,7 +180,7 @@
     def test_merge_with_virtual_root(self):
         def f(n):
             if n > 5:
-                w_res = newbool(n >= 10)
+                w_res = newbool(None, n >= 10)
             else:
                 w_res = W_Root()
             return w_res
@@ -194,7 +194,7 @@
 
     def test_ptreq3(self):
         def f(n):
-            w1 = newbool(n >= 10)
+            w1 = newbool(None, n >= 10)
             w2 = W_Root()
             return int(w1 is w2) + int(w2 is w1)
 
@@ -206,7 +206,7 @@
         w2 = W_Root()
 
         def f(n):
-            w1 = newbool(n >= 10)
+            w1 = newbool(None, n >= 10)
             return int(w1 is w2) + int(w2 is w1)
 
         res = self.timeshift(f, [123], policy=MyPolicy())



More information about the Pypy-commit mailing list