mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
* ZJIT: Add NoSingletonClass patch point This patch point makes sure that when the object has a singleton class, the JIT code is invalidated. As of now, this is only needed for C call optimization. In YJIT, the singleton class guard only applies to Array, Hash, and String. But in ZJIT, we may optimize C calls from gems (e.g. `sqlite3`). So the patch point needs to be applied to a broader range of classes. * ZJIT: Only generate NoSingletonClass guard when the type can have singleton class * ZJIT: Update or forget NoSingletonClass patch point when needed
46 lines
2.0 KiB
C
46 lines
2.0 KiB
C
#ifndef ZJIT_H
|
|
#define ZJIT_H 1
|
|
//
|
|
// This file contains definitions ZJIT exposes to the CRuby codebase
|
|
//
|
|
|
|
// ZJIT_STATS controls whether to support runtime counters in the interpreter
|
|
#ifndef ZJIT_STATS
|
|
# define ZJIT_STATS (USE_ZJIT && RUBY_DEBUG)
|
|
#endif
|
|
|
|
#if USE_ZJIT
|
|
extern bool rb_zjit_enabled_p;
|
|
extern uint64_t rb_zjit_call_threshold;
|
|
extern uint64_t rb_zjit_profile_threshold;
|
|
void rb_zjit_compile_iseq(const rb_iseq_t *iseq, bool jit_exception);
|
|
void rb_zjit_profile_insn(uint32_t insn, rb_execution_context_t *ec);
|
|
void rb_zjit_profile_enable(const rb_iseq_t *iseq);
|
|
void rb_zjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop);
|
|
void rb_zjit_cme_invalidate(const rb_callable_method_entry_t *cme);
|
|
void rb_zjit_cme_free(const rb_callable_method_entry_t *cme);
|
|
void rb_zjit_klass_free(VALUE klass);
|
|
void rb_zjit_invalidate_no_ep_escape(const rb_iseq_t *iseq);
|
|
void rb_zjit_constant_state_changed(ID id);
|
|
void rb_zjit_iseq_mark(void *payload);
|
|
void rb_zjit_iseq_update_references(void *payload);
|
|
void rb_zjit_iseq_free(const rb_iseq_t *iseq);
|
|
void rb_zjit_before_ractor_spawn(void);
|
|
void rb_zjit_tracing_invalidate_all(void);
|
|
void rb_zjit_invalidate_no_singleton_class(VALUE klass);
|
|
#else
|
|
#define rb_zjit_enabled_p false
|
|
static inline void rb_zjit_compile_iseq(const rb_iseq_t *iseq, bool jit_exception) {}
|
|
static inline void rb_zjit_profile_insn(uint32_t insn, rb_execution_context_t *ec) {}
|
|
static inline void rb_zjit_profile_enable(const rb_iseq_t *iseq) {}
|
|
static inline void rb_zjit_bop_redefined(int redefined_flag, enum ruby_basic_operators bop) {}
|
|
static inline void rb_zjit_cme_invalidate(const rb_callable_method_entry_t *cme) {}
|
|
static inline void rb_zjit_invalidate_no_ep_escape(const rb_iseq_t *iseq) {}
|
|
static inline void rb_zjit_constant_state_changed(ID id) {}
|
|
static inline void rb_zjit_before_ractor_spawn(void) {}
|
|
static inline void rb_zjit_tracing_invalidate_all(void) {}
|
|
static inline void rb_zjit_invalidate_no_singleton_class(VALUE klass) {}
|
|
#endif // #if USE_ZJIT
|
|
|
|
#endif // #ifndef ZJIT_H
|