[pypy-svn] r22847 - in pypy/dist/pypy/jit: . test

arigo at codespeak.net arigo at codespeak.net
Sun Jan 29 17:18:16 CET 2006


Author: arigo
Date: Sun Jan 29 17:18:14 2006
New Revision: 22847

Modified:
   pypy/dist/pypy/jit/hintmodel.py
   pypy/dist/pypy/jit/test/test_hint_annotation.py
Log:
(pedronis, arigo)

Bouh.  Removed the origin tracking through containers.  This has the effect of
producing the correct annotations for the TL, but we have to think more about
whether it's the completely correct thing to do -- and also about
direct_calls().



Modified: pypy/dist/pypy/jit/hintmodel.py
==============================================================================
--- pypy/dist/pypy/jit/hintmodel.py	(original)
+++ pypy/dist/pypy/jit/hintmodel.py	Sun Jan 29 17:18:14 2006
@@ -98,11 +98,13 @@
     return set
 
 def reorigin(hs_v1, *deps_hs):
+    """Make a copy of hs_v1 with its origins removed and replaced by myorigin().
+    Optionally, the origins of other annotations can also be added.
+    """
     if isinstance(hs_v1, SomeLLAbstractConstant):
         deps_origins = [hs_dep.origins for hs_dep in deps_hs
                         if isinstance(hs_dep, SomeLLAbstractConstant)]
-        d = newset(hs_v1.origins,
-                   {getbookkeeper().myorigin(): True},
+        d = newset({getbookkeeper().myorigin(): True},
                    *deps_origins)
         return SomeLLAbstractConstant(hs_v1.concretetype, d)
     else:
@@ -165,7 +167,8 @@
         hs_res = bookkeeper.annotator.recursivecall(fnobj.graph,
                                                     bookkeeper.position_key,
                                                     args_hs)
-        return reorigin(hs_res)
+        # for now, keep the origins of 'hs_res' in the new result:
+        return reorigin(hs_res, hs_res)
 
     def unary_char(hs_c1):
         d = setadd(hs_c1.origins, getbookkeeper().myorigin())

Modified: pypy/dist/pypy/jit/test/test_hint_annotation.py
==============================================================================
--- pypy/dist/pypy/jit/test/test_hint_annotation.py	(original)
+++ pypy/dist/pypy/jit/test/test_hint_annotation.py	Sun Jan 29 17:18:14 2006
@@ -226,7 +226,7 @@
     hs = hannotate(ll_function, [int, int, int], policy=P_OOPSPEC)
     assert isinstance(hs, SomeLLAbstractConstant)
     assert hs.concretetype == lltype.Signed
-    assert len(hs.origins) == 4
+    assert len(hs.origins) == 2
 
 def test_some_more_list_operations():
     def ll_function(x, y, index):
@@ -237,7 +237,7 @@
     hs = hannotate(ll_function, [int, int, int], policy=P_OOPSPEC)
     assert isinstance(hs, SomeLLAbstractConstant)
     assert hs.concretetype == lltype.Signed
-    assert len(hs.origins) == 4
+    assert len(hs.origins) == 2
 
 def test_simple_cast_pointer():
     GCS1 = lltype.GcStruct('s1', ('x', lltype.Signed))



More information about the Pypy-commit mailing list