示例#1
0
 def __init__(self, SELFTYPE, methname):
     from pypy.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))
示例#2
0
 def __init__(self, FUNC, ARGS, RESULT):
     DescrWithKey.__init__(self, (FUNC, ARGS, RESULT))
     from pypy.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)
     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