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

pedronis at codespeak.net pedronis at codespeak.net
Wed Feb 1 16:37:03 CET 2006


Author: pedronis
Date: Wed Feb  1 16:37:01 2006
New Revision: 22923

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

track dependencies through containers again, but add support for an explicit hint to stop the tracking. 
Added such an hint inside tl.py interp.

concrete union constant => constant (what about origins? ignore for now)

fixed test to match changes.



Modified: pypy/dist/pypy/jit/hintmodel.py
==============================================================================
--- pypy/dist/pypy/jit/hintmodel.py	(original)
+++ pypy/dist/pypy/jit/hintmodel.py	Wed Feb  1 16:37:01 2006
@@ -144,10 +144,14 @@
     def hint(hs_c1, hs_flags):
         if hs_flags.const.get('variable', False): # only for testing purposes!!!
             return SomeLLAbstractVariable(hs_c1.concretetype)
-        assert hs_flags.const['concrete']
-        for o in hs_c1.origins:
-            o.set_fixed()
-        return SomeLLConcreteValue(hs_c1.concretetype)
+        if hs_flags.const.get('concrete', False):
+            for o in hs_c1.origins:
+                o.set_fixed()
+            return SomeLLConcreteValue(hs_c1.concretetype)
+        else:
+            assert hs_flags.const['forget']
+            assert isinstance(hs_c1, SomeLLAbstractConstant)
+            return reorigin(hs_c1)
 
     def getfield(hs_c1, hs_fieldname):
         S = hs_c1.concretetype.TO
@@ -397,7 +401,7 @@
     def union((hs_c1, hs_c2)):
         assert hs_c1.concretetype == hs_c2.concretetype
         #if hasattr(hs_c1, 'const') or hasattr(hs_c2, 'const'):
-        return SomeLLConcreteValue(hs_c1.concretetype) # MAYBE
+        return SomeLLAbstractConstant(hs_c1.concretetype, {}) # MAYBE
         #else:
         #raise annmodel.UnionError("%s %s don't mix, unless the constant is constant" % (hs_c1, hs_c2))
 
@@ -410,7 +414,7 @@
 
     def getarrayitem((hs_a1, hs_index)):
         hs_res = hs_a1.contentdef.read_item()
-        return reorigin(hs_res, hs_index)
+        return reorigin(hs_res, hs_res, hs_index)
 
 
 # ____________________________________________________________

Modified: pypy/dist/pypy/jit/hintvlist.py
==============================================================================
--- pypy/dist/pypy/jit/hintvlist.py	(original)
+++ pypy/dist/pypy/jit/hintvlist.py	Wed Feb  1 16:37:01 2006
@@ -43,7 +43,8 @@
 
     def oop_getitem(self, hs_index):
         assert hs_index.concretetype == lltype.Signed
-        return reorigin(self.read_item(), hs_index)
+        hs_res = self.read_item()
+        return reorigin(hs_res, hs_res, hs_index)
 
     def oop_setitem(self, hs_index, hs_value):
         assert hs_index.concretetype == lltype.Signed
@@ -61,7 +62,8 @@
 
     def oop_pop(self, hs_index=None):
         assert hs_index is None or hs_index.concretetype == lltype.Signed
-        return reorigin(self.read_item(), hs_index)
+        hs_res = self.read_item()
+        return reorigin(hs_res, hs_res, hs_index)
 
     def oop_reverse(self):
         pass

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	Wed Feb  1 16:37:01 2006
@@ -117,8 +117,8 @@
     # MAYBE...
     #py.test.raises(annmodel.UnionError, "unionof(ac1, cv1)")
     #py.test.raises(annmodel.UnionError, "unionof(cv1, ac1)")
-    assert unionof(cv1, ac1) == cv1
-    assert unionof(ac1, cv1) == cv1
+    assert unionof(cv1, ac1) == ac1
+    assert unionof(ac1, cv1) == ac1
     
     # constant with values
     assert unionof(av1, ac1) == av1
@@ -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) == 2
+    assert len(hs.origins) == 4
 
 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) == 2
+    assert len(hs.origins) == 4
 
 def test_simple_cast_pointer():
     GCS1 = lltype.GcStruct('s1', ('x', lltype.Signed))

Modified: pypy/dist/pypy/jit/tl.py
==============================================================================
--- pypy/dist/pypy/jit/tl.py	(original)
+++ pypy/dist/pypy/jit/tl.py	Wed Feb  1 16:37:01 2006
@@ -103,7 +103,7 @@
         elif opcode == BR_COND_STK:
             offset = stack.pop()
             if stack.pop():
-                pc += offset
+                pc += hint(offset, forget=True)
 
         elif opcode == CALL:
             offset = char2int(code[pc])



More information about the Pypy-commit mailing list