summaryrefslogtreecommitdiff
path: root/yjit.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-11-17 12:59:59 -0800
committerGitHub <noreply@github.com>2022-11-17 12:59:59 -0800
commitc80edc9f98f58826d6c6d4b5ee11a2886bbfb006 (patch)
tree9ecd1f170899f3fdacbd5c1dac3d29bf39023b3d /yjit.c
parent4b29eb17f2b01442198c81c5f62fcd3045aab659 (diff)
downloadruby-c80edc9f98f58826d6c6d4b5ee11a2886bbfb006.tar.gz
YJIT: Add object shape count to stats (#6754)
Diffstat (limited to 'yjit.c')
-rw-r--r--yjit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/yjit.c b/yjit.c
index aa49b3cfdc..db0a5f5978 100644
--- a/yjit.c
+++ b/yjit.c
@@ -1071,6 +1071,14 @@ rb_yjit_invalidate_all_method_lookup_assumptions(void)
// method caches, so we do nothing here for now.
}
+// Number of object shapes, which might be useful for investigating YJIT exit reasons.
+static VALUE
+object_shape_count(rb_execution_context_t *ec, VALUE self)
+{
+ // next_shape_id starts from 0, so it's the same as the count
+ return ULONG2NUM((unsigned long)GET_VM()->next_shape_id);
+}
+
// Primitives used by yjit.rb
VALUE rb_yjit_stats_enabled_p(rb_execution_context_t *ec, VALUE self);
VALUE rb_yjit_trace_exit_locations_enabled_p(rb_execution_context_t *ec, VALUE self);