Staging
v0.8.1
https://github.com/python/cpython
Revision e36f77814e83bd2b3dc84a4e0bfb0b8dc0da9965 authored by Jeremy Hylton on 19 January 2001, 03:21:30 UTC, committed by Jeremy Hylton on 19 January 2001, 03:21:30 UTC
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.
1 parent 19fe14e
History
Tip revision: e36f77814e83bd2b3dc84a4e0bfb0b8dc0da9965 authored by Jeremy Hylton on 19 January 2001, 03:21:30 UTC
This patch introduces an extra pass to the compiler that generates a
Tip revision: e36f778
File Mode Size
BeOS
Demo
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Python
Tools
.cvsignore -rw-r--r-- 79 bytes
.hgtags -rw-r--r-- 1.7 KB
LICENSE -rw-r--r-- 8.6 KB
Makefile.in -rw-r--r-- 18.0 KB
README -rw-r--r-- 35.8 KB
acconfig.h -rw-r--r-- 6.0 KB
config.h.in -rw-r--r-- 16.6 KB
configure -rwxr-xr-x 181.6 KB
configure.in -rw-r--r-- 37.9 KB
install-sh -rwxr-xr-x 2.2 KB
setup.cfg.in -rw-r--r-- 69 bytes
setup.py -rw-r--r-- 22.7 KB

README

back to top