ruby/yjit_codegen.h

48 строки
1.0 KiB
C
Исходник Обычный вид История

#ifndef YJIT_CODEGEN_H
#define YJIT_CODEGEN_H 1
#include "stddef.h"
#include "yjit_core.h"
2020-12-17 05:45:51 +03:00
// Code blocks we generate code into
extern codeblock_t *cb;
extern codeblock_t *ocb;
2020-12-17 05:45:51 +03:00
// Code generation state
typedef struct JITState
{
2021-01-13 01:03:54 +03:00
// Block version being compiled
block_t* block;
2021-01-13 01:03:54 +03:00
// Instruction sequence this is associated with
const rb_iseq_t *iseq;
// Index of the current instruction being compiled
uint32_t insn_idx;
// PC of the instruction being compiled
VALUE *pc;
// Execution context when compilation started
// This allows us to peek at run-time values
rb_execution_context_t* ec;
2020-12-17 01:07:18 +03:00
} jitstate_t;
typedef enum codegen_status {
YJIT_END_BLOCK,
YJIT_KEEP_COMPILING,
YJIT_CANT_COMPILE
} codegen_status_t;
// Code generation function signature
typedef codegen_status_t (*codegen_fn)(jitstate_t* jit, ctx_t* ctx);
uint8_t* yjit_entry_prologue();
void yjit_gen_block(ctx_t* ctx, block_t* block, rb_execution_context_t* ec);
void yjit_init_codegen(void);
#endif // #ifndef YJIT_CODEGEN_H