diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-01-19 03:21:30 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-01-19 03:21:30 (GMT) |
commit | e36f77814e83bd2b3dc84a4e0bfb0b8dc0da9965 (patch) | |
tree | 1accc04b93292a6fbef2a2a5629d05521e67ec88 /Lib/test/test_bastion.py | |
parent | 19fe14e76ac3619e633b10c0e31effc2dad3c543 (diff) | |
download | cpython-e36f77814e83bd2b3dc84a4e0bfb0b8dc0da9965.zip cpython-e36f77814e83bd2b3dc84a4e0bfb0b8dc0da9965.tar.gz cpython-e36f77814e83bd2b3dc84a4e0bfb0b8dc0da9965.tar.bz2 |
This patch introduces an extra pass to the compiler that generates a
symbol table for each top-level compilation unit. The information in
the symbol table allows the elimination of the later optimize() pass;
the bytecode generation emits the correct opcodes.
The current version passes the complete regression test, but may still
contain some bugs. It's a fairly substantial revision. The current
code adds an assert() and a test that may lead to a Py_FatalError().
I expect to remove these before 2.1 beta 1.
The symbol table (struct symtable) is described in comments in the
code.
The changes affects the several com_XXX() functions that were used to
emit LOAD_NAME and its ilk. The primary interface for this bytecode
is now com_addop_varname() which takes a kind and a name, where kind
is one of VAR_LOAD, VAR_STORE, or VAR_DELETE.
There are many other smaller changes:
- The name mangling code is no longer contained in ifdefs. There are
two functions that expose the mangling logical: com_mangle() and
symtable_mangle().
- The com_error() function can accept NULL for its first argument;
this is useful with is_constant_false() is called during symbol
table generation.
- The loop index names used by list comprehensions have been changed
from __1__ to [1], so that they can not be accessed by Python code.
- in com_funcdef(), com_argdefs() is now called before the body of the
function is compiled. This provides consistency with com_lambdef()
and symtable_funcdef().
- Helpers do_pad(), dump(), and DUMP() are added to aid in debugging
the compiler.
Diffstat (limited to 'Lib/test/test_bastion.py')
0 files changed, 0 insertions, 0 deletions