Ruby  3.1.4p223 (2023-03-30 revision HEAD)
yjit.h
1 #ifndef YJIT_H
2 #define YJIT_H 1
3 //
4 // This file contains definitions YJIT exposes to the CRuby codebase
5 //
6 
7 #include "ruby/internal/config.h"
8 #include "ruby_assert.h" // for RUBY_DEBUG
9 #include "vm_core.h"
10 #include "method.h"
11 
12 // YJIT_STATS controls whether to support runtime counters in generated code
13 // and in the interpreter.
14 #ifndef YJIT_STATS
15 # define YJIT_STATS RUBY_DEBUG
16 #endif
17 
18 // We generate x86 assembly and rely on mmap(2).
19 #if defined(__x86_64__) && !defined(_WIN32)
20 # define YJIT_SUPPORTED_P 1
21 #else
22 # define YJIT_SUPPORTED_P 0
23 #endif
24 
26  // Enable compilation with YJIT
27  bool yjit_enabled;
28 
29  // Size of the executable memory block to allocate in MiB
30  unsigned exec_mem_size;
31 
32  // Number of method calls after which to start generating code
33  // Threshold==1 means compile on first execution
34  unsigned call_threshold;
35 
36  // Generate versions greedily until the limit is hit
37  bool greedy_versioning;
38 
39  // Disable the propagation of type information
40  bool no_type_prop;
41 
42  // Maximum number of versions per block
43  // 1 means always create generic versions
44  unsigned max_versions;
45 
46  // Capture and print out stats
47  bool gen_stats;
48 
49  // Run backend tests
50  bool test_backend;
51 };
52 
53 bool rb_yjit_enabled_p(void);
54 unsigned rb_yjit_call_threshold(void);
55 
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);
72 
73 #endif // #ifndef YJIT_H
Definition: method.h:54
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition: value.h:52
uintptr_t VALUE
Type that represents a Ruby object.
Definition: value.h:40