Пример #1
0
 def build_specialized_graph(self, graph, key, nodelist):
     graph2 = copygraph(graph)
     virtualframe = VirtualFrame(graph2.startblock, 0, nodelist)
     graphbuilder = GraphBuilder(self, graph2)
     specblock = graphbuilder.start_from_virtualframe(virtualframe)
     specgraph = graph2
     specgraph.name += '_mallocv'
     specgraph.startblock = specblock
     self.specialized_graphs[key] = ('call', specgraph)
     try:
         graphbuilder.propagate_specializations()
     except ForcedInline, e:
         if self.verbose:
             log.mallocv('%s inlined: %s' % (graph.name, e))
         self.specialized_graphs[key] = ('inline', None)
Пример #2
0
 def build_specialized_graph(self, graph, key, nodelist):
     graph2 = copygraph(graph)
     virtualframe = VirtualFrame(graph2.startblock, 0, nodelist)
     graphbuilder = GraphBuilder(self, graph2)
     specblock = graphbuilder.start_from_virtualframe(virtualframe)
     specgraph = graph2
     specgraph.name += '_mallocv'
     specgraph.startblock = specblock
     self.specialized_graphs[key] = ('call', specgraph)
     try:
         graphbuilder.propagate_specializations()
     except ForcedInline, e:
         if self.verbose:
             log.mallocv('%s inlined: %s' % (graph.name, e))
         self.specialized_graphs[key] = ('inline', None)
Пример #3
0
 def logresult(self, op, msg, exc=None):    # only for nice log outputs
     if self.verbose:
         if exc is None:
             exc = ''
         else:
             exc = ': %s' % (exc,)
         chain = []
         while True:
             chain.append(str(op.result))
             if op.opname != 'direct_call':
                 break
             fobj = op.args[0].value._obj
             op = self.inline_and_remove[fobj.graph]
         log.mallocv('%s %s%s' % ('->'.join(chain), msg, exc))
     elif exc is None:
         log.dot()
Пример #4
0
 def logresult(self, op, msg, exc=None):  # only for nice log outputs
     if self.verbose:
         if exc is None:
             exc = ''
         else:
             exc = ': %s' % (exc, )
         chain = []
         while True:
             chain.append(str(op.result))
             if op.opname != 'direct_call':
                 break
             fobj = op.args[0].value._obj
             op = self.inline_and_remove[fobj.graph]
         log.mallocv('%s %s%s' % ('->'.join(chain), msg, exc))
     elif exc is None:
         log.dot()
Пример #5
0
 def report_result(self, progress):
     if progress:
         log.mallocv('removed %d mallocs so far' % self.count_virtualized)
     else:
         log.mallocv('done')
Пример #6
0
        virtualframe = VirtualFrame(graph2.startblock, 0, nodelist)
        graphbuilder = GraphBuilder(self, graph2)
        specblock = graphbuilder.start_from_virtualframe(virtualframe)
        specgraph = graph2
        specgraph.name += '_mallocv'
        specgraph.startblock = specblock
        self.specialized_graphs[key] = ('call', specgraph)
        try:
            graphbuilder.propagate_specializations()
        except ForcedInline, e:
            if self.verbose:
                log.mallocv('%s inlined: %s' % (graph.name, e))
            self.specialized_graphs[key] = ('inline', None)
        except CannotVirtualize, e:
            if self.verbose:
                log.mallocv('%s failing: %s' % (graph.name, e))
            self.specialized_graphs[key] = ('fail', None)
        else:
            self.graphbuilders[specgraph] = graphbuilder
            self.specgraphorigin[specgraph] = graph, nodelist
            self.graphs.append(specgraph)


class GraphBuilder(object):

    def __init__(self, mallocv, graph):
        self.mallocv = mallocv
        self.graph = graph
        self.specialized_blocks = {}
        self.pending_specializations = []
Пример #7
0
        virtualframe = VirtualFrame(graph2.startblock, 0, nodelist)
        graphbuilder = GraphBuilder(self, graph2)
        specblock = graphbuilder.start_from_virtualframe(virtualframe)
        specgraph = graph2
        specgraph.name += "_mallocv"
        specgraph.startblock = specblock
        self.specialized_graphs[key] = ("call", specgraph)
        try:
            graphbuilder.propagate_specializations()
        except ForcedInline, e:
            if self.verbose:
                log.mallocv("%s inlined: %s" % (graph.name, e))
            self.specialized_graphs[key] = ("inline", None)
        except CannotVirtualize, e:
            if self.verbose:
                log.mallocv("%s failing: %s" % (graph.name, e))
            self.specialized_graphs[key] = ("fail", None)
        else:
            self.graphbuilders[specgraph] = graphbuilder
            self.specgraphorigin[specgraph] = graph, nodelist
            self.graphs.append(specgraph)


class GraphBuilder(object):
    def __init__(self, mallocv, graph):
        self.mallocv = mallocv
        self.graph = graph
        self.specialized_blocks = {}
        self.pending_specializations = []

    def initialize_from_old_builder(self, oldbuilder):
Пример #8
0
 def report_result(self, progress):
     if progress:
         log.mallocv('removed %d mallocs so far' % self.count_virtualized)
     else:
         log.mallocv('done')
Пример #9
0
        virtualframe = VirtualFrame(graph2.startblock, 0, nodelist)
        graphbuilder = GraphBuilder(self, graph2)
        specblock = graphbuilder.start_from_virtualframe(virtualframe)
        specgraph = graph2
        specgraph.name += '_mallocv'
        specgraph.startblock = specblock
        self.specialized_graphs[key] = ('call', specgraph)
        try:
            graphbuilder.propagate_specializations()
        except ForcedInline, e:
            if self.verbose:
                log.mallocv('%s inlined: %s' % (graph.name, e))
            self.specialized_graphs[key] = ('inline', None)
        except CannotVirtualize, e:
            if self.verbose:
                log.mallocv('%s failing: %s' % (graph.name, e))
            self.specialized_graphs[key] = ('fail', None)
        else:
            self.graphbuilders[specgraph] = graphbuilder
            self.specgraphorigin[specgraph] = graph, nodelist
            self.graphs.append(specgraph)


class GraphBuilder(object):
    def __init__(self, mallocv, graph):
        self.mallocv = mallocv
        self.graph = graph
        self.specialized_blocks = {}
        self.pending_specializations = []

    def initialize_from_old_builder(self, oldbuilder):