ruby-changes:68743
From: Aaron <ko1@a...>
Date: Thu, 21 Oct 2021 08:13:15 +0900 (JST)
Subject: [ruby-changes:68743] ab5760307b (master): add a callback for when method cache changes
https://git.ruby-lang.org/ruby.git/commit/?id=ab5760307b From ab5760307b730f3b418b3eae016c442ca4f57d14 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Wed, 3 Feb 2021 15:09:34 -0800 Subject: add a callback for when method cache changes --- ujit.h | 1 + ujit_iface.c | 7 +++++++ vm_method.c | 1 + 3 files changed, 9 insertions(+) diff --git a/ujit.h b/ujit.h index 3fb78200fd..a931ce0d3d 100644 --- a/ujit.h +++ b/ujit.h @@ -53,5 +53,6 @@ void rb_ujit_method_lookup_change(VALUE cme_or_cc); https://github.com/ruby/ruby/blob/trunk/ujit.h#L53 void rb_ujit_compile_iseq(const rb_iseq_t *iseq); void rb_ujit_init(struct rb_ujit_options *options); void rb_ujit_bop_redefined(VALUE klass, const rb_method_entry_t *me, enum ruby_basic_operators bop); +void rb_ujit_constant_state_changed(void); #endif // #ifndef UJIT_H diff --git a/ujit_iface.c b/ujit_iface.c index cf8113de00..2494d6c854 100644 --- a/ujit_iface.c +++ b/ujit_iface.c @@ -423,6 +423,13 @@ rb_ujit_bop_redefined(VALUE klass, const rb_method_entry_t *me, enum ruby_basic_ https://github.com/ruby/ruby/blob/trunk/ujit_iface.c#L423 //fprintf(stderr, "bop redefined\n"); } +/* Called when the constant state changes */ +void +rb_ujit_constant_state_changed(void) +{ + //fprintf(stderr, "bop redefined\n"); +} + #if HAVE_LIBCAPSTONE static const rb_data_type_t ujit_disasm_type = { "UJIT/Disasm", diff --git a/vm_method.c b/vm_method.c index 544abca753..08c8013010 100644 --- a/vm_method.c +++ b/vm_method.c @@ -141,6 +141,7 @@ vm_cme_invalidate(rb_callable_method_entry_t *cme) https://github.com/ruby/ruby/blob/trunk/vm_method.c#L141 void rb_clear_constant_cache(void) { + rb_ujit_constant_state_changed(); INC_GLOBAL_CONSTANT_STATE(); } -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/