Exemple #1
0
 def _gcref_index(self, gcref):
     if self.gcrefs_map is None:
         self.gcrefs_map = new_ref_dict()
     try:
         return self.gcrefs_map[gcref]
     except KeyError:
         pass
     index = len(self.gcrefs_output_list)
     self.gcrefs_map[gcref] = index
     self.gcrefs_output_list.append(gcref)
     return index
Exemple #2
0
 def quasi_immut_now_known(self, fielddescr, box):
     cache = self.heap_cache.get(fielddescr, None)
     if cache is None:
         cache = self.heap_cache[fielddescr] = CacheEntry(self)
     if isinstance(box, Const):
         if cache.quasiimmut_seen_refs is None:
             cache.quasiimmut_seen_refs = new_ref_dict()
         cache.quasiimmut_seen_refs[box.getref_base()] = None
     else:
         if cache.quasiimmut_seen is not None:
             cache.quasiimmut_seen[box] = None
         else:
             cache.quasiimmut_seen = {box: None}
Exemple #3
0
    def tracing_done(self):
        from rpython.rlib.debug import debug_start, debug_stop, debug_print
        assert not self.tag_overflow

        self._bigints_dict = {}
        self._refs_dict = new_ref_dict()
        debug_start("jit-trace-done")
        debug_print("trace length: " + str(self._pos))
        debug_print(" total snapshots: " + str(self._total_snapshots))
        debug_print(" bigint consts: " + str(self._consts_bigint) + " " + str(len(self._bigints)))
        debug_print(" float consts: " + str(self._consts_float) + " " + str(len(self._floats)))
        debug_print(" ref consts: " + str(self._consts_ptr) + " " + str(len(self._refs)))
        debug_print(" descrs: " + str(len(self._descrs)))
        debug_stop("jit-trace-done")
Exemple #4
0
    def tracing_done(self):
        from rpython.rlib.debug import debug_start, debug_stop, debug_print
        if self.tag_overflow:
            raise SwitchToBlackhole(Counters.ABORT_TOO_LONG)

        self._bigints_dict = {}
        self._refs_dict = new_ref_dict()
        debug_start("jit-trace-done")
        debug_print("trace length: " + str(self._pos))
        debug_print(" total snapshots: " + str(self._total_snapshots))
        debug_print(" bigint consts: " + str(self._consts_bigint) + " " +
                    str(len(self._bigints)))
        debug_print(" float consts: " + str(self._consts_float) + " " +
                    str(len(self._floats)))
        debug_print(" ref consts: " + str(self._consts_ptr) + " " +
                    str(len(self._refs)))
        debug_print(" descrs: " + str(len(self._descrs)))
        debug_stop("jit-trace-done")
Exemple #5
0
 def __init__(self, inputargs, metainterp_sd):
     self.metainterp_sd = metainterp_sd
     self._ops = [rffi.cast(get_model(self).STORAGE_TP, 0)] * get_model(self).INIT_SIZE
     self._pos = 0
     self._consts_bigint = 0
     self._consts_float = 0
     self._total_snapshots = 0
     self._consts_ptr = 0
     self._descrs = [None]
     self._refs = [lltype.nullptr(llmemory.GCREF.TO)]
     self._refs_dict = new_ref_dict()
     self._bigints = []
     self._bigints_dict = {}
     self._floats = []
     self._snapshots = []
     for i, inparg in enumerate(inputargs):
         inparg.set_position(i)
     self._count = len(inputargs) # total count
     self._index = len(inputargs) # "position" of resulting resops
     self._start = len(inputargs)
     self._pos = self._start
     self.inputargs = inputargs
     self.tag_overflow = False
Exemple #6
0
    def __init__(self, metainterp_sd, jitdriver_sd, optimizations=None):
        self.metainterp_sd = metainterp_sd
        self.jitdriver_sd = jitdriver_sd
        self.cpu = metainterp_sd.cpu
        self.interned_refs = new_ref_dict()
        self.resumedata_memo = resume.ResumeDataLoopMemo(metainterp_sd)
        self.pendingfields = None  # set temporarily to a list, normally by
        # heap.py, as we're about to generate a guard
        self.quasi_immutable_deps = None
        self.replaces_guard = {}
        self._newoperations = []
        self._emittedoperations = {}
        self.optimizer = self
        self.optpure = None
        self.optheap = None
        self.optrewrite = None
        self.optearlyforce = None
        self.optunroll = None
        self._really_emitted_operation = None

        self._last_guard_op = None

        self.set_optimizations(optimizations)
        self.setup()
Exemple #7
0
 def setup(self):
     self.optimizer.optheap = self
     # mapping const value -> info corresponding to it's heap cache
     self.const_infos = new_ref_dict()