Non-circular path through pypy module imports
Hello, I have been going through the pypy sources recently and I wanted to start from the leaf modules first (in terms of import dependencies)... but there don't appear to be any leaves. For example, starting with baseobjspace in the interpreter, it has 30 or so non-stdlib imports, many of them delayed by placing them in functions. Even something like rarithmetic eventually pulls in most of the lltype hierarchy. The closest I found to a leaf module was extregistry.py. Is there a reason for the circularities that I just don't get? If not, why are there so many? Thanks, Van
VanL wrote:
Hello,
Hi! Sorry for the late response, everyone thought that someone else would have been answered, but nobody did at the end :-)
I have been going through the pypy sources recently and I wanted to start from the leaf modules first (in terms of import dependencies)... but there don't appear to be any leaves.
For example, starting with baseobjspace in the interpreter, it has 30 or so non-stdlib imports, many of them delayed by placing them in functions. Even something like rarithmetic eventually pulls in most of the lltype hierarchy. The closest I found to a leaf module was extregistry.py.
Is there a reason for the circularities that I just don't get? If not, why are there so many?
Well, for at least some of circularities is partly our fault, we know that the import relationships between our modules are a mess currently. Sorry for that. Anyway, I don't think that starting from the leaves is the best option to grasp pypy: probably it's better to pick a topic you are interested in, and start from there. If you are more interested in the translation toolchain (i.e., the rpython-to-{c,cli,jvm} compiler), you can start from either the beginning or the end of the chain; look for example at the annotation/ directory or at the various backends in translator/{c,cli,jvm}. On the other hand, if you are more interested in the interpreter (i.e., the python implementation written in rpython) you want to have a look to interpreter/ and objspace/std. The former directory contains the core of the interpreter, while the latter contains the implementation of all the standard builtin types such as lists, dictionaries, classes, etc. A good starting point could be the main loop of the interpreter: look at the dispatch_bytecode function inside interpreter/pyopcode.py. I assume that you have already read the pypy documentation online; if not, you are strongly encouraged to do that before looking at the source; in particular, this document describes the high level architecture of pypy: http://codespeak.net/pypy/dist/pypy/doc/architecture.html More generally, all the pypy documentation is available here: http://codespeak.net/pypy/dist/pypy/doc/ ciao, Anto
participants (2)
-
Antonio Cuni
-
VanL