[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> I have been trying to examine the i386 code generator to see how
> feasible it would be to create an AMD64 code generator.
> Unfortunately, the code is uncommented, and I haven't yet found any
> documentation to explain how it works on Parrot.  So far I've
> determined there's relevant stuff in jit/i386.  I don't understand the
> .jit extension on core.jit.  Is that not actually heavily templated C
> code?

jit/*/jit_emit.h defines basically a bunch of macros that emit opcodes.
There are additionally some interface functions like
Parrot_jit_begin(), Parrot_jit_normal_op and the register move functions
called from src/jit.c to copy registers from Parrot to CPU and back.

i386 has additional code to emit NCI stubs and direct vtable calls,
which all is optional. docs/jit.pod has some more details on the
interface functions.

The format of jit/*/core.jit is also covered by doc/jit.pod. It defines
JITted opcode functions which, when called by the code generator in
src/jit.c, emit code for the function. It makes use of templates to
generate the final code in src/jit_cpu.c and src/exec_cpu.c.

Please have a look at these generated files and the docs. If there are
some more questions, please just ask.

leo

Reply via email to