[Python-Dev] Why is Bytecode the way it is?
Skip Montanaro
skip at pobox.com
Thu Jul 8 23:52:51 CEST 2004
>> Perhaps we take the CPU analogy too far. Or perhaps there is
>> something deep I misunderstand.
Martin> Most certainly. This stuff is *way*, *extremely* more difficult
Martin> to write than it is to read. Just try and see for yourself.
I wrote the rattlesnake VM (three-address model) ages ago (1.4 or 1.5?). I
got it mostly to work, but never quite 100%. There were a couple
instructions which were difficult to map into the register model for some
reason. I suspect there may be more today, though moves to write a
reasonable bytecode verifier may improve that situation. Even if I had
gotten it to work 100%, I would have been left with the problem of tracking
updates to the stack-based VM - an internal implementation detail don't
forget - until a cutover to the register-based VM could be made, and there'd
be no guarantees that would ever happen. (Keeping the stackless source
sync'd with the main CPython source must be a challenging task for Christian
Tismer.)
I still have the source if anyone's interested, though so much water has
passed under the bridge now that it would only be useful as a rough guide.
Forget "patch -p 0 < ..."!
Skip
More information about the Python-Dev
mailing list