[pypy-svn] r32050 - in pypy/dist/pypy: rpython/lltypesystem translator/llvm
arigo at codespeak.net
arigo at codespeak.net
Thu Sep 7 14:37:36 CEST 2006
Author: arigo
Date: Thu Sep 7 14:37:35 2006
New Revision: 32050
Modified:
pypy/dist/pypy/rpython/lltypesystem/lloperation.py
pypy/dist/pypy/translator/llvm/opwriter.py
Log:
- debug_assert is actually not canfold. Need a new canrun flag...
- implement debug_assert in genllvm too.
Modified: pypy/dist/pypy/rpython/lltypesystem/lloperation.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/lloperation.py (original)
+++ pypy/dist/pypy/rpython/lltypesystem/lloperation.py Thu Sep 7 14:37:35 2006
@@ -9,7 +9,7 @@
class LLOp(object):
def __init__(self, sideeffects=True, canfold=False, canraise=(),
- pyobj=False, canunwindgc=False):
+ pyobj=False, canunwindgc=False, canrun=False):
# self.opname = ... (set afterwards)
if canfold:
@@ -39,6 +39,9 @@
Exception not in self.canraise):
self.canraise += (StackException,)
+ # The operation can be run directly with __call__
+ self.canrun = canrun or canfold
+
# __________ make the LLOp instances callable from LL helpers __________
__name__ = property(lambda self: 'llop_'+self.opname)
@@ -58,7 +61,7 @@
def get_fold_impl(self):
global lltype # <- lazy import hack, worth an XXX
from pypy.rpython.lltypesystem import lltype
- if self.canfold or self.opname in ('getfield', 'getarrayitem'):
+ if self.canrun:
from pypy.rpython.lltypesystem.opimpl import get_op_impl
op_impl = get_op_impl(self.opname)
else:
@@ -296,8 +299,8 @@
'zero_malloc_varsize': LLOp(canraise=(MemoryError,), canunwindgc=True),
'flavored_malloc': LLOp(canraise=(MemoryError,)),
'flavored_free': LLOp(),
- 'getfield': LLOp(sideeffects=False),
- 'getarrayitem': LLOp(sideeffects=False),
+ 'getfield': LLOp(sideeffects=False, canrun=True),
+ 'getarrayitem': LLOp(sideeffects=False, canrun=True),
'getarraysize': LLOp(canfold=True),
'getsubstruct': LLOp(canfold=True),
'getarraysubstruct': LLOp(canfold=True),
@@ -398,7 +401,7 @@
'debug_print': LLOp(),
'debug_pdb': LLOp(),
'debug_log_exc': LLOp(),
- 'debug_assert': LLOp(canfold=True),
+ 'debug_assert': LLOp(canrun=True),
}
# __________ operations on PyObjects __________
Modified: pypy/dist/pypy/translator/llvm/opwriter.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/opwriter.py (original)
+++ pypy/dist/pypy/translator/llvm/opwriter.py Thu Sep 7 14:37:35 2006
@@ -176,6 +176,9 @@
# XXX tmp
pass
+ def debug_assert(self, opr):
+ pass
+
def int_pow(self, opr):
self._generic_pow(opr, "1")
uint_pow = int_pow
More information about the Pypy-commit
mailing list