11# define ZJIT_STATS (USE_ZJIT && RUBY_DEBUG)
27 bool materialize_block_code;
44#define ZJIT_STACK_MAP_VREG_TAG 0x08
45#define ZJIT_STACK_MAP_SKIP_TAG 0x10
46#define ZJIT_STACK_MAP_BASE_PTR_TAG 0x18
47#define ZJIT_STACK_MAP_TAG_MASK 0xff
48#define ZJIT_STACK_MAP_SHIFT 8
52#define ZJIT_STACK_MAP_BASE_PTR_SIZE_SHIFT 32
53#define ZJIT_STACK_MAP_BASE_PTR_INDEX_MASK 0xffffff
56ZJIT_STACK_MAP_VREG_P(
VALUE entry)
58 return (entry & ZJIT_STACK_MAP_TAG_MASK) == ZJIT_STACK_MAP_VREG_TAG;
62ZJIT_STACK_MAP_VREG_INDEX(
VALUE entry)
64 return entry >> ZJIT_STACK_MAP_SHIFT;
68ZJIT_STACK_MAP_SKIP_P(
VALUE entry)
70 return (entry & ZJIT_STACK_MAP_TAG_MASK) == ZJIT_STACK_MAP_SKIP_TAG;
74ZJIT_STACK_MAP_SKIP_SIZE(
VALUE entry)
76 return entry >> ZJIT_STACK_MAP_SHIFT;
86ZJIT_STACK_MAP_BASE_PTR_P(
VALUE entry)
88 return (entry & ZJIT_STACK_MAP_TAG_MASK) == ZJIT_STACK_MAP_BASE_PTR_TAG;
96ZJIT_STACK_MAP_BASE_PTR_SLOT_INDEX(
VALUE entry)
98 return (entry >> ZJIT_STACK_MAP_SHIFT) & ZJIT_STACK_MAP_BASE_PTR_INDEX_MASK;
104ZJIT_STACK_MAP_BASE_PTR_STACK_SIZE(
VALUE entry)
106 return entry >> ZJIT_STACK_MAP_BASE_PTR_SIZE_SHIFT;
109extern void *rb_zjit_entry;
110extern bool rb_zjit_compiling_p;
112extern unsigned int rb_zjit_call_threshold;
113extern unsigned int rb_zjit_profile_threshold;
114extern uint64_t rb_zjit_max_compile_time_ns;
115extern uint64_t rb_zjit_total_compile_time_ns;
118void rb_zjit_profile_enable(
const rb_iseq_t *iseq);
119void rb_zjit_bop_redefined(
int redefined_flag,
enum ruby_basic_operators bop);
122void rb_zjit_klass_free(
VALUE klass);
123void rb_zjit_invalidate_no_ep_escape(
const rb_iseq_t *iseq);
124void rb_zjit_constant_state_changed(
ID id);
125void rb_zjit_iseq_mark(
void *payload);
126void rb_zjit_iseq_update_references(
void *payload);
127void rb_zjit_mark_all_writable(
void);
128void rb_zjit_mark_all_executable(
void);
129void rb_zjit_iseq_free(
const rb_iseq_t *iseq);
130void rb_zjit_invalidate_single_ractor(
void);
131void rb_zjit_tracing_invalidate_all(
void);
132void rb_zjit_invalidate_newobj_hook(
void);
133void rb_zjit_invalidate_no_singleton_class(
VALUE klass);
134void rb_zjit_invalidate_root_box(
void);
138size_t rb_zjit_hash_new_size(
VALUE *flags_out,
size_t size);
139VALUE rb_zjit_new_obj_shape(
VALUE flags,
size_t alloc_size);
140bool rb_zjit_class_allocate_instance_fastpath(
VALUE klass,
size_t *size_out,
VALUE *flags_out);
141bool rb_zjit_str_resurrect_fastpath(
VALUE str,
bool chilled,
size_t *size_out,
VALUE *flags_out,
rb_len_t *len_out,
size_t *byte_size_out);
142bool rb_zjit_array_dup_can_fastpath(
VALUE ary,
size_t *alloc_size_out,
VALUE *flags_out,
rb_len_t *len_out);
143bool rb_zjit_array_new_can_fastpath(
rb_len_t len,
size_t *alloc_size_out,
VALUE *flags_out);
144bool rb_zjit_hash_dup_can_fastpath(
VALUE hash,
size_t *alloc_size_out,
VALUE *flags_out,
VALUE *ifnone_out,
rb_len_t *bound_out);
145void rb_zjit_range_new_fastpath(
bool exclude_end,
size_t *alloc_size_out,
VALUE *flags_out);
146void rb_zjit_array_new_fastpath(
size_t *alloc_size_out,
VALUE *flags_out);
147bool rb_zjit_newobj_hook_enabled_p(
void);
153#define ZJIT_JIT_RETURN_C_FRAME 0x1
158 if ((
VALUE)cfp->jit_return == ZJIT_JIT_RETURN_C_FRAME) {
159 return &rb_zjit_c_frame;
175#define rb_zjit_entry 0
176#define rb_zjit_compiling_p false
179static inline void rb_zjit_profile_enable(
const rb_iseq_t *iseq) {}
180static inline void rb_zjit_bop_redefined(
int redefined_flag,
enum ruby_basic_operators bop) {}
182static inline void rb_zjit_invalidate_no_ep_escape(
const rb_iseq_t *iseq) {}
183static inline void rb_zjit_constant_state_changed(
ID id) {}
184static inline void rb_zjit_invalidate_single_ractor(
void) {}
185static inline void rb_zjit_tracing_invalidate_all(
void) {}
186static inline void rb_zjit_invalidate_newobj_hook(
void) {}
187static inline void rb_zjit_invalidate_no_singleton_class(
VALUE klass) {}
188static inline void rb_zjit_invalidate_root_box(
void) {}
189static inline void rb_zjit_jit_frame_update_references(
zjit_jit_frame_t *jit_frame) {}
195#define rb_zjit_enabled_p (rb_zjit_entry != 0)
201 if (!rb_zjit_enabled_p)
return false;
202 return cfp->jit_return != NULL;
205static inline const VALUE*
208 if (CFP_ZJIT_FRAME_P(cfp)) {
209 return CFP_ZJIT_FRAME(cfp)->pc;
217 if (CFP_ZJIT_FRAME_P(cfp)) {
218 return CFP_ZJIT_FRAME(cfp)->iseq;
int len
Length of the buffer.
long rb_len_t
A signed integer type for lengths and indices of objects such as String and Array.
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
uintptr_t VALUE
Type that represents a Ruby object.