2021-03-06 23:46:56 +00:00
|
|
|
//
|
|
|
|
// This file contains definitions YJIT exposes to the CRuby codebase
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef YJIT_H
|
|
|
|
#define YJIT_H 1
|
|
|
|
|
2021-03-24 22:07:26 +00:00
|
|
|
#include "vm_core.h"
|
2021-03-06 23:46:56 +00:00
|
|
|
#include "method.h"
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#define PLATFORM_SUPPORTED_P 0
|
|
|
|
#else
|
|
|
|
#define PLATFORM_SUPPORTED_P 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef YJIT_CHECK_MODE
|
|
|
|
#define YJIT_CHECK_MODE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// >= 1: print when output code invalidation happens
|
|
|
|
// >= 2: dump list of instructions when regions compile
|
|
|
|
#ifndef YJIT_DUMP_MODE
|
|
|
|
#define YJIT_DUMP_MODE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef rb_iseq_t
|
|
|
|
typedef struct rb_iseq_struct rb_iseq_t;
|
|
|
|
#define rb_iseq_t rb_iseq_t
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct rb_yjit_options {
|
2021-04-24 04:16:48 +00:00
|
|
|
// Enable compilation with YJIT
|
2021-03-06 23:46:56 +00:00
|
|
|
bool yjit_enabled;
|
|
|
|
|
2021-05-26 19:25:50 +00:00
|
|
|
// Size of the executable memory block to allocate in MiB
|
|
|
|
unsigned exec_mem_size;
|
|
|
|
|
2021-03-06 23:46:56 +00:00
|
|
|
// Number of method calls after which to start generating code
|
|
|
|
// Threshold==1 means compile on first execution
|
|
|
|
unsigned call_threshold;
|
|
|
|
|
2021-04-24 04:16:48 +00:00
|
|
|
// Generate versions greedily until the limit is hit
|
|
|
|
bool greedy_versioning;
|
|
|
|
|
|
|
|
// Maximum number of versions per block
|
|
|
|
// 1 means always create generic versions
|
2021-06-23 17:55:34 +00:00
|
|
|
unsigned max_versions;
|
2021-04-24 04:16:48 +00:00
|
|
|
|
2021-03-06 23:46:56 +00:00
|
|
|
// Capture and print out stats
|
|
|
|
bool gen_stats;
|
|
|
|
};
|
|
|
|
|
|
|
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
|
|
bool rb_yjit_enabled_p(void);
|
|
|
|
unsigned rb_yjit_call_threshold(void);
|
|
|
|
RUBY_SYMBOL_EXPORT_END
|
|
|
|
|
2021-03-17 23:07:20 +00:00
|
|
|
void rb_yjit_invalidate_all_method_lookup_assumptions(void);
|
|
|
|
void rb_yjit_method_lookup_change(VALUE klass, ID mid);
|
|
|
|
void rb_yjit_cme_invalidate(VALUE cme);
|
2021-03-06 23:46:56 +00:00
|
|
|
void rb_yjit_collect_vm_usage_insn(int insn);
|
2021-04-07 19:51:50 +00:00
|
|
|
void rb_yjit_collect_binding_alloc(void);
|
|
|
|
void rb_yjit_collect_binding_set(void);
|
2021-03-06 23:46:56 +00:00
|
|
|
void rb_yjit_compile_iseq(const rb_iseq_t *iseq, rb_execution_context_t *ec);
|
|
|
|
void rb_yjit_init(struct rb_yjit_options *options);
|
|
|
|
void rb_yjit_bop_redefined(VALUE klass, const rb_method_entry_t *me, enum ruby_basic_operators bop);
|
|
|
|
void rb_yjit_constant_state_changed(void);
|
|
|
|
void rb_yjit_iseq_mark(const struct rb_iseq_constant_body *body);
|
|
|
|
void rb_yjit_iseq_update_references(const struct rb_iseq_constant_body *body);
|
|
|
|
void rb_yjit_iseq_free(const struct rb_iseq_constant_body *body);
|
|
|
|
void rb_yjit_before_ractor_spawn(void);
|
2021-03-24 22:07:26 +00:00
|
|
|
void yjit_constant_ic_update(const rb_iseq_t *iseq, IC ic);
|
2021-03-06 23:46:56 +00:00
|
|
|
|
|
|
|
#endif // #ifndef YJIT_H
|