def interpret(self, fn, args, annotation=None, backendopt=False): detect_missing_support_programs() try: src = self.compile(fn, args, annotation, backendopt=backendopt) res = src(*args) return res except JvmError, e: e.pretty_print() raise
def interpret(self, fn, args, annotation=None): detect_missing_support_programs() try: src = self._compile(fn, args, annotation) res = src(*args) if isinstance(res, ExceptionWrapper): raise res return res except JvmError, e: e.pretty_print() raise
def binary_test(self, f, rargs = None): detect_missing_support_programs() cache = {} def new_func(x, y): if type(x) == self.RTYPE or type(y) == self.RTYPE: types = (type(x), type(y)) if types not in cache: fun = self.compile(f, [x, y], None) cache[types] = fun return cache[types](x, y) return f(x,y) super(BaseAdaptedTest,self).binary_test(new_func, rargs, translated=True)
def unary_test(self, f): detect_missing_support_programs() cache = {} def new_func(x): xtype = type(x) if xtype == self.RTYPE: if xtype not in cache: fun = self.compile(f, [x], None) cache[xtype] = fun return cache[xtype](x) return f(x) super(BaseAdaptedTest,self).unary_test(new_func)
def unary_test(self, f): detect_missing_support_programs() cache = {} def new_func(x): xtype = type(x) if xtype == self.RTYPE: if xtype not in cache: fun = self.compile(f, [x], None) cache[xtype] = fun return cache[xtype](x) return f(x) super(BaseAdaptedTest, self).unary_test(new_func)
def binary_test(self, f, rargs=None): detect_missing_support_programs() cache = {} def new_func(x, y): if type(x) == self.RTYPE or type(y) == self.RTYPE: types = (type(x), type(y)) if types not in cache: fun = self.compile(f, [x, y], None) cache[types] = fun return cache[types](x, y) return f(x, y) super(BaseAdaptedTest, self).binary_test(new_func, rargs, translated=True)
def getcompiled(self, fn, annotation): detect_missing_support_programs() t = JvmTest() return t.compile(fn, None, annotation, backendopt=True)