[pypy-dev] Experiments with PyPy and libgccjit

Ryan Gonzalez rymg19 at gmail.com
Sun Dec 14 23:22:30 CET 2014


As awesome as this would be, I'd be surprised if this worked since LLVM
didn't.

On Fri, Dec 12, 2014 at 8:13 PM, 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
>
>

-- 
Ryan
If anybody ever asks me why I prefer C++ to C, my answer will be simple:
"It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was
nul-terminated."
Personal reality distortion fields are immune to contradictory evidence. -
srean
Check out my website: http://kirbyfan64.github.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20141214/70672181/attachment.html>


More information about the pypy-dev mailing list