Project

General

Profile

Actions

Feature #11146

closed

[PATCH] variable.c: initialize generic_iv_tbl at start

Added by normalperson (Eric Wong) almost 9 years ago. Updated almost 9 years ago.

Status:
Closed
Target version:
-
[ruby-core:69155]

Description

Even miniruby creates one generic ivar (plain "ruby" creates 9),
so there's no point in lazily allocating the table and increasing
lines of code.

I'll commit in a few days unless there's objections.

I dumped generic ivar counts with the following trivial patch:

--- a/variable.c
+++ b/variable.c
@@ -24,6 +24,10 @@ static void check_before_mod_set(VALUE, ID, VALUE, const char *);
 static void setup_const_entry(rb_const_entry_t *, VALUE, VALUE, rb_const_flag_t);
 static int const_update(st_data_t *, st_data_t *, st_data_t, int);
 static st_table *generic_iv_tbl;
+__attribute__((destructor)) static void count_genivar(void)
+{
+    fprintf(stderr, "genivars: %zu\n", (size_t)generic_iv_tbl->num_entries);
+}

 void
 Init_var_tables(void)

Files

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0