summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2021-02-03 15:09:34 -0800
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:28 -0400
commitab5760307b730f3b418b3eae016c442ca4f57d14 (patch)
tree46dec7bc70cdd91888d03964686383e8a426620c
parentd2d564be1db247f21e15c847584b0ec2cae4428d (diff)
downloadruby-ab5760307b730f3b418b3eae016c442ca4f57d14.tar.gz
add a callback for when method cache changes
-rw-r--r--ujit.h1
-rw-r--r--ujit_iface.c7
-rw-r--r--vm_method.c1
3 files changed, 9 insertions, 0 deletions
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);
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_
//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)
void
rb_clear_constant_cache(void)
{
+ rb_ujit_constant_state_changed();
INC_GLOBAL_CONSTANT_STATE();
}