Exemplo n.º 1
0
    def __init__(self, translator=None, policy=None, bookkeeper=None):
        import pypy.rpython.ootypesystem.ooregistry  # has side effects
        import pypy.rpython.ootypesystem.bltregistry  # has side effects
        import pypy.rpython.extfuncregistry  # has side effects
        import pypy.rlib.nonconst  # has side effects

        if translator is None:
            # interface for tests
            from pypy.translator.translator import TranslationContext
            translator = TranslationContext()
            translator.annotator = self
        self.translator = translator
        self.pendingblocks = {}  # map {block: graph-containing-it}
        self.bindings = {}  # map Variables to SomeValues
        self.annotated = {}  # set of blocks already seen
        self.added_blocks = None  # see processblock() below
        self.links_followed = {}  # set of links that have ever been followed
        self.notify = {}  # {block: {positions-to-reflow-from-when-done}}
        self.fixed_graphs = {}  # set of graphs not to annotate again
        self.blocked_blocks = {}  # set of {blocked_block: graph}
        # --- the following information is recorded for debugging only ---
        # --- and only if annotation.model.DEBUG is kept to True
        self.why_not_annotated = {
        }  # {block: (exc_type, exc_value, traceback)}
        # records the location of BlockedInference
        # exceptions that blocked some blocks.
        self.blocked_graphs = {}  # set of graphs that have blocked blocks
        self.bindingshistory = {}  # map Variables to lists of SomeValues
        self.binding_caused_by = {}  # map Variables to position_keys
        # records the caller position that caused bindings of inputargs
        # to be updated
        self.binding_cause_history = {}  # map Variables to lists of positions
        # history of binding_caused_by, kept in sync with
        # bindingshistory
        self.reflowcounter = {}
        self.return_bindings = {}  # map return Variables to their graphs
        # --- end of debugging information ---
        self.frozen = False
        if policy is None:
            from pypy.annotation.policy import AnnotatorPolicy
            self.policy = AnnotatorPolicy()
        else:
            self.policy = policy
        if bookkeeper is None:
            bookkeeper = Bookkeeper(self)
        self.bookkeeper = bookkeeper
Exemplo n.º 2
0
    def __init__(self, translator=None, policy=None, bookkeeper=None):
        import pypy.rpython.ootypesystem.ooregistry  # has side effects
        import pypy.rpython.extfuncregistry  # has side effects
        import pypy.rlib.nonconst  # has side effects

        if translator is None:
            # interface for tests
            from pypy.translator.translator import TranslationContext
            translator = TranslationContext()
            translator.annotator = self
        self.translator = translator
        self.pendingblocks = {}  # map {block: graph-containing-it}
        self.bindings = {}  # map Variables to SomeValues
        self.annotated = {}  # set of blocks already seen
        self.added_blocks = None  # see processblock() below
        self.links_followed = {}  # set of links that have ever been followed
        self.notify = {}  # {block: {positions-to-reflow-from-when-done}}
        self.fixed_graphs = {}  # set of graphs not to annotate again
        self.blocked_blocks = {}  # set of {blocked_block: graph}
        # --- the following information is recorded for debugging only ---
        # --- and only if annotation.model.DEBUG is kept to True
        self.why_not_annotated = {
        }  # {block: (exc_type, exc_value, traceback)}
        # records the location of BlockedInference
        # exceptions that blocked some blocks.
        self.blocked_graphs = {}  # set of graphs that have blocked blocks
        self.bindingshistory = {}  # map Variables to lists of SomeValues
        self.binding_caused_by = {}  # map Variables to position_keys
        # records the caller position that caused bindings of inputargs
        # to be updated
        self.binding_cause_history = {}  # map Variables to lists of positions
        # history of binding_caused_by, kept in sync with
        # bindingshistory
        self.reflowcounter = {}
        self.return_bindings = {}  # map return Variables to their graphs
        # --- end of debugging information ---
        self.frozen = False
        if policy is None:
            from pypy.annotation.policy import AnnotatorPolicy
            self.policy = AnnotatorPolicy()
        else:
            self.policy = policy
        if bookkeeper is None:
            bookkeeper = Bookkeeper(self)
        self.bookkeeper = bookkeeper