[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mixing JIT and GCC (with a precompiled header?)?



Hello all,

Suppose that I have some header file in C myhead.h, containing notably

     // Boehm's garbage collector, notably defines GC_malloc_atomic & GC_malloc
     #include <gc/gc.h>
     struct myintvec_st {
       unsigned vsiz; // allocated size
       unsigned vlen; // used length, always <= vsiz
       int varr[];
     };

     static inline struct myintvec_st*vec_alloc(unsigned siz) {
        size_t fullsiz = sizeof(struct myintvec_st)+siz*sizeof(int));
        struct myintvec_st* v = GC_malloc_atomic(fullsiz);
        memset(v, 0, fullsiz);
        v->vsiz = siz;
        return v;
     }

and many other struct declaration and static inline functions and extern function declarations.

Now, I would like to use libgccjit with a context which contains all
the functions & structures from file myhead.h, in particular because I
want to JIT some calls to inlined static functions, and I expect the
gccjit to do the inlining (assuming I am using JIT with -O2 by calling
gcc_jit_context_set_int_option with
GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL to 2).

How is that possible? What should be done to make that possible?

I imagine that we might need a new function which initialize a
gcc_jit_context from a precompiled header...

Where should it go?

Regards.
-- 
Basile Starynkevitch     http://starynkevitch.net/Basile/