Example #1
0
 def _call_with_env_structure(self, args, env, cont, env_structure):
     jit.promote(self.caselam)
     jit.promote(env_structure)
     (actuals, frees, lam) = self._find_lam(args)
     # specialize on the fact that often we end up executing in the
     # same environment.
     prev = lam.env_structure.prev.find_env_in_chain_speculate(
             frees, env_structure, env)
     return lam.make_begin_cont(
         ConsEnv.make(actuals, prev),
         cont)
Example #2
0
 def call_with_extra_info(self, args, env, cont, calling_app):
     env_structure = None
     if calling_app is not None:
         env_structure = calling_app.env_structure
     jit.promote(self.caselam)
     jit.promote(env_structure)
     (actuals, frees, lam) = self._find_lam(args)
     if not jit.we_are_jitted() and env.pycketconfig().callgraph:
         env.toplevel_env().callgraph.register_call(lam, calling_app, cont, env)
     # specialize on the fact that often we end up executing in the
     # same environment.
     prev = lam.env_structure.prev.find_env_in_chain_speculate(frees, env_structure, env)
     return lam.make_begin_cont(ConsEnv.make(actuals, prev), cont)
Example #3
0
 def call_with_extra_info(self, args, env, cont, calling_app):
     env_structure = None
     if calling_app is not None:
         env_structure = calling_app.env_structure
     jit.promote(self.caselam)
     jit.promote(env_structure)
     (actuals, frees, lam) = self._find_lam(args)
     if not jit.we_are_jitted() and env.pycketconfig().callgraph:
         env.toplevel_env().callgraph.register_call(lam, calling_app, cont,
                                                    env)
     # specialize on the fact that often we end up executing in the
     # same environment.
     prev = lam.env_structure.prev.find_env_in_chain_speculate(
         frees, env_structure, env)
     return lam.make_begin_cont(ConsEnv.make(actuals, prev), cont)
Example #4
0
 def lookup(self, sym, env_structure):
     jit.promote(env_structure)
     if len(env_structure.elems) == self._get_size_list():
         return ConsEnv.lookup(self, sym, env_structure)
     recursive_sym = jit.promote(self.caselam).recursive_sym
     if sym is recursive_sym:
         return self
     i = 0
     for s in env_structure.elems:
         if s is recursive_sym:
             continue
         if s is sym:
             v = self._get_list(i)
             assert v is not None
             return v
         i += 1 # only count non-self references
     prev = self.get_prev(env_structure)
     return prev.lookup(sym, env_structure.prev)
Example #5
0
 def lookup(self, sym, env_structure):
     jit.promote(env_structure)
     if len(env_structure.elems) == self._get_size_list():
         return ConsEnv.lookup(self, sym, env_structure)
     recursive_sym = jit.promote(self.caselam).recursive_sym
     if sym is recursive_sym:
         return self
     i = 0
     for s in env_structure.elems:
         if s is recursive_sym:
             continue
         if s is sym:
             v = self._get_list(i)
             assert v is not None
             return v
         i += 1  # only count non-self references
     prev = self.get_prev(env_structure)
     return prev.lookup(sym, env_structure.prev)
Example #6
0
 def __init__(self, caselam, toplevel_env):
     self.closure = W_Closure._make([ConsEnv.make([], toplevel_env)] * len(caselam.lams), caselam, toplevel_env)
Example #7
0
 def __init__(self, caselam, prev):
     ConsEnv.__init__(self, prev)
     self.caselam = caselam
Example #8
0
 def __init__(self, caselam, env):
     self.caselam = caselam
     for (i,lam) in enumerate(caselam.lams):
         vals = lam.collect_frees(caselam.recursive_sym, env, self)
         self._set_list(i, ConsEnv.make(vals, env.toplevel_env()))
Example #9
0
 def __init__(self, caselam, toplevel_env):
     self.closure = W_Closure._make([ConsEnv.make([], toplevel_env)] *
                                    len(caselam.lams), caselam,
                                    toplevel_env)
Example #10
0
 def __init__(self, caselam, prev):
     ConsEnv.__init__(self, prev)
     self.caselam = caselam
Example #11
0
 def __init__(self, caselam, env):
     self.caselam = caselam
     for (i, lam) in enumerate(caselam.lams):
         vals = lam.collect_frees(caselam.recursive_sym, env, self)
         self._set_list(i, ConsEnv.make(vals, env.toplevel_env()))