Ejemplo n.º 1
0
 def finish(self):
     #
     def force_if_necessary(virtualizable):
         if virtualizable.vable_rti:
             self.force_now(virtualizable)
     force_if_necessary._always_inline_ = True
     #
     all_graphs = self.warmrunnerdesc.translator.graphs
     ts = self.warmrunnerdesc.cpu.ts
     (_, FUNCPTR) = ts.get_FuncType([self.VTYPEPTR], lltype.Void)
     funcptr = self.warmrunnerdesc.helper_func(FUNCPTR, force_if_necessary)
     rvirtualizable2.replace_promote_virtualizable_with_call(
         all_graphs, self.VTYPEPTR, funcptr)
Ejemplo n.º 2
0
    def finish(self):
        #
        def force_if_necessary(virtualizable):
            if virtualizable.vable_rti:
                self.force_now(virtualizable)

        force_if_necessary._always_inline_ = True
        #
        all_graphs = self.warmrunnerdesc.translator.graphs
        ts = self.warmrunnerdesc.cpu.ts
        (_, FUNCPTR) = ts.get_FuncType([self.VTYPEPTR], lltype.Void)
        funcptr = self.warmrunnerdesc.helper_func(FUNCPTR, force_if_necessary)
        rvirtualizable2.replace_promote_virtualizable_with_call(
            all_graphs, self.VTYPEPTR, funcptr)
Ejemplo n.º 3
0
    def replace_promote_virtualizable(self, rtyper, graphs):
        from pypy.annotation import model as annmodel
        from pypy.rpython.annlowlevel import MixLevelHelperAnnotator
        graph = graphs[0]

        for block, op in graph.iterblockops():
            if op.opname == 'promote_virtualizable':
                v_inst_ll_type = op.args[0].concretetype
                break
            
        def mycall(vinst_ll):
            pass
        annhelper = MixLevelHelperAnnotator(rtyper)
        if self.type_system == 'lltype':
            s_vinst = annmodel.SomePtr(v_inst_ll_type)
        else:
            s_vinst = annmodel.SomeOOInstance(v_inst_ll_type)
        funcptr = annhelper.delayedfunction(mycall, [s_vinst], annmodel.s_None)
        annhelper.finish()
        replace_promote_virtualizable_with_call(graphs, v_inst_ll_type,
                                                funcptr)
        return funcptr
Ejemplo n.º 4
0
    def replace_promote_virtualizable(self, rtyper, graphs):
        from pypy.annotation import model as annmodel
        from pypy.rpython.annlowlevel import MixLevelHelperAnnotator
        graph = graphs[0]

        for block, op in graph.iterblockops():
            if op.opname == 'promote_virtualizable':
                v_inst_ll_type = op.args[0].concretetype
                break

        def mycall(vinst_ll):
            pass

        annhelper = MixLevelHelperAnnotator(rtyper)
        if self.type_system == 'lltype':
            s_vinst = annmodel.SomePtr(v_inst_ll_type)
        else:
            s_vinst = annmodel.SomeOOInstance(v_inst_ll_type)
        funcptr = annhelper.delayedfunction(mycall, [s_vinst], annmodel.s_None)
        annhelper.finish()
        replace_promote_virtualizable_with_call(graphs, v_inst_ll_type,
                                                funcptr)
        return funcptr