Exemple #1
0
 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
Exemple #2
0
 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
Exemple #3
0
 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
Exemple #4
0
 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)
Exemple #5
0
 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)    
Exemple #6
0
    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)
Exemple #7
0
    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)
Exemple #8
0
 def getcompiled(self, fn, annotation):
     detect_missing_support_programs()
     t = JvmTest()
     return t.compile(fn, None, annotation, backendopt=True)
 def getcompiled(self, fn, annotation):
     detect_missing_support_programs()
     t = JvmTest()
     return t.compile(fn, None, annotation, backendopt=True)