Split out context object into jitstate_t and ctx_t

This commit is contained in:
Maxime Chevalier-Boisvert 2020-12-18 15:02:43 -05:00 committed by Alan Wu
parent 5e39d83fbd
commit df16bf97ec
5 changed files with 111 additions and 114 deletions

View file

@ -7,8 +7,25 @@
codeblock_t* cb;
codeblock_t* ocb;
// Code generation state
typedef struct JITState
{
// Instruction sequence this is associated with
const rb_iseq_t *iseq;
// Index in the iseq of the opcode we are replacing
uint32_t start_idx;
// Index of the current instruction being compiled
uint32_t insn_idx;
// Current PC
VALUE *pc;
} jitstate_t;
// Code generation function signature
typedef bool (*codegen_fn)(codeblock_t* cb, codeblock_t* ocb, ctx_t* ctx);
typedef bool (*codegen_fn)(jitstate_t* jit, ctx_t* ctx);
uint8_t* ujit_compile_entry(const rb_iseq_t *iseq, uint32_t insn_idx);