Пример #1
0
 def __init__(self, metainterp_sd, jitdriver_sd, cost_threshold):
     Optimizer.__init__(self, metainterp_sd, jitdriver_sd)
     self.cpu = metainterp_sd.cpu
     self.cost_threshold = cost_threshold
     self.packset = None
     self.unroll_count = 0
     self.smallest_type_bytes = 0
     self.orig_label_args = None
Пример #2
0
    def forget_optimization_info(self):
        """ Clean up optimization info on all operations stored in the ExportedState.

        This function needs to be called when exporting the optimizer state to
        prevent leaking of optimization information between invocations of the
        optimizer.

        That includes cleaning up in the event that optimize_peeled_loop() fails
        with an InvalidLoop exception, as optimize_peeled_loop() mutates the
        contents of ExportedState.
        """
        Optimizer._clean_optimization_info(self.renamed_inputargs)
        for box in self.exported_infos.iterkeys():
            box.clear_forwarded()
        for box in self.short_boxes:
            box.forget_optimization_info()
Пример #3
0
def optimize_trace(metainterp_sd, loop, enable_opts, inline_short_preamble=True):
    """Optimize loop.operations to remove internal overheadish operations.
    """

    debug_start("jit-optimize")
    try:
        loop.logops = metainterp_sd.logger_noopt.log_loop(loop.inputargs,
                                                          loop.operations)
        optimizations, unroll = build_opt_chain(metainterp_sd, enable_opts)
        if unroll:
            optimize_unroll(metainterp_sd, loop, optimizations, inline_short_preamble)
        else:
            optimizer = Optimizer(metainterp_sd, loop, optimizations)
            optimizer.propagate_all_forward()
    finally:
        debug_stop("jit-optimize")
Пример #4
0
    def forget_optimization_info(self):
        """ Clean up optimization info on all operations stored in the ExportedState.

        This function needs to be called when exporting the optimizer state to
        prevent leaking of optimization information between invocations of the
        optimizer.

        That includes cleaning up in the event that optimize_peeled_loop() fails
        with an InvalidLoop exception, as optimize_peeled_loop() mutates the
        contents of ExportedState.
        """
        Optimizer._clean_optimization_info(self.renamed_inputargs)
        for box in self.exported_infos.iterkeys():
            box.clear_forwarded()
        for box in self.short_boxes:
            box.forget_optimization_info()
Пример #5
0
def optimize_trace(metainterp_sd, jitdriver_sd, loop, enable_opts,
                   inline_short_preamble=True, start_state=None,
                   export_state=True):
    """Optimize loop.operations to remove internal overheadish operations.
    """

    debug_start("jit-optimize")
    try:
        loop.logops = metainterp_sd.logger_noopt.log_loop(loop.inputargs,
                                                          loop.operations)
        optimizations, unroll = build_opt_chain(metainterp_sd, enable_opts)
        if unroll:
            return optimize_unroll(metainterp_sd, jitdriver_sd, loop,
                                   optimizations,
                                   inline_short_preamble, start_state,
                                   export_state)
        else:
            optimizer = Optimizer(metainterp_sd, jitdriver_sd, loop,
                                  optimizations)
            optimizer.propagate_all_forward()
    finally:
        debug_stop("jit-optimize")
Пример #6
0
 def optimize(self, metainterp_sd, jitdriver_sd, optimizations):
     from rpython.jit.metainterp.optimizeopt.optimizer import Optimizer
     opt = Optimizer(metainterp_sd, jitdriver_sd, optimizations)
     return opt.optimize_loop(self.trace, self.resumestorage,
                              self.call_pure_results)
Пример #7
0
 def __init__(self, metainterp_sd, jitdriver_sd, optimizations):
     Optimizer.__init__(self, metainterp_sd, jitdriver_sd, optimizations)
     self.optunroll = OptUnroll()
     self.optunroll.optimizer = self