aboutsummaryrefslogtreecommitdiffstats
path: root/internal.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-29 05:32:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-10-29 05:32:57 +0000
commit645116ff25e42b1cfb065ad98e13818c8c5c2a8d (patch)
tree47ed734b95ca72ec176b056b766a0561ef441723 /internal.h
parent1be5cb6371048a35d9fb2859ca8a865e982608cf (diff)
downloadruby-645116ff25e42b1cfb065ad98e13818c8c5c2a8d.tar.gz
RUBY_DTRACE_CREATE_HOOK
* internal.h (RUBY_DTRACE_CREATE_HOOK): macro to call hook at object creation. * vm.c (rb_source_location, rb_source_loc): retrieve source path and line number at once. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r--internal.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal.h b/internal.h
index 290bdb1cc4..a21f1512e0 100644
--- a/internal.h
+++ b/internal.h
@@ -1183,6 +1183,8 @@ void rb_vm_inc_const_missing_count(void);
void rb_thread_mark(void *th);
const void **rb_vm_get_insns_address_table(void);
VALUE rb_sourcefilename(void);
+VALUE rb_source_location(int *pline);
+const char *rb_source_loc(int *pline);
void rb_vm_pop_cfunc_frame(void);
int rb_vm_add_root_module(ID id, VALUE module);
void rb_vm_check_redefinition_by_prepend(VALUE klass);
@@ -1326,6 +1328,16 @@ VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
RUBY_SYMBOL_EXPORT_END
+#define RUBY_DTRACE_CREATE_HOOK(name, arg) \
+do { \
+ if (UNLIKELY(RUBY_DTRACE_##name##_CREATE_ENABLED())) { \
+ int dtrace_line; \
+ const char *dtrace_file = rb_source_loc(&dtrace_line); \
+ if (!dtrace_file) dtrace_file = ""; \
+ RUBY_DTRACE_##name##_CREATE(arg, dtrace_file, dtrace_line); \
+ } \
+} while (0)
+
#if defined(__cplusplus)
#if 0
{ /* satisfy cc-mode */