Exemplo n.º 1
0
def compile(f, gc, **kwds):
    from rpython.annotator.listdef import s_list_of_strings
    from rpython.translator.translator import TranslationContext
    from rpython.jit.metainterp.warmspot import apply_jit
    from rpython.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()
    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)
            #
        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
Exemplo n.º 2
0
def compile(f, gc, **kwds):
    from rpython.annotator.listdef import s_list_of_strings
    from rpython.translator.translator import TranslationContext
    from rpython.jit.metainterp.warmspot import apply_jit
    from rpython.translator.c import genc
    #
    config = get_combined_translation_config(translating=True)
    config.translation.gc = gc
    if gc != 'boehm':
        config.translation.gcremovetypeptr = True
    for name, value in kwds.items():
        setattr(config.translation, name, value)
    t = TranslationContext(config)
    ann = t.buildannotator()
    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)
            #
        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
Exemplo n.º 3
0
 def task_pyjitpl_lltype(self):
     """ Generate bytecodes for JIT and flow the JIT helper functions
     lltype version
     """
     get_policy = self.extra['jitpolicy']
     self.jitpolicy = get_policy(self)
     #
     from rpython.jit.metainterp.warmspot import apply_jit
     apply_jit(self.translator, policy=self.jitpolicy,
               backend_name=self.config.translation.jit_backend, inline=True)
     #
     self.log.info("the JIT compiler was generated")
Exemplo n.º 4
0
 def task_pyjitpl_lltype(self):
     """ Generate bytecodes for JIT and flow the JIT helper functions
     lltype version
     """
     from rpython.jit.codewriter.policy import JitPolicy
     get_policy = self.extra.get('jitpolicy', None)
     if get_policy is None:
         self.jitpolicy = JitPolicy()
     else:
         self.jitpolicy = get_policy(self)
     #
     from rpython.jit.metainterp.warmspot import apply_jit
     apply_jit(self.translator, policy=self.jitpolicy,
               backend_name=self.config.translation.jit_backend, inline=True)
     #
     self.log.info("the JIT compiler was generated")
Exemplo n.º 5
0
def compile(f, gc, **kwds):
    from rpython.annotator.listdef import s_list_of_strings
    from rpython.translator.translator import TranslationContext
    from rpython.jit.metainterp.warmspot import apply_jit
    from rpython.translator.c import genc
    #
    t = TranslationContext()
    t.config.translation.gc = 'boehm'
    for name, value in kwds.items():
        setattr(t.config.translation, name, value)
    ann = t.buildannotator()
    ann.build_types(f, [s_list_of_strings], main_entry_point=True)
    t.buildrtyper().specialize()

    if kwds['jit']:
        apply_jit(t, vec=True)
Exemplo n.º 6
0
def compile(f, gc, **kwds):
    from rpython.annotator.listdef import s_list_of_strings
    from rpython.translator.translator import TranslationContext
    from rpython.jit.metainterp.warmspot import apply_jit
    from rpython.translator.c import genc

    #
    t = TranslationContext()
    t.config.translation.gc = "boehm"
    for name, value in kwds.items():
        setattr(t.config.translation, name, value)
    ann = t.buildannotator()
    ann.build_types(f, [s_list_of_strings], main_entry_point=True)
    t.buildrtyper().specialize()

    if kwds["jit"]:
        apply_jit(t, vec=True)