1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add a callback in to microjit when a BOP is redefined

This commit adds a callback `rb_ujit_bop_redefined` when a basic
operation is redefined.
This commit is contained in:
Aaron Patterson 2021-01-29 14:31:18 -08:00 committed by Alan Wu
parent 05c72d40b7
commit 863ff14997
3 changed files with 10 additions and 0 deletions

1
ujit.h
View file

@ -52,5 +52,6 @@ void rb_ujit_collect_vm_usage_insn(int insn);
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);
#endif // #ifndef UJIT_H

View file

@ -413,6 +413,13 @@ iseq_end_index(VALUE self)
return INT2NUM(block->end_idx);
}
/* Called when a basic operation is redefined */
void
rb_ujit_bop_redefined(VALUE klass, const rb_method_entry_t *me)
{
//fprintf(stderr, "bop redefined\n");
}
#if HAVE_LIBCAPSTONE
static const rb_data_type_t ujit_disasm_type = {
"UJIT/Disasm",

2
vm.c
View file

@ -1856,6 +1856,8 @@ rb_vm_check_redefinition_opt_method(const rb_method_entry_t *me, VALUE klass)
if (vm_redefinition_check_method_type(me->def)) {
if (st_lookup(vm_opt_method_def_table, (st_data_t)me->def, &bop)) {
int flag = vm_redefinition_check_flag(klass);
rb_ujit_bop_redefined(klass, me);
ruby_vm_redefined_flag[bop] |= flag;
}
}