1. Alex Prengère
  2. pypy


pypy / pypy / jit / metainterp / optimizeopt / __init__.py

Amaury Forgeot d… d0c8792 

Armin Rigo f0dc295 
Hakan Ardo 3dde4cb 
Maciej Fijalkows… 67c539d 
Hakan Ardo 8b3e60e 
Hakan Ardo a98b728 
Armin Rigo 935c947 
Maciej Fijalkows… 80bd259 
Hakan Ardo bbbc4b2 

Amaury Forgeot d… 92d5090 
Maciej Fijalkows… 67c539d 

Hakan Ardo a98b728 
Hakan Ardo 8b3e60e 
Maciej Fijalkows… 67c539d 

Maciej Fijalkows… 80bd259 
Maciej Fijalkows… 67c539d 

Armin Rigo f0dc295 
Maciej Fijalkows… 67c539d 

Armin Rigo 935c947 

Hakan Ardo 8ed931c 
Antonio Cuni 8d6cdc4 
Maciej Fijalkows… 67c539d 
Armin Rigo 7bf584b 
Maciej Fijalkows… 80bd259 
Maciej Fijalkows… 67c539d 

Armin Rigo 426be91 
Hakan Ardo f2da357 

Hakan Ardo 8cc6f87 
Alex Gaynor 3fe1b82 
Antonio Cuni 8d6cdc4 

Hakan Ardo 8ed931c 
Hakan Ardo 9ef690e 

Hakan Ardo bbbc4b2 

Hakan Ardo e65693c 

from pypy.jit.metainterp.optimizeopt.optimizer import Optimizer
from pypy.jit.metainterp.optimizeopt.rewrite import OptRewrite
from pypy.jit.metainterp.optimizeopt.intbounds import OptIntBounds
from pypy.jit.metainterp.optimizeopt.virtualize import OptVirtualize
from pypy.jit.metainterp.optimizeopt.heap import OptHeap
from pypy.jit.metainterp.optimizeopt.vstring import OptString
from pypy.jit.metainterp.optimizeopt.unroll import optimize_unroll
from pypy.jit.metainterp.optimizeopt.simplify import OptSimplify
from pypy.jit.metainterp.optimizeopt.pure import OptPure
from pypy.jit.metainterp.optimizeopt.earlyforce import OptEarlyForce
from pypy.rlib.jit import PARAMETERS, ENABLE_ALL_OPTS
from pypy.rlib.unroll import unrolling_iterable
from pypy.rlib.debug import debug_start, debug_stop, debug_print

ALL_OPTS = [('intbounds', OptIntBounds),
            ('rewrite', OptRewrite),
            ('virtualize', OptVirtualize),
            ('string', OptString),
            ('earlyforce', OptEarlyForce),
            ('pure', OptPure),
            ('heap', OptHeap),
            ('unroll', None)]
# no direct instantiation of unroll
unroll_all_opts = unrolling_iterable(ALL_OPTS)

ALL_OPTS_DICT = dict.fromkeys([name for name, _ in ALL_OPTS])
ALL_OPTS_LIST = [name for name, _ in ALL_OPTS]
ALL_OPTS_NAMES = ':'.join([name for name, _ in ALL_OPTS])

    'please fix rlib/jit.py to say ENABLE_ALL_OPTS = %r' % (ALL_OPTS_NAMES,))

def build_opt_chain(metainterp_sd, enable_opts):
    config = metainterp_sd.config
    optimizations = []
    unroll = 'unroll' in enable_opts    # 'enable_opts' is normally a dict
    for name, opt in unroll_all_opts:
        if name in enable_opts:
            if opt is not None:
                o = opt()

    if ('rewrite' not in enable_opts or 'virtualize' not in enable_opts
        or 'heap' not in enable_opts or 'unroll' not in enable_opts
        or 'pure' not in enable_opts):

    return optimizations, unroll

def optimize_trace(metainterp_sd, loop, enable_opts, inline_short_preamble=True):
    """Optimize loop.operations to remove internal overheadish operations.

        loop.logops = metainterp_sd.logger_noopt.log_loop(loop.inputargs,
        optimizations, unroll = build_opt_chain(metainterp_sd, enable_opts)
        if unroll:
            optimize_unroll(metainterp_sd, loop, optimizations, inline_short_preamble)
            optimizer = Optimizer(metainterp_sd, loop, optimizations)
if __name__ == '__main__':
    print ALL_OPTS_NAMES