def getgraph(self, func, argtypes=None): from pypy.config.pypyoption import get_pypy_config config = get_pypy_config(translating=True) config.translation.gc = "ref" config.translation.simplifying = True t = TranslationContext(config=config) if argtypes is None: argtypes = [] a = t.buildannotator() a.build_types(func, argtypes) a.simplify() t.buildrtyper().specialize() wrapperptr = new_wrapper(func, t) wrappergraph = wrapperptr._obj.graph F = lltype.typeOf(wrapperptr).TO assert F.ARGS == (PyObjPtr,) * len(wrappergraph.getargs()) assert F.RESULT == PyObjPtr for inputarg in wrappergraph.getargs(): assert inputarg.concretetype == PyObjPtr assert wrappergraph.getreturnvar().concretetype == PyObjPtr return t.graphs[0], wrappergraph, t
def getentrypointptr(self): # xxx if self._wrapper is None: self._wrapper = new_wrapper(self.entrypoint, self.translator) return self._wrapper