[pypy-svn] r40608 - in pypy/branch/jit-virtual-world/pypy: jit module/pypyjit/test translator/goal

arigo at codespeak.net arigo at codespeak.net
Fri Mar 16 19:46:37 CET 2007


Author: arigo
Date: Fri Mar 16 19:46:34 2007
New Revision: 40608

Modified:
   pypy/branch/jit-virtual-world/pypy/jit/TODO.txt
   pypy/branch/jit-virtual-world/pypy/module/pypyjit/test/test_pypy_c.py
   pypy/branch/jit-virtual-world/pypy/translator/goal/richards.py
Log:
(same guys)

- add the remaining jit/goal/demo tests to test_pypy_c.
- add richards too.
- mention what we need to do next (well, after we debug
  the current untranslatability of the jit, and a
  segfaults...)


Modified: pypy/branch/jit-virtual-world/pypy/jit/TODO.txt
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/jit/TODO.txt	(original)
+++ pypy/branch/jit-virtual-world/pypy/jit/TODO.txt	Fri Mar 16 19:46:34 2007
@@ -1,4 +1,14 @@
 
+To Do Right Now
+------------------
+
+- see the inplace-version of the arithmetic operators
+
+- improve is_true()
+
+Longer-term
+------------------
+
 - global merge point and portal should delegate their cache impl.
   to the application (to allow keeping things alive correctly)
 

Modified: pypy/branch/jit-virtual-world/pypy/module/pypyjit/test/test_pypy_c.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/module/pypyjit/test/test_pypy_c.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/module/pypyjit/test/test_pypy_c.py	Fri Mar 16 19:46:34 2007
@@ -22,13 +22,13 @@
     print >> f, source
     # some support code...
     print >> f, py.code.Source("""
-        import pypyjit
+        import sys, pypyjit
         pypyjit.enable(main.func_code)
 
         def check(args, expected):
-            print 'trying:', args
+            print >> sys.stderr, 'trying:', args
             result = main(*args)
-            print 'got:', repr(result)
+            print >> sys.stderr, 'got:', repr(result)
             assert result == expected
             assert type(result) is type(expected)
     """)
@@ -77,5 +77,35 @@
     ''',
                [([2117], 1083876708)])
 
-##def test_richards():
-##    xxx
+def app_test_factorial():
+    run_source('''
+        def main(n):
+            r = 1
+            while n > 1:
+                r *= n
+                n -= 1
+            return r
+    ''',
+               [([5], 120),
+                ([20], 2432902008176640000L)])
+
+def app_test_factorialrec():
+    run_source('''
+        def main(n):
+            if n > 1:
+                return n * main(n-1)
+            else:
+                return 1
+    ''',
+               [([5], 120),
+                ([20], 2432902008176640000L)])
+
+def app_test_richards():
+    run_source('''
+        import sys; sys.path[:] = %r
+        import richards
+        
+        def main():
+            return richards.main(iterations = 1)
+    ''' % (sys.path,),
+               [([], 42)])

Modified: pypy/branch/jit-virtual-world/pypy/translator/goal/richards.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/translator/goal/richards.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/translator/goal/richards.py	Fri Mar 16 19:46:34 2007
@@ -407,11 +407,12 @@
     result, startTime, endTime = entry_point(iterations)
     if not result:
         print "Incorrect results!"
-        return
+        return -1
     print "finished."
     total_s = endTime - startTime
     print "Total time for %d iterations: %.2f secs" %(iterations,total_s)
     print "Average time per iteration: %.2f ms" %(total_s*1000/iterations)
+    return 42
 
 try:
     import sys



More information about the Pypy-commit mailing list