mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Use ID instead of GENTRY for gvars. (#3278)
Use ID instead of GENTRY for gvars. Global variables are compiled into GENTRY (a pointer to struct rb_global_entry). This patch replace this GENTRY to ID and make the code simple. We need to search GENTRY from ID every time (st_lookup), so additional overhead will be introduced. However, the performance of accessing global variables is not important now a day and this simplicity helps Ractor development.
This commit is contained in:
parent
8655c2e690
commit
a0f12a0258
Notes:
git
2020-07-03 16:57:07 +09:00
Merged-By: ko1 <ko1@atdot.net>
10 changed files with 68 additions and 178 deletions
|
@ -19,13 +19,6 @@
|
|||
|
||||
#define ROBJECT_TRANSIENT_FLAG FL_USER13
|
||||
|
||||
struct rb_global_variable; /* defined in variable.c */
|
||||
|
||||
struct rb_global_entry {
|
||||
struct rb_global_variable *var;
|
||||
ID id;
|
||||
};
|
||||
|
||||
/* variable.c */
|
||||
void rb_gc_mark_global_tbl(void);
|
||||
void rb_gc_update_global_tbl(void);
|
||||
|
@ -36,9 +29,8 @@ VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
|
|||
void rb_autoload_str(VALUE mod, ID id, VALUE file);
|
||||
VALUE rb_autoload_at_p(VALUE, ID, int);
|
||||
NORETURN(VALUE rb_mod_const_missing(VALUE,VALUE));
|
||||
rb_gvar_getter_t *rb_gvar_getter_function_of(const struct rb_global_entry *);
|
||||
rb_gvar_setter_t *rb_gvar_setter_function_of(const struct rb_global_entry *);
|
||||
bool rb_gvar_is_traced(const struct rb_global_entry *);
|
||||
rb_gvar_getter_t *rb_gvar_getter_function_of(ID);
|
||||
rb_gvar_setter_t *rb_gvar_setter_function_of(ID);
|
||||
void rb_gvar_readonly_setter(VALUE v, ID id, VALUE *_);
|
||||
static inline bool ROBJ_TRANSIENT_P(VALUE obj);
|
||||
static inline void ROBJ_TRANSIENT_SET(VALUE obj);
|
||||
|
@ -55,11 +47,9 @@ void rb_deprecate_constant(VALUE mod, const char *name);
|
|||
RUBY_SYMBOL_EXPORT_END
|
||||
|
||||
MJIT_SYMBOL_EXPORT_BEGIN
|
||||
struct rb_global_entry *rb_global_entry(ID);
|
||||
VALUE rb_gvar_get(struct rb_global_entry *);
|
||||
VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
|
||||
VALUE rb_gvar_defined(struct rb_global_entry *);
|
||||
struct st_table *rb_ivar_generic_ivtbl(void);
|
||||
VALUE rb_gvar_get(ID);
|
||||
VALUE rb_gvar_set(ID, VALUE);
|
||||
VALUE rb_gvar_defined(ID);
|
||||
void rb_const_warn_if_deprecated(const rb_const_entry_t *, VALUE, ID);
|
||||
MJIT_SYMBOL_EXPORT_END
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue