Skip to content

Commit

Permalink
Allow getting the generic_iv_tbl_
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wks committed Oct 21, 2024
1 parent 0013d31 commit 9036b4e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/mmtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions mmtk_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9036b4e

Please sign in to comment.