[pypy-svn] r22831 - in pypy/dist/pypy/jit: . test
pedronis at codespeak.net
pedronis at codespeak.net
Sun Jan 29 13:32:12 CET 2006
Author: pedronis
Date: Sun Jan 29 13:32:10 2006
New Revision: 22831
Modified:
pypy/dist/pypy/jit/hintcontainer.py
pypy/dist/pypy/jit/hintmodel.py
pypy/dist/pypy/jit/test/test_hint_annotation.py
Log:
(arre, pedronis)
after some pushing and pulling we can annotate the tl interpreter. Let's look at the result now...
Modified: pypy/dist/pypy/jit/hintcontainer.py
==============================================================================
--- pypy/dist/pypy/jit/hintcontainer.py (original)
+++ pypy/dist/pypy/jit/hintcontainer.py Sun Jan 29 13:32:10 2006
@@ -29,7 +29,9 @@
elif isinstance(TYPE, lltype.Ptr):
return annmodel.s_ImpossibleValue
else:
- return hintmodel.SomeLLAbstractConstant(TYPE, {})
+ hs_c = hintmodel.SomeLLAbstractConstant(TYPE, {})
+ hs_c.const = TYPE._defl()
+ return hs_c
# ____________________________________________________________
Modified: pypy/dist/pypy/jit/hintmodel.py
==============================================================================
--- pypy/dist/pypy/jit/hintmodel.py (original)
+++ pypy/dist/pypy/jit/hintmodel.py Sun Jan 29 13:32:10 2006
@@ -138,6 +138,9 @@
*args_hs)
except NotImplementedError:
pass
+ # don't try to annotate suggested_primitive graphs
+ if getattr(getattr(fnobj, '_callable', None), 'suggested_primitive', False):
+ return SomeLLAbstractVariable(lltype.typeOf(fnobj).RESULT)
# normal call
if not hasattr(fnobj, 'graph'):
raise NotImplementedError("XXX call to externals or primitives")
@@ -285,6 +288,16 @@
int_lt = int_le = int_ge = int_ne = int_gt = int_eq
uint_lt = uint_le = uint_ge = uint_ne = uint_gt = uint_eq = int_eq
+class __extend__(pairtype(SomeLLConcreteValue, SomeLLAbstractConstant),
+ pairtype(SomeLLAbstractConstant, SomeLLConcreteValue)):
+
+ 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
+ #else:
+ # raise annmodel.UnionError("%s %s don't mix, unless the constant is constant" % (hs_c1, hs_c2))
+
class __extend__(pairtype(SomeLLAbstractContainer, SomeLLAbstractContainer)):
def union((hs_cont1, hs_cont2)):
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 13:32:10 2006
@@ -114,8 +114,13 @@
# degenerating cases
py.test.raises(annmodel.UnionError, "unionof(cv1, av1)")
py.test.raises(annmodel.UnionError, "unionof(av1, cv1)")
- py.test.raises(annmodel.UnionError, "unionof(ac1, cv1)")
- py.test.raises(annmodel.UnionError, "unionof(cv1, ac1)")
+
+ # 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
+
# constant with values
assert unionof(av1, ac1) == av1
assert unionof(ac1, av1) == av1
@@ -258,7 +263,7 @@
assert hs.concretetype == PGCS2
-def CUR_GOAL_test_hannotate_tl():
+def test_hannotate_tl():
from pypy.jit import tl
hannotate(tl.interp, [str, int])
More information about the Pypy-commit
mailing list