Antoine> - Why are there both relative and absolute jump instructions?

The best place to search for the reasons behind this is Python/compile.c.
(JUMP_ABSOLUTE can jump backwards.)  There have been lots and lots of
changes to the Python virtual machine the past few years.  When trying to
understand the basic concepts it might be best to check out a very old
version of the code from Subversion (1.5.2, 2.0, 2.1, etc).  Those versions
have many fewer optimizations, so it's likely that compile.c and ceval.c
will be more readable.  (My full understanding of the virtual machine
probably ended with 1.5.2.)  That should give you a basic understanding of
how things work without the obfuscation added by the many optimizations.
You can then move to more recent versions and more easily see what's going
on, even in the face of all the optimizations.

    Antoine> (in that regard, I don't understand what JUMP_FORWARD can
    Antoine> possibly bring over JUMP_ABSOLUTE)

Well, you can't chain jumps together with the latter.  If, for some reason,
you needed to jump forward more than 16kbytes you could accomplish that with
multiple JUMP_FORWARD opcodes.

Skip
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to