ircmaxell / libgccjit
A wrapper for FFI with libgccjit
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 19
Watchers: 1
Forks: 2
Open Issues: 0
pkg:composer/ircmaxell/libgccjit
Requires
- ircmaxell/ffime: master@dev
This package is auto-updated.
Last update: 2025-10-06 20:09:24 UTC
README
This is a wrapper library for libgccjit using 7.4's FFI.
Basically, it exposes a "nice" interface in PHP for building JITs with GCC.
Example (in C, from https://gcc.gnu.org/wiki/JIT):
gcc_jit_type *void_type = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_VOID); gcc_jit_type *const_char_ptr_type = gcc_jit_context_get_type (ctxt, GCC_JIT_TYPE_CONST_CHAR_PTR); gcc_jit_param *param_name = gcc_jit_context_new_param (ctxt, NULL, const_char_ptr_type, "name"); gcc_jit_function *func = gcc_jit_context_new_function (ctxt, NULL, GCC_JIT_FUNCTION_EXPORTED, void_type, "some_fn", 1, ¶m_name, 0);
Would become:
$void_type = gcc_jit_context_get_type($ctxt, GCC_JIT_TYPE_VOID); $const_char_ptr_type = gcc_jit_context_get_type($ctxt, GCC_JIT_TYPE_CONST_CHAR_PTR); $param_name = gcc_jit_context_new_param($ctxt, null, $const_char_ptr_type, "name"); $func = gcc_jit_context_new_function( $ctxt, null, GCC_JIT_FUNCTION_EXPORTED, $void_type, "some_fn", 1, gcc_jit_param_ptr_ptr::fromArray($param_name), 0 );
It aims to be a simple, and type safe implementation in PHP.