Nicholas Clark wrote:
I had a (possibly) impractical idea - computed goto / JIT (or even computed goto / prederef / jit) core
I don't know whether this is possible:
Inside a cgoto core have 1 extra op - enter JITted section.
The bytecode is "compiled" by the JIT (at some point) - if there are a run
of consecutive JIT-able ops, then issue a section (an isolated section) of
machine code for those ops, and replace those ops in the bytecode with an op
that calls that section. If there isn't a run of JIT-able ops, then just
leave the ops as ops, and use the regular computed goto core dispatch.
This would need non trivial changes to JIT, for building only a section of code (JIT isn't really (J)ust ;-)
But before going a rather complicated way, I would implement more JITed ops, as i386 already does with many vtable calls.
Or go the other way round: Run from JIT. If there is a sequence of non JITable ops, convert these to a CGP section, which returns to JIT when finished. This would save a lot of function calls to jit_normal_op.
Nicholas Clark
leo