Skip to content

Instantly share code, notes, and snippets.

@shyouhei
Created July 31, 2020 02:57
Show Gist options
  • Save shyouhei/c1ea03d01cd5af63bbc7576dcf1343bb to your computer and use it in GitHub Desktop.
Save shyouhei/c1ea03d01cd5af63bbc7576dcf1343bb to your computer and use it in GitHub Desktop.
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 5e1cfccf3c..db97ec62a6 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2076,6 +2076,14 @@ vm_call_iseq_setup(rb_execution_context_t *ec, rb_control_frame_t *cfp, struct r
const int param_size = iseq->body->param.size;
const int local_size = iseq->body->local_table_size;
const int opt_pc = vm_callee_setup_arg(ec, calling, cd, def_iseq_ptr(cc->me->def), cfp->sp - calling->argc, param_size, local_size);
+ const int __line__ = rb_vm_get_sourceline(cfp);
+ if (__line__ > 0) {
+ const char *__file__ = RSTRING_PTR(rb_iseq_path(cfp->iseq));
+ const char *recv = rb_obj_classname(calling->recv);
+ const char *mid = rb_id2name(cd->ci.mid);
+ fprintf(stderr, "cache eviction: %s#%s is called from %s:%d\n",
+ recv, mid, __file__, __line__);
+ }
return vm_call_iseq_setup_2(ec, cfp, calling, cd, opt_pc, param_size, local_size);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment