[pypy-svn] r64468 - in pypy/branch/pyjitpl5-simplify/pypy/jit: backend/llgraph metainterp metainterp/test

antocuni at codespeak.net antocuni at codespeak.net
Mon Apr 20 18:29:20 CEST 2009


Author: antocuni
Date: Mon Apr 20 18:29:19 2009
New Revision: 64468

Modified:
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/runner.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_zrpy_basic.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/warmspot.py
Log:
(antocuni, arigo around) run rpython tests also on ootype, and introduce a
couple of translation fixes



Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/runner.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/runner.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/llgraph/runner.py	Mon Apr 20 18:29:19 2009
@@ -19,6 +19,8 @@
 
 class Descr(history.AbstractDescr):
     name = None
+    ofs = -1
+    type = '?'
     
     def __init__(self, ofs, type='?'):
         self.ofs = ofs
@@ -408,6 +410,7 @@
         return TypeDescr(TYPE)
 
     def do_getfield_gc(self, args, fielddescr):
+        assert isinstance(fielddescr, FieldDescr)
         return fielddescr.getfield(args[0])
 
     def do_call(self, args, descr):
@@ -502,6 +505,8 @@
 
 class FieldDescr(history.AbstractDescr):
 
+    getfield = None
+
     def __init__(self, T, fieldname):
         _, RES = T._lookup_field(fieldname)
         boxresult = make_boxresult(RES)

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/pyjitpl.py	Mon Apr 20 18:29:19 2009
@@ -771,7 +771,11 @@
             self.optimize_loop = optimizer.optimize_loop
             self.optimize_bridge = optimizer.optimize_bridge
         else:
-            from pypy.jit.metainterp import optimize
+            # hack hack hack
+            if self.cpu.is_oo:
+                from pypy.jit.metainterp import simple_optimize as optimize
+            else:
+                from pypy.jit.metainterp import optimize
             self.optimize_loop = optimize.optimize_loop
             self.optimize_bridge = optimize.optimize_bridge
 

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_zrpy_basic.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_zrpy_basic.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_zrpy_basic.py	Mon Apr 20 18:29:19 2009
@@ -6,9 +6,10 @@
 from pypy.jit.conftest import option
 
 
-class TestBasic:
+class BasicTest:
 
-    CPUClass = runner.LLtypeCPU
+    CPUClass = None
+    type_system = None
 
     def test_loop_1(self):
         if not option.run_slow_tests:
@@ -22,9 +23,11 @@
                 total += i
                 i -= 1
             return total * 10
-        res = ll_meta_interp(f, [10], CPUClass=self.CPUClass)
+        res = ll_meta_interp(f, [10], CPUClass=self.CPUClass,
+                             type_system=self.type_system)
         assert res == 490
-        res = rpython_ll_meta_interp(f, [10], loops=1, CPUClass=self.CPUClass)
+        res = rpython_ll_meta_interp(f, [10], loops=1, CPUClass=self.CPUClass,
+                                     type_system=self.type_system)
         assert res == 490
 
     def test_loop_2(self):
@@ -40,11 +43,25 @@
                     i -= 2
                 i -= 1
             return total * 10
-        res = ll_meta_interp(f, [17], CPUClass=self.CPUClass)
+        res = ll_meta_interp(f, [17], CPUClass=self.CPUClass,
+                             type_system=self.type_system)
         assert res == (17+14+11+8+7+6+5+4) * 10
-        res = rpython_ll_meta_interp(f, [17], loops=2, CPUClass=self.CPUClass)
+        res = rpython_ll_meta_interp(f, [17], loops=2, CPUClass=self.CPUClass,
+                                     type_system=self.type_system)
         assert res == (17+14+11+8+7+6+5+4) * 10
 
+
+class TestBasicLLtype(BasicTest):
+
+    CPUClass = runner.LLtypeCPU
+    type_system = 'lltype'
+
+class TestBasicOOtype(BasicTest):
+
+    CPUClass = runner.OOtypeCPU
+    type_system = 'ootype'
+    
+
 class LLInterpJitMixin:
     type_system = 'lltype'
     basic = False

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/warmspot.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/warmspot.py	Mon Apr 20 18:29:19 2009
@@ -13,6 +13,7 @@
 from pypy.rlib.rarithmetic import r_uint
 from pypy.rlib.debug import debug_print
 from pypy.rpython.lltypesystem.lloperation import llop
+from pypy.translator.simplify import get_funcobj, get_functype
 
 from pypy.jit.metainterp import support, history, pyjitpl
 from pypy.jit.metainterp.pyjitpl import MetaInterpStaticData, MetaInterp
@@ -239,7 +240,7 @@
     def helper_func(self, FUNCPTR, func):
         if not self.cpu.translate_support_code:
             return llhelper(FUNCPTR, func)
-        FUNC = FUNCPTR.TO
+        FUNC = get_functype(FUNCPTR)
         args_s = [annmodel.lltype_to_annotation(ARG) for ARG in FUNC.ARGS]
         s_result = annmodel.lltype_to_annotation(FUNC.RESULT)
         graph = self.annhelper.getgraph(func, args_s, s_result)



More information about the Pypy-commit mailing list