2021-03-07 02:46:56 +03:00
|
|
|
#ifndef YJIT_CODEGEN_H
|
|
|
|
#define YJIT_CODEGEN_H 1
|
2020-12-09 00:54:41 +03:00
|
|
|
|
|
|
|
#include "stddef.h"
|
2021-03-07 02:46:56 +03:00
|
|
|
#include "yjit_core.h"
|
2020-12-09 00:54:41 +03:00
|
|
|
|
2020-12-17 05:45:51 +03:00
|
|
|
// Code blocks we generate code into
|
2021-01-22 23:06:51 +03:00
|
|
|
extern codeblock_t *cb;
|
|
|
|
extern codeblock_t *ocb;
|
2021-08-26 00:00:45 +03:00
|
|
|
extern uint32_t yjit_codepage_frozen_bytes;
|
2020-12-17 05:45:51 +03:00
|
|
|
|
2021-03-02 04:43:58 +03:00
|
|
|
typedef enum codegen_status {
|
2021-03-07 02:46:56 +03:00
|
|
|
YJIT_END_BLOCK,
|
|
|
|
YJIT_KEEP_COMPILING,
|
|
|
|
YJIT_CANT_COMPILE
|
2021-03-02 04:43:58 +03:00
|
|
|
} codegen_status_t;
|
2021-01-08 01:09:25 +03:00
|
|
|
|
2021-03-02 04:43:58 +03:00
|
|
|
// Code generation function signature
|
2021-09-21 21:04:02 +03:00
|
|
|
typedef codegen_status_t (*codegen_fn)(jitstate_t* jit, ctx_t* ctx, codeblock_t* cb);
|
2021-01-08 01:09:25 +03:00
|
|
|
|
2021-09-22 23:16:26 +03:00
|
|
|
uint8_t* yjit_entry_prologue(codeblock_t* cb, const rb_iseq_t* iseq);
|
2020-12-18 21:49:53 +03:00
|
|
|
|
2021-04-24 07:16:48 +03:00
|
|
|
void yjit_gen_block(block_t* block, rb_execution_context_t* ec);
|
2020-12-09 00:54:41 +03:00
|
|
|
|
2021-03-07 02:46:56 +03:00
|
|
|
void yjit_init_codegen(void);
|
2020-12-09 00:54:41 +03:00
|
|
|
|
2021-03-07 02:46:56 +03:00
|
|
|
#endif // #ifndef YJIT_CODEGEN_H
|