Although I'm sure this is already obvious to the PyPy
people, I'm quite interested to see how close they are to a system that would be capable of efficiently executing interpreters written on top of the existing system.
PyPy is a python implementation written in python. The translation and jit architecture (as I understand it) uses manually inserted hints [pdf]
to indicate what variables belong to the interpreter vs the interpreted program, so that the jit can accurately determine when the interpreted program has looped (as opposed to the interpreter itself). This is important because, in general, optimizing the code executed of the interpreter has fairly limited gains: you gain a faster interpreter, but execution is still interpreted. The hints allow the system to distinguish between the accidental
work of interpretation from the essence
of what is being interpreted.
But it's not recursive. Even though the runtime has the required logic, it is missing the hints, and so an interpreter running on top of this stack will run faster, but it won't make the jump to direct execution.
The question that intrigues me is this:
Would it be possible to generate those hints dynamically to make the gains available to higher level interpreters?