summaryrefslogtreecommitdiff
path: root/yjit_iface.h
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2021-08-24 12:32:07 +0200
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:39 -0400
commit0dc3bba6f2b2b1b23e1ec9dd2ec29f932c292db0 (patch)
treec9db52ed439e6cf7fc3f48622718ce418f3b3849 /yjit_iface.h
parent2ba090a1f9258035b40374f9ff9da3ff920701cd (diff)
Allow to compile with --yjit-stats support but not the full RUBY_DEBUG
RUBY_DEBUG have a very significant performance overhead. Enough that YJIT with RUBY_DEBUG is noticeably slower than the interpreter without RUBY_DEBUG. This makes it hard to collect yjit-stats in production environments. By allowing to collect JIT statistics without the RUBy_DEBUG overhead, I hope to make such use cases smoother.
Diffstat (limited to 'yjit_iface.h')
-rw-r--r--yjit_iface.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/yjit_iface.h b/yjit_iface.h
index 4b3da00b76..6f7aa69cea 100644
--- a/yjit_iface.h
+++ b/yjit_iface.h
@@ -16,6 +16,23 @@
#endif
#if RUBY_DEBUG
+# define YJIT_STATS 1
+struct yjit_comment {
+ uint32_t offset;
+ const char *comment;
+};
+
+typedef rb_darray(struct yjit_comment) yjit_comment_array_t;
+
+extern yjit_comment_array_t yjit_code_comments;
+#else
+# ifndef YJIT_STATS
+# define YJIT_STATS 0
+# endif // ifndef YJIT_STATS
+#endif // if RUBY_DEBUG
+
+
+#if YJIT_STATS
#define YJIT_DECLARE_COUNTERS(...) struct rb_yjit_runtime_counters { \
int64_t __VA_ARGS__; \
@@ -81,16 +98,7 @@ YJIT_DECLARE_COUNTERS(
#undef YJIT_DECLARE_COUNTERS
-struct yjit_comment {
- uint32_t offset;
- const char *comment;
-};
-
-typedef rb_darray(struct yjit_comment) yjit_comment_array_t;
-
-extern yjit_comment_array_t yjit_code_comments;
-
-#endif // if RUBY_DEBUG
+#endif // YJIT_STATS
RUBY_EXTERN struct rb_yjit_options rb_yjit_opts;
RUBY_EXTERN struct rb_yjit_runtime_counters yjit_runtime_counters;