def test_canfold_opimpl_complete(): for opname, llop in LL_OPERATIONS.items(): assert opname == llop.opname if llop.canfold: if llop.oo: func = ooopimpl.get_op_impl(opname) else: func = opimpl.get_op_impl(opname) assert callable(func)
def get_fold_impl(self): global lltype # <- lazy import hack, worth an XXX from pypy.rpython.lltypesystem import lltype if self.canrun: if self.oo: from pypy.rpython.ootypesystem.ooopimpl import get_op_impl else: from pypy.rpython.lltypesystem.opimpl import get_op_impl op_impl = get_op_impl(self.opname) else: error = TypeError("cannot constant-fold operation %r" % ( self.opname,)) def op_impl(*args): raise error # cache the implementation function into 'self' self.fold = op_impl return op_impl