Example #1
0
    def __init__(self, FUNC, ARGS, RESULT, extrainfo=None):
        DescrWithKey.__init__(self, (FUNC, ARGS, RESULT))
        from rpython.jit.backend.llgraph.runner import boxresult, make_getargs
        getargs = make_getargs(FUNC.ARGS)

        def callfunc(funcbox, argboxes):
            funcobj = funcbox.getref(FUNC)
            funcargs = getargs(argboxes)
            res = funcobj(*funcargs)
            if RESULT is not ootype.Void:
                return boxresult(RESULT, res)

        self.callfunc = callfunc
        self.funcclass = dotnet.classof(FUNC)
        self.has_result = (FUNC.RESULT != ootype.Void)
        self.extrainfo = extrainfo
        if RESULT is ootype.Void:

            def get_errbox():
                return None
        elif isinstance(RESULT, ootype.OOType):

            def get_errbox():
                return BoxObj()
        else:

            def get_errbox():
                return BoxInt()

        self.get_errbox = get_errbox
Example #2
0
File: runner.py Project: sota/pypy
 def __init__(self, SELFTYPE, methname):
     from rpython.jit.backend.llgraph.runner import boxresult, make_getargs
     _, meth = SELFTYPE._lookup(methname)
     METH = ootype.typeOf(meth)
     getargs = make_getargs(METH.ARGS)
     def callmeth(selfbox, argboxes):
         selfobj = selfbox.getref(SELFTYPE)
         meth = getattr(selfobj, methname)
         methargs = getargs(argboxes)
         res = meth(*methargs)
         if METH.RESULT is not ootype.Void:
             return boxresult(METH.RESULT, res)
     self.callmeth = callmeth
     self.selfclass = ootype.runtimeClass(SELFTYPE)
     self.methname = methname
     self.has_result = (METH.RESULT != ootype.Void)
     self.key = key_manager.getkey((SELFTYPE, methname))
Example #3
0
    def __init__(self, SELFTYPE, methname):
        from rpython.jit.backend.llgraph.runner import boxresult, make_getargs
        _, meth = SELFTYPE._lookup(methname)
        METH = ootype.typeOf(meth)
        getargs = make_getargs(METH.ARGS)

        def callmeth(selfbox, argboxes):
            selfobj = selfbox.getref(SELFTYPE)
            meth = getattr(selfobj, methname)
            methargs = getargs(argboxes)
            res = meth(*methargs)
            if METH.RESULT is not ootype.Void:
                return boxresult(METH.RESULT, res)

        self.callmeth = callmeth
        self.selfclass = ootype.runtimeClass(SELFTYPE)
        self.methname = methname
        self.has_result = (METH.RESULT != ootype.Void)
        self.key = key_manager.getkey((SELFTYPE, methname))
Example #4
0
File: runner.py Project: sota/pypy
 def __init__(self, FUNC, ARGS, RESULT, extrainfo=None):
     DescrWithKey.__init__(self, (FUNC, ARGS, RESULT))
     from rpython.jit.backend.llgraph.runner import boxresult, make_getargs
     getargs = make_getargs(FUNC.ARGS)
     def callfunc(funcbox, argboxes):
         funcobj = funcbox.getref(FUNC)
         funcargs = getargs(argboxes)
         res = funcobj(*funcargs)
         if RESULT is not ootype.Void:
             return boxresult(RESULT, res)
     self.callfunc = callfunc
     self.funcclass = dotnet.classof(FUNC)
     self.has_result = (FUNC.RESULT != ootype.Void)
     self.extrainfo = extrainfo
     if RESULT is ootype.Void:
         def get_errbox():
             return None
     elif isinstance(RESULT, ootype.OOType):
         def get_errbox():
             return BoxObj()
     else:
         def get_errbox():
             return BoxInt()
     self.get_errbox = get_errbox