4 // This file contains definitions YJIT exposes to the CRuby codebase
7 #include "ruby/internal/config.h"
8 #include "ruby_assert.h" // for RUBY_DEBUG
12 // YJIT_STATS controls whether to support runtime counters in generated code
13 // and in the interpreter.
15 # define YJIT_STATS RUBY_DEBUG
18 // We generate x86 assembly
19 #if (defined(__x86_64__) && !defined(_WIN32)) || (defined(_WIN32) && defined(_M_AMD64)) // x64 platforms without mingw/msys
20 # define YJIT_SUPPORTED_P 1
22 # define YJIT_SUPPORTED_P 0
25 struct rb_yjit_options
{
26 // Enable compilation with YJIT
29 // Size of the executable memory block to allocate in MiB
30 unsigned exec_mem_size
;
32 // Number of method calls after which to start generating code
33 // Threshold==1 means compile on first execution
34 unsigned call_threshold
;
36 // Generate versions greedily until the limit is hit
37 bool greedy_versioning
;
39 // Disable the propagation of type information
42 // Maximum number of versions per block
43 // 1 means always create generic versions
44 unsigned max_versions
;
46 // Capture and print out stats
53 bool rb_yjit_enabled_p(void);
54 unsigned rb_yjit_call_threshold(void);
56 void rb_yjit_invalidate_all_method_lookup_assumptions(void);
57 void rb_yjit_method_lookup_change(VALUE klass
, ID mid
);
58 void rb_yjit_cme_invalidate(VALUE cme
);
59 void rb_yjit_collect_vm_usage_insn(int insn
);
60 void rb_yjit_collect_binding_alloc(void);
61 void rb_yjit_collect_binding_set(void);
62 bool rb_yjit_compile_iseq(const rb_iseq_t
*iseq
, rb_execution_context_t
*ec
);
63 void rb_yjit_init(struct rb_yjit_options
*options
);
64 void rb_yjit_bop_redefined(VALUE klass
, const rb_method_entry_t
*me
, enum ruby_basic_operators bop
);
65 void rb_yjit_constant_state_changed(void);
66 void rb_yjit_iseq_mark(const struct rb_iseq_constant_body
*body
);
67 void rb_yjit_iseq_update_references(const struct rb_iseq_constant_body
*body
);
68 void rb_yjit_iseq_free(const struct rb_iseq_constant_body
*body
);
69 void rb_yjit_before_ractor_spawn(void);
70 void rb_yjit_constant_ic_update(const rb_iseq_t
*const iseq
, IC ic
);
71 void rb_yjit_tracing_invalidate_all(void);
73 #endif // #ifndef YJIT_H