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

antocuni at codespeak.net antocuni at codespeak.net
Thu Apr 23 15:33:53 CEST 2009


Author: antocuni
Date: Thu Apr 23 15:33:51 2009
New Revision: 64594

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/support.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_tl.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/warmspot.py
Log:
make test_tl working on ootype.  However, it seems that the generated code is
not optimized properly, so two tests are still half-skipped



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	Thu Apr 23 15:33:51 2009
@@ -470,15 +470,18 @@
 
 def make_getargs(ARGS):
     argsiter = unrolling_iterable(ARGS)
-    args_n = len(ARGS)
+    args_n = len([ARG for ARG in ARGS if ARG is not ootype.Void])
     def getargs(argboxes):
         funcargs = ()
         assert len(argboxes) == args_n
         i = 0
         for ARG in argsiter:
-            box = argboxes[i]
-            i+=1
-            funcargs += (unwrap(ARG, box),)
+            if ARG is ootype.Void:
+                funcargs += (None,)
+            else:
+                box = argboxes[i]
+                i+=1
+                funcargs += (unwrap(ARG, box),)
         return funcargs
     return getargs
 
@@ -514,7 +517,7 @@
 
     def __init__(self, FUNC, ARGS, RESULT):
         self.FUNC = FUNC
-        getargs = make_getargs(ARGS)
+        getargs = make_getargs(FUNC.ARGS)
         def callfunc(funcbox, argboxes):
             funcobj = ootype.cast_from_object(FUNC, funcbox.getobj())
             funcargs = getargs(argboxes)

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	Thu Apr 23 15:33:51 2009
@@ -1018,6 +1018,10 @@
                     assert isinstance(pseudoenv[k], BoxPtr)
                     box.changevalue_ptr(saved_env[i].getptr_base())
                     i += 1
+                elif isinstance(box, BoxObj):
+                    assert isinstance(pseudoenv[k], BoxObj)
+                    box.changevalue_obj(saved_env[i].getobj())
+                    i += 1
                 else:
                     if isinstance(box, ConstInt):
                         assert box.getint() == pseudoenv[k].getint()

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/support.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/support.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/support.py	Thu Apr 23 15:33:51 2009
@@ -14,6 +14,7 @@
 from pypy.annotation import model as annmodel
 from pypy.rpython.annlowlevel import MixLevelHelperAnnotator
 from pypy.rpython.extregistry import ExtRegistryEntry
+from pypy.jit.metainterp.typesystem import deref
 
 def getargtypes(annotator, values):
     if values is None:    # for backend tests producing stand-alone exe's
@@ -262,7 +263,7 @@
     impl = setup_extra_builtin(oopspec_name, len(args_s))
     if getattr(impl, 'need_result_type', False):
         bk = rtyper.annotator.bookkeeper
-        args_s.insert(0, annmodel.SomePBC([bk.getdesc(ll_res.TO)]))
+        args_s.insert(0, annmodel.SomePBC([bk.getdesc(deref(ll_res))]))
     #
     mixlevelann = MixLevelHelperAnnotator(rtyper)
     c_func = mixlevelann.constfunc(impl, args_s, s_result)

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_tl.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_tl.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/test/test_tl.py	Thu Apr 23 15:33:51 2009
@@ -95,6 +95,8 @@
     def test_tl_base(self):
         res = self.meta_interp(self.main.im_func, [0, 6], listops=True)
         assert res == 5040
+        if self.type_system == 'ootype':
+            py.test.skip('optimizing problem')
         self.check_loops({'int_mul':1, 'jump':1,
                           'int_sub':1, 'int_is_true':1, 'int_le':1,
                           'guard_false':1, 'guard_value':1})
@@ -102,6 +104,8 @@
     def test_tl_2(self):
         res = self.meta_interp(self.main.im_func, [1, 10], listops=True)
         assert res == self.main.im_func(1, 10)
+        if self.type_system == 'ootype':
+            py.test.skip('optimizing problem')
         self.check_loops({'int_sub':1, 'int_le':1,
                          'int_is_true':1, 'guard_false':1, 'jump':1,
                           'guard_value':1})
@@ -144,8 +148,8 @@
         res = self.meta_interp(main, [0, 20], optimizer=Optimizer)
         assert res == 0
 
-#class TestOOtype(ToyLanguageTests, OOJitMixin):
-#    pass
+class TestOOtype(ToyLanguageTests, OOJitMixin):
+   pass
 
 class TestLLtype(ToyLanguageTests, LLJitMixin):
     pass

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	Thu Apr 23 15:33:51 2009
@@ -394,6 +394,8 @@
     if isinstance(TYPE, lltype.Ptr):
         # XXX moving GCs...?
         return cpu.cast_adr_to_int(llmemory.cast_ptr_to_adr(x))
+    elif TYPE in (ootype.String, ootype.Unicode):
+        return ootype.oohash(x)
     elif isinstance(TYPE, ootype.OOType):
         return ootype.ooidentityhash(x)
     else:



More information about the Pypy-commit mailing list