summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 8a0166e1ee..a727ea8776 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -190,7 +190,16 @@ vm_call0_body(rb_execution_context_t *ec, struct rb_calling_info *calling, const
}
rb_check_arity(calling->argc, 1, 1);
- ret = rb_ivar_set(calling->recv, vm_cc_cme(cc)->def->body.attr.id, argv[0]);
+ if (UNLIKELY(ruby_vm_event_flags & (RUBY_EVENT_C_CALL | RUBY_EVENT_C_RETURN))) {
+ EXEC_EVENT_HOOK(ec, RUBY_EVENT_C_CALL, calling->recv,
+ vm_cc_cme(cc)->def->original_id, vm_ci_mid(ci), vm_cc_cme(cc)->owner, Qundef);
+ ret = rb_ivar_set(calling->recv, vm_cc_cme(cc)->def->body.attr.id, argv[0]);
+ EXEC_EVENT_HOOK(ec, RUBY_EVENT_C_RETURN, calling->recv,
+ vm_cc_cme(cc)->def->original_id, vm_ci_mid(ci), vm_cc_cme(cc)->owner, ret);
+ }
+ else {
+ ret = rb_ivar_set(calling->recv, vm_cc_cme(cc)->def->body.attr.id, argv[0]);
+ }
goto success;
case VM_METHOD_TYPE_IVAR:
if (calling->kw_splat &&
@@ -201,7 +210,16 @@ vm_call0_body(rb_execution_context_t *ec, struct rb_calling_info *calling, const
}
rb_check_arity(calling->argc, 0, 0);
- ret = rb_attr_get(calling->recv, vm_cc_cme(cc)->def->body.attr.id);
+ if (UNLIKELY(ruby_vm_event_flags & (RUBY_EVENT_C_CALL | RUBY_EVENT_C_RETURN))) {
+ EXEC_EVENT_HOOK(ec, RUBY_EVENT_C_CALL, calling->recv,
+ vm_cc_cme(cc)->def->original_id, vm_ci_mid(ci), vm_cc_cme(cc)->owner, Qundef);
+ ret = rb_attr_get(calling->recv, vm_cc_cme(cc)->def->body.attr.id);
+ EXEC_EVENT_HOOK(ec, RUBY_EVENT_C_RETURN, calling->recv,
+ vm_cc_cme(cc)->def->original_id, vm_ci_mid(ci), vm_cc_cme(cc)->owner, ret);
+ }
+ else {
+ ret = rb_attr_get(calling->recv, vm_cc_cme(cc)->def->body.attr.id);
+ }
goto success;
case VM_METHOD_TYPE_BMETHOD:
ret = vm_call_bmethod_body(ec, calling, argv);