[pypy-dev] Experiments with PyPy and libgccjit
Maciej Fijalkowski
fijall at gmail.com
Sat Dec 13 14:59:41 CET 2014
Hi Dave.
There is no documentation, but we can help you on IRC. Two things that
pop into my mind:
* Can libgcc patch existing assembler? (it's necessary)
* Can libgcc tell us where on stack are GC roots? (also necessary)
On Sat, Dec 13, 2014 at 4:13 AM, David Malcolm <dmalcolm at redhat.com> wrote:
> I'm the maintainer of a new feature for the (not-yet-released) GCC 5:
> libgccjit: a way to build gcc as a shared library, suitable for
> generating code in-process. See:
> https://gcc.gnu.org/wiki/JIT
>
> I've been experimenting with embedding it within PyPy - my thought was
> that gcc has great breadth of hardware support, so maybe PyPy could use
> libgccjit as a fallback backend for targets which don't yet have their
> own pypy jit backends.
>
> I'm attaching the work I've got so far, in patch form; I apologize for
> the rough work-in-progress nature of the patch. It has:
>
> * a toy example of calling libgccjit from cffi, to build and
> run code in process (see
> rpython/jit/backend/libgccjit/cffi_bindings.py).
>
> * doing the same from rffi (see
> rpython/jit/backend/libgccjit/rffi_bindings.py and
> rpython/jit/backend/libgccjit/test/test_rffi_bindings.py)
> These seem to work: the translator builds binaries that call
> into my library, which builds machine code "on the fly".
> Is there a way to do this without going through the
> translation step?
>
> * the beginnings of a JIT backend:
> I hack up rpython/jit/backend/detect_cpu.py to always use:
> rpython/jit/backend/libgccjit/runner.py
> and this merely raises an exception, albeit dumping the
> operations seen in loops.
>
> My thinking is that I ought to be able to use the rffi bindings of
> libgccjit to implement the backend, and somehow turn the operations I'm
> seeing into calls into my libgccjit API.
>
> Does this sound useful, and am I on the right track here?
>
> Is there documentation about the meaning of the various kinds of
> operations within a to-be-JITted-loop?
>
> Thanks
> Dave
>
>
> _______________________________________________
> pypy-dev mailing list
> pypy-dev at python.org
> https://mail.python.org/mailman/listinfo/pypy-dev
>
More information about the pypy-dev
mailing list