Ruby: probes_helper.h Source File

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

probes_helper.h
1#ifndef RUBY_PROBES_HELPER_H
2#define RUBY_PROBES_HELPER_H
3
4#include "ruby/ruby.h"
5
6 struct ruby_dtrace_method_hook_args {
7 const char *classname;
8 const char *methodname;
9 const char *filename;
10 int line_no;
11 volatile VALUE klass;
12 volatile VALUE name;
13};
14
15MJIT_SYMBOL_EXPORT_BEGIN
16NOINLINE(int rb_dtrace_setup(rb_execution_context_t *, VALUE, ID, struct ruby_dtrace_method_hook_args *));
17MJIT_SYMBOL_EXPORT_END
18
19#define RUBY_DTRACE_METHOD_HOOK(name, ec, klazz, id) \
20do { \
21 if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
22 struct ruby_dtrace_method_hook_args args; \
23 if (rb_dtrace_setup(ec, klazz, id, &args)) { \
24 RUBY_DTRACE_##name(args.classname, \
25 args.methodname, \
26 args.filename, \
27 args.line_no); \
28 } \
29 } \
30} while (0)
31
32#define RUBY_DTRACE_METHOD_ENTRY_HOOK(ec, klass, id) \
33 RUBY_DTRACE_METHOD_HOOK(METHOD_ENTRY, ec, klass, id)
34
35#define RUBY_DTRACE_METHOD_RETURN_HOOK(ec, klass, id) \
36 RUBY_DTRACE_METHOD_HOOK(METHOD_RETURN, ec, klass, id)
37
38#define RUBY_DTRACE_CMETHOD_ENTRY_HOOK(ec, klass, id) \
39 RUBY_DTRACE_METHOD_HOOK(CMETHOD_ENTRY, ec, klass, id)
40
41#define RUBY_DTRACE_CMETHOD_RETURN_HOOK(ec, klass, id) \
42 RUBY_DTRACE_METHOD_HOOK(CMETHOD_RETURN, ec, klass, id)
43
44#endif /* RUBY_PROBES_HELPER_H */
ruby.h
rb_execution_context_struct
Definition vm_core.h:899
ruby_dtrace_method_hook_args
Definition probes_helper.h:6
ID
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40