[pypy-svn] r77710 - pypy/branch/jitffi/pypy/jit/tl

antocuni at codespeak.net antocuni at codespeak.net
Fri Oct 8 11:07:23 CEST 2010


Author: antocuni
Date: Fri Oct  8 11:07:21 2010
New Revision: 77710

Modified:
   pypy/branch/jitffi/pypy/jit/tl/pypyjit.py
   pypy/branch/jitffi/pypy/jit/tl/pypyjit_child.py
   pypy/branch/jitffi/pypy/jit/tl/pypyjit_demo.py
Log:
update pypyjit* to test _ffi


Modified: pypy/branch/jitffi/pypy/jit/tl/pypyjit.py
==============================================================================
--- pypy/branch/jitffi/pypy/jit/tl/pypyjit.py	(original)
+++ pypy/branch/jitffi/pypy/jit/tl/pypyjit.py	Fri Oct  8 11:07:21 2010
@@ -40,6 +40,9 @@
 config.objspace.usemodules.array = True
 config.objspace.usemodules._weakref = False
 config.objspace.usemodules._sre = False
+#
+config.objspace.usemodules._ffi = True
+#
 set_pypy_opt_level(config, level='jit')
 config.objspace.std.withinlineddict = True
 

Modified: pypy/branch/jitffi/pypy/jit/tl/pypyjit_child.py
==============================================================================
--- pypy/branch/jitffi/pypy/jit/tl/pypyjit_child.py	(original)
+++ pypy/branch/jitffi/pypy/jit/tl/pypyjit_child.py	Fri Oct  8 11:07:21 2010
@@ -16,7 +16,7 @@
     interp.heap.malloc_nonmovable = returns_null     # XXX
 
     from pypy.jit.backend.llgraph.runner import LLtypeCPU
-    LLtypeCPU.supports_floats = False    # for now
+    #LLtypeCPU.supports_floats = False    # for now
     apply_jit(interp, graph, LLtypeCPU)
 
 

Modified: pypy/branch/jitffi/pypy/jit/tl/pypyjit_demo.py
==============================================================================
--- pypy/branch/jitffi/pypy/jit/tl/pypyjit_demo.py	(original)
+++ pypy/branch/jitffi/pypy/jit/tl/pypyjit_demo.py	Fri Oct  8 11:07:21 2010
@@ -37,26 +37,18 @@
 ## t2 = time.time()
 ## print t2 - t1
 
-try:
-    from array import array
-
-    def coords(w,h):
-        y = 0
-        while y < h:
-            x = 0
-            while x < w:
-                yield x,y
-                x += 1
-            y += 1
+def main():
+    from _ffi import CDLL, types
+    libm = CDLL('libm.so')
+    pow = libm.getfunc('pow', [types.double, types.double], types.double)
+    i = 0
+    while i < 100:
+        res = pow(2, 3)
+        i += 1
+    print res
 
-    def f(img):
-        sa=0
-        for x, y in coords(4,4):
-            sa += x * y
-        return sa
-
-    #img=array('h',(1,2,3,4))
-    print f(3)
+try:
+    main()
 except Exception, e:
     print "Exception: ", type(e)
     print e



More information about the Pypy-commit mailing list