Author: Armin Rigo <ar...@tunes.org>
Branch: stm
Changeset: r48700:e6d9748a9589
Date: 2011-11-03 15:11 +0100
http://bitbucket.org/pypy/pypy/changeset/e6d9748a9589/

Log:    A few extra operations that are always allowed.

diff --git a/pypy/rpython/lltypesystem/lloperation.py 
b/pypy/rpython/lltypesystem/lloperation.py
--- a/pypy/rpython/lltypesystem/lloperation.py
+++ b/pypy/rpython/lltypesystem/lloperation.py
@@ -147,6 +147,12 @@
             assert not opdesc.canraise
             yield opname
 
+def enum_tryfold_ops():
+    """Enumerate operations that can be constant-folded."""
+    for opname, opdesc in LL_OPERATIONS.iteritems():
+        if opdesc.tryfold:
+            yield opname
+
 
 class Entry(ExtRegistryEntry):
     "Annotation and rtyping of LLOp instances, which are callable."
diff --git a/pypy/translator/stm/transform.py b/pypy/translator/stm/transform.py
--- a/pypy/translator/stm/transform.py
+++ b/pypy/translator/stm/transform.py
@@ -7,10 +7,10 @@
 
 
 ALWAYS_ALLOW_OPERATIONS = set([
-    'direct_call', 'force_cast',
+    'direct_call', 'force_cast', 'keepalive', 'cast_ptr_to_adr',
     'debug_print', 'debug_assert',
     ])
-ALWAYS_ALLOW_OPERATIONS |= set(lloperation.enum_foldable_ops())
+ALWAYS_ALLOW_OPERATIONS |= set(lloperation.enum_tryfold_ops())
 
 def op_in_set(opname, set):
     return opname in set
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to