Hello.
I have a proposal to improve performance of JITed code <-> VM communication
and fix some potential bugs. To reach it the Magic opportunity should be
extended. One of the new features is creating M2nFrame on the stack.
To support it, the following methods may be added to the Magic:
1. Address AllocateOnStack(int size) – if JIT found this during
compilation, it generate a code which reserve requested area size.
2. Two static methods put_registers(Adress m2nFrame) and
pop_registers(Adress
m2nFrame) which put all registers to specified address and restores
them from specified address correspondingly. Jit should inline code
generated by m2n_gen_push_m2n and m2n_gen_pop_m2n (see
…./vm/port/src/lil/ia32/pim/ m2n_ia32.cpp line 195, 270 ) istead calls of
these static methods..
So code which creates N2n on the stack will be look like in following
example:
…
Address m2nFrame = AllocateOnStack(M2N_FRAME_SIZE);
put_registers(m2nFrame);
…
The other useful feature is a fast native call. I think it can looks like an
analog of JNI call, but without any wrappers and any additional action in
implementation (like exceptions rethrow for example). "fastcall" calling
convention can be used for it.
Thanks
Pavel Afremov
|