Ejemplo n.º 1
0
 def __init__(self, metainterp_sd, loop):
     self.metainterp_sd = metainterp_sd
     self.cpu = metainterp_sd.cpu
     self.loop = loop
     self.values = {}
     self.interned_refs = self.cpu.ts.new_ref_dict()
     self.resumedata_memo = resume.ResumeDataLoopMemo(self.cpu)
     self.heap_op_optimizer = HeapOpOptimizer(self)
Ejemplo n.º 2
0
 def __init__(self, metainterp_sd, loop):
     self.metainterp_sd = metainterp_sd
     self.cpu = metainterp_sd.cpu
     self.loop = loop
     self.values = {}
     self.interned_refs = self.cpu.ts.new_ref_dict()
     self.resumedata_memo = resume.ResumeDataLoopMemo(metainterp_sd)
     self.heap_op_optimizer = HeapOpOptimizer(self)
     self.bool_boxes = {}
     self.loop_invariant_results = {}
     self.pure_operations = args_dict()
Ejemplo n.º 3
0
def optimize_loop(metainterp_sd, old_loops, loop):
    if old_loops:
        assert len(old_loops) == 1
        return old_loops[0]
    else:
        # copy loop operations here
        # we need it since the backend can modify those lists, which make
        # get_guard_op in compile.py invalid
        # in fact, x86 modifies this list for moving GCs
        memo = resume.ResumeDataLoopMemo(metainterp_sd)
        newoperations = []
        for op in loop.operations:
            if op.is_guard():
                descr = op.descr
                assert isinstance(descr, compile.ResumeGuardDescr)
                modifier = resume.ResumeDataVirtualAdder(descr, memo)
                newboxes = modifier.finish(EMPTY_VALUES)
                descr.store_final_boxes(op, newboxes)
            newoperations.append(op)
        loop.operations = newoperations
        return None
Ejemplo n.º 4
0
    def __init__(self, metainterp_sd, loop, optimizations=None):
        self.metainterp_sd = metainterp_sd
        self.cpu = metainterp_sd.cpu
        self.loop = loop
        self.values = {}
        self.interned_refs = self.cpu.ts.new_ref_dict()
        self.interned_ints = {}
        self.resumedata_memo = resume.ResumeDataLoopMemo(metainterp_sd)
        self.bool_boxes = {}
        self.producer = {}
        self.pendingfields = []
        self.quasi_immutable_deps = None
        self.opaque_pointers = {}
        self.replaces_guard = {}
        self._newoperations = []
        self.seen_results = {}
        self.optimizer = self
        self.optpure = None
        self.optearlyforce = None
        if loop is not None:
            self.call_pure_results = loop.call_pure_results

        self.set_optimizations(optimizations)
        self.setup()