Ruby: zjit.h Source File

Ruby 4.0.5p0 (2026-05-20 revision 64336ffd0ee9e1f4c05891695a3d7b49cb709721)

zjit.h
1#ifndef ZJIT_H
2#define ZJIT_H 1
3//
4// This file contains definitions ZJIT exposes to the CRuby codebase
5//
6
7// ZJIT_STATS controls whether to support runtime counters in the interpreter
8#ifndef ZJIT_STATS
9# define ZJIT_STATS (USE_ZJIT && RUBY_DEBUG)
10#endif
11
12#if USE_ZJIT
13extern void *rb_zjit_entry;
14extern uint64_t rb_zjit_call_threshold;
15extern uint64_t rb_zjit_profile_threshold;
16void rb_zjit_compile_iseq(const rb_iseq_t *iseq, bool jit_exception);
17void rb_zjit_profile_insn(uint32_t insn, rb_execution_context_t *ec);
18void rb_zjit_profile_enable(const rb_iseq_t *iseq);
19void rb_zjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop);
20void rb_zjit_cme_invalidate(const rb_callable_method_entry_t *cme);
21void rb_zjit_cme_free(const rb_callable_method_entry_t *cme);
22void rb_zjit_klass_free(VALUE klass);
23void rb_zjit_invalidate_no_ep_escape(const rb_iseq_t *iseq);
24void rb_zjit_constant_state_changed(ID id);
25void rb_zjit_iseq_mark(void *payload);
26void rb_zjit_iseq_update_references(void *payload);
27void rb_zjit_iseq_free(const rb_iseq_t *iseq);
28void rb_zjit_before_ractor_spawn(void);
29void rb_zjit_tracing_invalidate_all(void);
30void rb_zjit_invalidate_no_singleton_class(VALUE klass);
31#else
32#define rb_zjit_entry 0
33static inline void rb_zjit_compile_iseq(const rb_iseq_t *iseq, bool jit_exception) {}
34static inline void rb_zjit_profile_insn(uint32_t insn, rb_execution_context_t *ec) {}
35static inline void rb_zjit_profile_enable(const rb_iseq_t *iseq) {}
36static inline void rb_zjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop) {}
37static inline void rb_zjit_cme_invalidate(const rb_callable_method_entry_t *cme) {}
38static inline void rb_zjit_invalidate_no_ep_escape(const rb_iseq_t *iseq) {}
39static inline void rb_zjit_constant_state_changed(ID id) {}
40static inline void rb_zjit_before_ractor_spawn(void) {}
41static inline void rb_zjit_tracing_invalidate_all(void) {}
42static inline void rb_zjit_invalidate_no_singleton_class(VALUE klass) {}
43#endif // #if USE_ZJIT
44
45#define rb_zjit_enabled_p (rb_zjit_entry != 0)
46
47#endif // #ifndef ZJIT_H
ID
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40