From 9036b4e1a403fdcb8e6f171ee3376d7879351e80 Mon Sep 17 00:00:00 2001 From: Kunshan Wang Date: Mon, 21 Oct 2024 14:57:56 +0800 Subject: [PATCH] Allow getting the generic_iv_tbl_ This will allow the Rust part of the binding to inspect the number of entries in the generic_iv_tbl_, useful when displaying statistics in the eBPF timeline. --- internal/mmtk.h | 1 + mmtk_support.c | 2 ++ variable.c | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/internal/mmtk.h b/internal/mmtk.h index 800766ce7f3abd..04cca9b3bc1b83 100644 --- a/internal/mmtk.h +++ b/internal/mmtk.h @@ -91,6 +91,7 @@ typedef struct MMTk_RubyUpcalls { void (*update_global_symbols_table)(void); void (*update_overloaded_cme_table)(void); void (*update_ci_table)(void); + struct st_table *(*get_generic_iv_tbl)(void); struct st_table *(*get_frozen_strings_table)(void); struct st_table *(*get_finalizer_table)(void); struct st_table *(*get_obj_to_id_table)(void); diff --git a/mmtk_support.c b/mmtk_support.c index c76fad1c77bb13..66ffe3cd3cfddc 100644 --- a/mmtk_support.c +++ b/mmtk_support.c @@ -1675,6 +1675,7 @@ void rb_mmtk_update_global_symbols_table(void); // Defined in gc.c void rb_mmtk_update_overloaded_cme_table(void); // Defined in default.c void rb_mmtk_update_ci_table(void); // Defined in default.c +st_table* rb_mmtk_get_generic_iv_tbl(void); // Defined in variable.c st_table* rb_mmtk_get_frozen_strings_table(void); // Defined in default.c st_table* rb_mmtk_get_finalizer_table(void); // Defined in default.c st_table* rb_mmtk_get_obj_to_id_table(void); // Defined in default.c @@ -1714,6 +1715,7 @@ MMTk_RubyUpcalls ruby_upcalls = { rb_mmtk_update_global_symbols_table, rb_mmtk_update_overloaded_cme_table, rb_mmtk_update_ci_table, + rb_mmtk_get_generic_iv_tbl, rb_mmtk_get_frozen_strings_table, rb_mmtk_get_finalizer_table, rb_mmtk_get_obj_to_id_table, diff --git a/variable.c b/variable.c index 545586eefc6892..3b42c2ff04b017 100644 --- a/variable.c +++ b/variable.c @@ -1172,6 +1172,11 @@ rb_ref_update_generic_ivar(VALUE obj) } #if USE_MMTK +st_table* +rb_mmtk_get_generic_iv_tbl(void) +{ + return generic_iv_tbl_; +} static int rb_mmtk_cleanup_generic_iv_tbl_check(st_data_t key, st_data_t value, st_data_t argp, int error)