Exemple #1
0
 def remove_mallocs_once(self, graph):
     """Perform one iteration of malloc removal."""
     simplify.remove_identical_vars(graph)
     lifetimes = self.compute_lifetimes(graph)
     progress = 0
     for info in lifetimes:
         progress += self._try_inline_malloc(info)
     return progress
Exemple #2
0
 def remove_mallocs_once(self, graph):
     """Perform one iteration of malloc removal."""
     simplify.remove_identical_vars(graph)
     self.graph = graph  # to make it possible to find in the debugger
     lifetimes = self.compute_lifetimes(graph)
     progress = 0
     for info in lifetimes:
         progress += self._try_inline_malloc(info)
     return progress
Exemple #3
0
def remove_tail_calls_to_self(translator, graph):
    entrymap = mkentrymap(graph)
    changed = False
    for link in entrymap[graph.returnblock]:
        block = link.prevblock
        if (len(block.exits) == 1 and len(block.operations) > 0
                and block.operations[-1].opname == 'direct_call'
                and block.operations[-1].result == link.args[0]):
            print "getgraph", graph
            if graph is graph:
                _remove_tail_call(translator, graph, block)
                changed = True
    if changed:
        from rpython.translator import simplify
        checkgraph(graph)
        simplify.remove_identical_vars(graph)
        simplify.eliminate_empty_blocks(graph)
        simplify.join_blocks(graph)
Exemple #4
0
def remove_tail_calls_to_self(translator, graph):
    entrymap = mkentrymap(graph)
    changed = False
    for link in entrymap[graph.returnblock]:
        block = link.prevblock
        if (len(block.exits) == 1 and
            len(block.operations) > 0 and
            block.operations[-1].opname == 'direct_call' and
            block.operations[-1].result == link.args[0]):
            print "getgraph", graph
            if graph is graph:
                _remove_tail_call(translator, graph, block)
                changed = True
    if changed:
        from rpython.translator import simplify
        checkgraph(graph)
        simplify.remove_identical_vars(graph)
        simplify.eliminate_empty_blocks(graph)
        simplify.join_blocks(graph)