4 static jit_state_t *_jit;
6 typedef void (*pvfi)(int); /* Pointer to Void Function of Int */
8 int main(int argc, char *argv[])
10 pvfi myFunction; /* ptr to generated code */
11 jit_node_t *start, *end; /* a couple of labels */
12 jit_node_t *in; /* to get the argument */
15 _jit = jit_new_state();
17 start = jit_note(__FILE__, __LINE__);
20 jit_getarg(JIT_R1, in);
22 jit_pushargi((jit_word_t)"generated %d bytes\n");
28 end = jit_note(__FILE__, __LINE__);
30 myFunction = jit_emit();
32 /* call the generated code, passing its size as argument */
33 myFunction((char*)jit_address(end) - (char*)jit_address(start));