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

pedronis at codespeak.net pedronis at codespeak.net
Sat Jan 28 12:56:17 CET 2006


Author: pedronis
Date: Sat Jan 28 12:56:15 2006
New Revision: 22774

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

simple support for propagation of concrete (mixing with constants)



Modified: pypy/dist/pypy/jit/hintmodel.py
==============================================================================
--- pypy/dist/pypy/jit/hintmodel.py	(original)
+++ pypy/dist/pypy/jit/hintmodel.py	Sat Jan 28 12:56:15 2006
@@ -83,3 +83,10 @@
         assert hs_c1.concretetype == hs_c2.concretetype
         origins = annmodel.setunion(hs_c1.origins, hs_c2.origins)
         return SomeLLAbstractConstant(hs_c1.concretetype, origins)
+
+class __extend__(pairtype(SomeLLAbstractConstant, SomeLLConcreteValue),
+                 pairtype(SomeLLConcreteValue, SomeLLAbstractConstant),
+                 pairtype(SomeLLConcreteValue, SomeLLConcreteValue)):
+
+    def int_add((hs_c1, hs_c2)):
+        return SomeLLConcreteValue(lltype.Signed)

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	Sat Jan 28 12:56:15 2006
@@ -76,7 +76,14 @@
         x = hint(x, variable=True) # special hint only for testing purposes!!!
         return x + y
     hs = hannotate(ll_function, [int, int])
-    assert type(hs) is  SomeLLAbstractValue
+    assert type(hs) is SomeLLAbstractValue
     assert hs.concretetype == lltype.Signed
     
-    
+def test_simple_concrete_propagation():
+    def ll_function(x,y):
+        x = hint(x, concrete=True)
+        return x + y
+    hs = hannotate(ll_function, [int, int])
+    assert type(hs) is SomeLLConcreteValue
+    assert hs.concretetype == lltype.Signed
+     



More information about the Pypy-commit mailing list