Quoting Leopold Toetsch <[EMAIL PROTECTED]>:

[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


Thank you. The POD is a little thick, and I'll be printing it out so I can
follow along. I'm going to copy the i386 path to an a64 path and have at it.
I'm hoping it won't be much of a stretch to get 64-bit code generated --
although REASONABLE 64-bit code is another problem. But first I want to ask if
anybody else is doing this already. I don't know what I'm getting myself into,
other than at least modifying ~5,000 lines of code.




Reply via email to