Package logilab-common-0 :: Package 39 :: Package 0 :: Module bind
[frames] | no frames]

Module bind

source code

Optimize globals in certain functions by binding their names to values
provided in a dictionnary.

:copyright: 2002-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
:license: General Public License version 2 - http://www.gnu.org/licenses

Functions
 
bind_code(co, globals)
Take a code object and a dictionnary and returns a new code object where...
source code
 
bind(f, globals)
Returns a new function whose code object has been...
source code
 
optimize_module(m, global_consts) source code
 
analyze_code(co, globals, consts_dict, consts_list)
Take a code object and a dictionnary and returns a...
source code
 
rewrite_code(co, consts_dict, consts_tuple)
Take a code object and a dictionnary and returns a...
source code
 
optimize_module_2(m, globals_consts, bind_builtins=1) source code
 
run_bench(n) source code
 
test_pystone() source code
Variables
  LOAD_GLOBAL = 116
  LOAD_CONST = 100
  EXTENDED_ARG = 143
  STORE_GLOBAL = 97
  builtins = __builtins__.__dict__
  bind_code_opt = bind(bind_code_opt, globals())
Function Details

bind_code(co, globals)

source code 

Take a code object and a dictionnary and returns a new code object where
the opcodes LOAD_GLOBAL are replaced by LOAD_CONST whenever the global's
name appear in the dictionnary

bind(f, globals)

source code 
Returns a new function whose code object has been
bound by bind_code()

analyze_code(co, globals, consts_dict, consts_list)

source code 
Take a code object and a dictionnary and returns a
new code object where the opcodes LOAD_GLOBAL are replaced
by LOAD_CONST whenever the global's name appear in the
dictionnary

rewrite_code(co, consts_dict, consts_tuple)

source code 
Take a code object and a dictionnary and returns a
new code object where the opcodes LOAD_GLOBAL are replaced
by LOAD_CONST whenever the global's name appear in the
dictionnary