def compile(f, gc, enable_opts='', **kwds): from pypy.annotation.listdef import s_list_of_strings from pypy.translator.translator import TranslationContext from pypy.jit.metainterp.warmspot import apply_jit from pypy.translator.c import genc # t = TranslationContext() t.config.translation.gc = gc if gc != 'boehm': t.config.translation.gcremovetypeptr = True for name, value in kwds.items(): setattr(t.config.translation, name, value) ann = t.buildannotator(policy=annpolicy.StrictAnnotatorPolicy()) ann.build_types(f, [s_list_of_strings], main_entry_point=True) t.buildrtyper().specialize() if kwds['jit']: patch = get_functions_to_patch() old_value = {} try: for (obj, attr), value in patch.items(): old_value[obj, attr] = getattr(obj, attr) setattr(obj, attr, value) # apply_jit(t, enable_opts=enable_opts) # finally: for (obj, attr), oldvalue in old_value.items(): setattr(obj, attr, oldvalue) cbuilder = genc.CStandaloneBuilder(t, f, t.config) cbuilder.generate_source(defines=cbuilder.DEBUG_DEFINES) cbuilder.compile() return cbuilder
def task_pyjitpl_lltype(self): get_policy = self.extra['jitpolicy'] self.jitpolicy = get_policy(self) # from pypy.jit.metainterp.warmspot import apply_jit apply_jit(self.translator, policy=self.jitpolicy) # self.log.info("the JIT compiler was generated")
def task_pyjitpl_ootype(self): get_policy = self.extra['jitpolicy'] self.jitpolicy = get_policy(self) # from pypy.jit.metainterp.warmspot import apply_jit apply_jit(self.translator, policy=self.jitpolicy, debug_level=JIT_DEBUG[self.config.translation.jit_debug], backend_name='cli', inline=True) #XXX # self.log.info("the JIT compiler was generated")
def task_pyjitpl_ootype(self): get_policy = self.extra["jitpolicy"] self.jitpolicy = get_policy(self) # from pypy.jit.metainterp.warmspot import apply_jit apply_jit( self.translator, policy=self.jitpolicy, debug_level=JIT_DEBUG[self.config.translation.jit_debug], backend_name="cli", inline=True, ) # XXX # self.log.info("the JIT compiler was generated")
def compile(f, gc, **kwds): from pypy.annotation.listdef import s_list_of_strings from pypy.translator.translator import TranslationContext from pypy.jit.metainterp.warmspot import apply_jit from pypy.translator.c import genc # t = TranslationContext() t.config.translation.gc = gc t.config.translation.gcconfig.debugprint = True for name, value in kwds.items(): setattr(t.config.translation, name, value) ann = t.buildannotator(policy=annpolicy.StrictAnnotatorPolicy()) ann.build_types(f, [s_list_of_strings]) t.buildrtyper().specialize() if kwds['jit']: apply_jit(t, optimizer=OPTIMIZER_SIMPLE) cbuilder = genc.CStandaloneBuilder(t, f, t.config) cbuilder.generate_source() cbuilder.compile() return cbuilder
def compile_and_run(f, gc, **kwds): from pypy.annotation.listdef import s_list_of_strings from pypy.translator.translator import TranslationContext from pypy.jit.metainterp.warmspot import apply_jit from pypy.translator.c import genc # t = TranslationContext() t.config.translation.gc = gc t.config.translation.gcconfig.debugprint = True for name, value in kwds.items(): setattr(t.config.translation, name, value) t.buildannotator().build_types(f, [s_list_of_strings]) t.buildrtyper().specialize() if kwds['jit']: apply_jit(t, CPUClass=LLVMCPU) cbuilder = genc.CStandaloneBuilder(t, f, t.config) cbuilder.generate_source() cbuilder.compile() # data = cbuilder.cmdexec('') return data.splitlines()[-1].strip()
def compile_and_run(f, gc, **kwds): from pypy.annotation.listdef import s_list_of_strings from pypy.translator.translator import TranslationContext from pypy.jit.metainterp.warmspot import apply_jit from pypy.translator.c import genc # t = TranslationContext() t.config.translation.gc = gc t.config.translation.gcconfig.debugprint = True for name, value in kwds.items(): setattr(t.config.translation, name, value) t.buildannotator().build_types(f, [s_list_of_strings]) t.buildrtyper().specialize() if kwds["jit"]: apply_jit(t, CPUClass=LLVMCPU) cbuilder = genc.CStandaloneBuilder(t, f, t.config) cbuilder.generate_source() cbuilder.compile() # data = cbuilder.cmdexec("") return data.splitlines()[-1].strip()