Re: [Myjit-devel] Edge case `jit_free` segfault
Status: Beta
Brought to you by:
pkrajca
From: Adam C. <cim...@gm...> - 2016-09-25 22:27:21
|
My code now works! I also noticed that the function pointers are written by `jit_generate_code` and not by `jit_prolog` as I originally assumed, after changing my function signatures all is good. Thank you for your help, Adam > On 25 Sep 2016, at 16:32, Petr Krajča <pet...@up...> wrote: > > Hello Adam, > > On Sun, 25 Sep 2016 14:29:28 +0200, Adam Cimarosti <cim...@gm...> wrote: > >> This could very well be incorrect usage on my part. >> * Specifically, I am using the same `jit` object to generate two functions. It hasn't given me issues with different code, so I assume it's supported. > > It is perfectly correct to generate two function using single `jit` object. However, you must call jit_generate_code(p) only once. Hence, you have to move lines > > jit_check_code(p, JIT_WARN_ALL); > jit_generate_code(p); > > into the main-function. > > >> * I am also returning 0 for a function with void return type, I assume this is the correct thing to do (rather than skipping the return >altogether). > > Yes, it's correct, you have to return something. > > Best regards, > Petr |