-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjit.h
executable file
·44 lines (33 loc) · 879 Bytes
/
jit.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef __JIT__
#define __JIT__
#include <stdint.h>
typedef struct jit_context {
uint8_t *bytecode;
unsigned int bytecode_size;
void *memory;
unsigned int memory_offset;
jit_entry_t *entries;
jit_entry_t *last_entry;
jit_reloc_t *relocs;
jit_reloc_t *last_reloc;
} jit_context_t;
typedef struct jit_entry {
uint8_t *bytecode;
void *jitted_addr;
jit_entry_t *next;
} jit_entry_t;
typedef struct jit_reloc {
void *jitted_addr;
void *value;
jit_reloc_t *next;
} jit_reloc_t;
typedef void (jit_opcode_cb)(jit_context_t *context);
typedef struct jit_opcode {
char *pattern;
jit_opcode_cb *compile;
} jit_opcode_t;
jit_context_t *create_jit_context();
void add_entry(jit_context_t *context, jit_entry_t *entry);
void add_reloc(jit_context_t *context, jit_reloc_t *reloc);
void do_jit(jit_context_t *context);
#endif