Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Data Structures | Macros | Typedefs | Functions
variable.c File Reference
`#include "ruby/encoding.h"`
`#include "ruby/st.h"`
`#include "ruby/util.h"`
`#include "internal.h"`
`#include "id_table.h"`
`#include "constant.h"`
`#include "id.h"`
`#include "ccan/list/list.h"`
`#include "debug_counter.h"`
`#include "vm_core.h"`
`#include "transient_heap.h"`
`#include "variable.h"`

Go to the source code of this file.

## Data Structures
struct | ivar_update
struct | trace_var
struct | rb_global_variable
struct | trace_data
struct | obj_ivar_tag
struct | gen_ivar_tag
struct | givar_copy
struct | autoload_const
struct | autoload_state
struct | autoload_data_i

## Macros
#define | rb_is_constant_id rb_is_const_id
#define | rb_is_constant_name rb_is_const_name
#define | id_for_var(obj, name, part, type) id_for_var_message(obj, name, type, "`%1$s' is not allowed as "#part" "#type" variable name")
#define | id_for_var_message(obj, name, type, message) check_id_type(obj, &(name), rb_is_##type##_id, rb_is_##type##_name, message, strlen(message))
#define | check_autoload_table(av) (struct st_table *)rb_check_typeddata((av), &autoload_data_type)
#define | CVAR_FOREACH_ANCESTORS(klass, v, r)
#define | CVAR_LOOKUP(v, r)

## Typedefs
typedef VALUE(* | fallback_func) (VALUE obj, VALUE name)
typedef int | rb_ivar_foreach_callback_func(ID key, VALUE val, st_data_t arg)

## Functions
void | Init_var_tables (void)
VALUE | rb_mod_name (VALUE mod)
VALUE | rb_class_path (VALUE klass)
VALUE | rb_class_path_cached (VALUE klass)
VALUE | rb_search_class_path (VALUE klass)
void | rb_set_class_path_string (VALUE klass, VALUE under, VALUE name)
void | rb_set_class_path (VALUE klass, VALUE under, const char *name)
VALUE | rb_path_to_class (VALUE pathname)
VALUE | rb_path2class (const char *path)
VALUE | rb_class_name (VALUE klass)
const char * | rb_class2name (VALUE klass)
const char * | rb_obj_classname (VALUE obj)
MJIT_FUNC_EXPORTED struct rb_global_entry * | rb_global_entry (ID id)
VALUE | rb_gvar_undef_getter (ID id, VALUE *_)
void | rb_gvar_undef_setter (VALUE val, ID id, VALUE *_)
void | rb_gvar_undef_marker (VALUE *var)
VALUE | rb_gvar_val_getter (ID id, VALUE *data)
void | rb_gvar_val_setter (VALUE val, ID id, VALUE *_)
void | rb_gvar_val_marker (VALUE *var)
VALUE | rb_gvar_var_getter (ID id, VALUE *var)
void | rb_gvar_var_setter (VALUE val, ID id, VALUE *data)
void | rb_gvar_var_marker (VALUE *var)
void | rb_gvar_readonly_setter (VALUE v, ID id, VALUE *_)
void | rb_gc_mark_global_tbl (void)
void | rb_define_hooked_variable (const char *name, VALUE *var, rb_gvar_getter_t *getter, rb_gvar_setter_t *setter)
void | rb_define_variable (const char *name, VALUE *var)
void | rb_define_readonly_variable (const char *name, const VALUE *var)
void | rb_define_virtual_variable (const char *name, rb_gvar_getter_t *getter, rb_gvar_setter_t *setter)
VALUE | rb_f_trace_var (int argc, const VALUE *argv)
VALUE | rb_f_untrace_var (int argc, const VALUE *argv)
MJIT_FUNC_EXPORTED VALUE | rb_gvar_get (struct rb_global_entry *entry)
MJIT_FUNC_EXPORTED VALUE | rb_gvar_set (struct rb_global_entry *entry, VALUE val)
VALUE | rb_gv_set (const char *name, VALUE val)
VALUE | rb_gv_get (const char *name)
MJIT_FUNC_EXPORTED VALUE | rb_gvar_defined (struct rb_global_entry *entry)
rb_gvar_getter_t * | rb_gvar_getter_function_of (const struct rb_global_entry *entry)
rb_gvar_setter_t * | rb_gvar_setter_function_of (const struct rb_global_entry *entry)
bool | rb_gvar_is_traced (const struct rb_global_entry *entry)
VALUE | rb_f_global_variables (void)
void | rb_alias_variable (ID name1, ID name2)
MJIT_FUNC_EXPORTED struct st_table * | rb_ivar_generic_ivtbl (void)
void | rb_mark_generic_ivar (VALUE obj)
void | rb_mv_generic_ivar (VALUE rsrc, VALUE dst)
void | rb_free_generic_ivar (VALUE obj)
RUBY_FUNC_EXPORTED size_t | rb_generic_ivar_memsize (VALUE obj)
VALUE | rb_ivar_lookup (VALUE obj, ID id, VALUE undef)
VALUE | rb_ivar_get (VALUE obj, ID id)
VALUE | rb_attr_get (VALUE obj, ID id)
VALUE | rb_attr_delete (VALUE obj, ID id)
void | rb_obj_transient_heap_evacuate (VALUE obj, int promote)
VALUE | rb_ivar_set (VALUE obj, ID id, VALUE val)
void | rb_ivar_set_internal (VALUE obj, ID id, VALUE val)
VALUE | rb_ivar_defined (VALUE obj, ID id)
void | rb_copy_generic_ivar (VALUE clone, VALUE obj)
void | rb_ivar_foreach (VALUE obj, rb_ivar_foreach_callback_func *func, st_data_t arg)
st_index_t | rb_ivar_count (VALUE obj)
VALUE | rb_obj_instance_variables (VALUE obj)
VALUE | rb_obj_remove_instance_variable (VALUE obj, VALUE name)
| NORETURN (static void uninitialized_constant(VALUE, VALUE))
VALUE | rb_const_missing (VALUE klass, VALUE name)
VALUE | rb_mod_const_missing (VALUE klass, VALUE name)
RUBY_FUNC_EXPORTED void | rb_autoload (VALUE mod, ID id, const char *file)
void | rb_autoload_str (VALUE mod, ID id, VALUE file)
MJIT_FUNC_EXPORTED int | rb_autoloading_value (VALUE mod, ID id, VALUE *value, rb_const_flag_t *flag)
VALUE | rb_autoload_load (VALUE mod, ID id)
VALUE | rb_autoload_p (VALUE mod, ID id)
VALUE | rb_autoload_at_p (VALUE mod, ID id, int recur)
MJIT_FUNC_EXPORTED void | rb_const_warn_if_deprecated (const rb_const_entry_t *ce, VALUE klass, ID id)
VALUE | rb_const_get_from (VALUE klass, ID id)
VALUE | rb_const_get (VALUE klass, ID id)
VALUE | rb_const_get_at (VALUE klass, ID id)
MJIT_FUNC_EXPORTED VALUE | rb_public_const_get_from (VALUE klass, ID id)
MJIT_FUNC_EXPORTED VALUE | rb_public_const_get_at (VALUE klass, ID id)
| NORETURN (static void undefined_constant(VALUE mod, VALUE name))
VALUE | rb_const_source_location (VALUE klass, ID id)
MJIT_FUNC_EXPORTED VALUE | rb_const_source_location_at (VALUE klass, ID id)
VALUE | rb_mod_remove_const (VALUE mod, VALUE name)
VALUE | rb_const_remove (VALUE mod, ID id)
void * | rb_mod_const_at (VALUE mod, void *data)
void * | rb_mod_const_of (VALUE mod, void *data)
VALUE | rb_const_list (void *data)
VALUE | rb_mod_constants (int argc, const VALUE *argv, VALUE mod)
int | rb_const_defined_from (VALUE klass, ID id)
int | rb_const_defined (VALUE klass, ID id)
int | rb_const_defined_at (VALUE klass, ID id)
MJIT_FUNC_EXPORTED int | rb_public_const_defined_from (VALUE klass, ID id)
void | rb_const_set (VALUE klass, ID id, VALUE val)
void | rb_define_const (VALUE klass, const char *name, VALUE val)
void | rb_define_global_const (const char *name, VALUE val)
void | rb_deprecate_constant (VALUE mod, const char *name)
VALUE | rb_mod_private_constant (int argc, const VALUE *argv, VALUE obj)
VALUE | rb_mod_public_constant (int argc, const VALUE *argv, VALUE obj)
VALUE | rb_mod_deprecate_constant (int argc, const VALUE *argv, VALUE obj)
void | rb_cvar_set (VALUE klass, ID id, VALUE val)
VALUE | rb_cvar_get (VALUE klass, ID id)
VALUE | rb_cvar_defined (VALUE klass, ID id)
void | rb_cv_set (VALUE klass, const char *name, VALUE val)
VALUE | rb_cv_get (VALUE klass, const char *name)
void | rb_define_class_variable (VALUE klass, const char *name, VALUE val)
VALUE | rb_mod_class_variables (int argc, const VALUE *argv, VALUE mod)
VALUE | rb_mod_remove_cvar (VALUE mod, VALUE name)
VALUE | rb_iv_get (VALUE obj, const char *name)
VALUE | rb_iv_set (VALUE obj, const char *name, VALUE val)
int | rb_class_ivar_set (VALUE obj, ID key, VALUE value)
void | rb_iv_tbl_copy (VALUE dst, VALUE src)
MJIT_FUNC_EXPORTED rb_const_entry_t * | rb_const_lookup (VALUE klass, ID id)

## Macro Definition Documentation

## ◆ check_autoload_table

#define check_autoload_table | ( |  | av | ) | (struct st_table *)rb_check_typeddata((av), &autoload_data_type)

Definition at line 1783 of file variable.c.

## ◆ CVAR_FOREACH_ANCESTORS

#define CVAR_FOREACH_ANCESTORS | ( |  | klass,
|  |  | v,
|  |  | r
| ) |  |

Value:
for (klass = cvar_front_klass(klass); klass; klass = RCLASS_SUPER(klass)) { \
if (cvar_lookup_at(klass, id, (v))) { \
r; \
} \
}

Definition at line 3061 of file variable.c.

## ◆ CVAR_LOOKUP

#define CVAR_LOOKUP | ( |  | v,
|  |  | r
| ) |  |

Value:
do {\
if (cvar_lookup_at(klass, id, (v))) {r;}\
CVAR_FOREACH_ANCESTORS(klass, v, r);\
} while(0)

Definition at line 3068 of file variable.c.

## ◆ id_for_var

#define id_for_var | ( |  | obj,
|  |  | name,
|  |  | part,
|  |  | type
| ) |  | id_for_var_message(obj, name, type, "`%1$s' is not allowed as "#part" "#type" variable name")

Definition at line 1590 of file variable.c.

## ◆ id_for_var_message

#define id_for_var_message | ( |  | obj,
|  |  | name,
|  |  | type,
|  |  | message
| ) |  | check_id_type(obj, &(name), rb_is_##type##_id, rb_is_##type##_name, message, strlen(message))

Definition at line 1592 of file variable.c.

## ◆ rb_is_constant_id

#define rb_is_constant_id rb_is_const_id

Definition at line 1588 of file variable.c.

## ◆ rb_is_constant_name

#define rb_is_constant_name rb_is_const_name

Definition at line 1589 of file variable.c.

## Typedef Documentation

## ◆ fallback_func

typedef VALUE(* fallback_func) (VALUE obj, VALUE name)

Definition at line 127 of file variable.c.

## ◆ rb_ivar_foreach_callback_func

typedef int rb_ivar_foreach_callback_func(ID key, VALUE val, st_data_t arg)

Definition at line 1347 of file variable.c.

## Function Documentation

## ◆ Init_var_tables()

void Init_var_tables | ( | void |  | ) |

Definition at line 48 of file variable.c.

## ◆ NORETURN() [1/2]

NORETURN | ( | static void | undefined_constantVALUE mod, VALUE name | ) |

## ◆ NORETURN() [2/2]

NORETURN | ( | static void | uninitialized_constantVALUE, VALUE | ) |

## ◆ rb_alias_variable()

void rb_alias_variable | ( | ID | name1,
|  | ID | name2
| ) |  |

Definition at line 756 of file variable.c.

References rb_global_entry(), and rb_id_table_lookup().

## ◆ rb_attr_delete()

VALUE rb_attr_delete | ( | VALUE | obj,
|  | ID | id
| ) |  |

Definition at line 1126 of file variable.c.

## ◆ rb_attr_get()

VALUE rb_attr_get | ( | VALUE | obj,
|  | ID | id
| ) |  |

Definition at line 1084 of file variable.c.

References obj, Qnil, and rb_ivar_lookup().

Referenced by rb_dtrace_setup(), and rb_singleton_class_internal_p().

## ◆ rb_autoload()

RUBY_FUNC_EXPORTED void rb_autoload | ( | VALUE | mod,
|  | ID | id,
|  | const char * | file
| ) |  |

Definition at line 1924 of file variable.c.

References mod, rb_autoload_str(), rb_eArgError, rb_fstring_cstr, and rb_raise().

## ◆ rb_autoload_at_p()

VALUE rb_autoload_at_p | ( | VALUE | mod,
|  | ID | id,
|  | int | recur
| ) |  |

Definition at line 2287 of file variable.c.

Referenced by rb_autoload_p().

## ◆ rb_autoload_load()

VALUE rb_autoload_load | ( | VALUE | mod,
|  | ID | id
| ) |  |

Definition at line 2222 of file variable.c.

## ◆ rb_autoload_p()

VALUE rb_autoload_p | ( | VALUE | mod,
|  | ID | id
| ) |  |

Definition at line 2281 of file variable.c.

References mod, rb_autoload_at_p(), and TRUE.

## ◆ rb_autoload_str()

void rb_autoload_str | ( | VALUE | mod,
|  | ID | id,
|  | VALUE | file
| ) |  |

Definition at line 1933 of file variable.c.

References Check_Type, mod, PRIsVALUE, Qundef, QUOTE_ID, rb_const_lookup(), rb_const_set(), rb_eArgError, rb_eNameError, rb_is_const_id(), rb_raise(), RCLASS_IV_TBL, RSTRING_LEN, st_lookup(), T_STRING, and rb_const_entry_struct::value.

Referenced by rb_autoload().

## ◆ rb_autoloading_value()

MJIT_FUNC_EXPORTED int rb_autoloading_value | ( | VALUE | mod,
|  | ID | id,
|  | VALUE * | value,
|  | rb_const_flag_t * | flag
| ) |  |

Definition at line 2074 of file variable.c.

## ◆ rb_class_ivar_set()

int rb_class_ivar_set | ( | VALUE | obj,
|  | ID | key,
|  | VALUE | value
| ) |  |

Definition at line 3316 of file variable.c.

References obj, and RCLASS_IV_TBL.

Referenced by rb_singleton_class_attached().

## ◆ rb_class_name()

VALUE rb_class_name | ( | VALUE | klass | ) |

Definition at line 274 of file variable.c.

References klass, rb_class_path(), and rb_class_real().

Referenced by rb_any_to_s(), and rb_const_warn_if_deprecated().

## ◆ rb_class_path()

VALUE rb_class_path | ( | VALUE | klass | ) |

Definition at line 153 of file variable.c.

References path.

Referenced by rb_class_name(), rb_define_class_id_under(), and rb_dtrace_setup().

## ◆ rb_class_path_cached()

VALUE rb_class_path_cached | ( | VALUE | klass | ) |

Definition at line 162 of file variable.c.

## ◆ rb_const_defined()

int rb_const_defined | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2682 of file variable.c.

Referenced by Init_cparse(), rb_define_class(), and rb_define_module().

## ◆ rb_const_defined_at()

int rb_const_defined_at | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2688 of file variable.c.

Referenced by rb_const_remove(), rb_define_class_id_under(), and rb_define_module_id_under().

## ◆ rb_const_defined_from()

int rb_const_defined_from | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2676 of file variable.c.

## ◆ rb_const_get()

VALUE rb_const_get | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2387 of file variable.c.

Referenced by generic_to_value(), Init_cparse(), Init_objspace(), rb_define_class(), and rb_define_module().

## ◆ rb_const_get_at()

VALUE rb_const_get_at | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2393 of file variable.c.

Referenced by Init_cparse(), rb_define_class_id_under(), and rb_define_module_id_under().

## ◆ rb_const_get_from()

VALUE rb_const_get_from | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2381 of file variable.c.

## ◆ rb_const_list()

VALUE rb_const_list | ( | void * | data | ) |

Definition at line 2594 of file variable.c.

References st_table::num_entries, rb_ary_new2, and st_foreach_safe().

Referenced by rb_mod_constants().

## ◆ rb_const_lookup()

MJIT_FUNC_EXPORTED rb_const_entry_t* rb_const_lookup | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 3341 of file variable.c.

References klass, rb_id_table_lookup(), and RCLASS_CONST_TBL.

Referenced by rb_autoload_str(), and rb_const_remove().

## ◆ rb_const_missing()

VALUE rb_const_missing | ( | VALUE | klass,
|  | VALUE | name
| ) |  |

Definition at line 1694 of file variable.c.

References idConst_missing, klass, name, rb_funcallv, and rb_vm_inc_const_missing_count().

## ◆ rb_const_remove()

VALUE rb_const_remove | ( | VALUE | mod,
|  | ID | id
| ) |  |

Definition at line 2490 of file variable.c.

References ID2SYM, mod, rb_check_frozen, rb_const_defined_at(), rb_const_lookup(), rb_id_table_delete(), rb_name_err_raise, and RCLASS_CONST_TBL.

## ◆ rb_const_set()

void rb_const_set | ( | VALUE | klass,
|  | ID | id,
|  | VALUE | val
| ) |  |

Definition at line 2752 of file variable.c.

References klass, NIL_P, PRIsVALUE, QUOTE_ID, rb_eTypeError, rb_raise(), and RCLASS_CONST_TBL.

Referenced by rb_autoload_str(), rb_define_class(), rb_define_class_id_under(), rb_define_const(), rb_define_module(), and rb_define_module_id_under().

## ◆ rb_const_source_location()

VALUE rb_const_source_location | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2457 of file variable.c.

## ◆ rb_const_source_location_at()

MJIT_FUNC_EXPORTED VALUE rb_const_source_location_at | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2463 of file variable.c.

## ◆ rb_const_warn_if_deprecated()

MJIT_FUNC_EXPORTED void rb_const_warn_if_deprecated | ( | const rb_const_entry_t * | ce,
|  | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2303 of file variable.c.

References klass, PRIsVALUE, QUOTE_ID, rb_class_name(), rb_cObject, RB_CONST_DEPRECATED_P, rb_warn(), RB_WARN_CATEGORY_DEPRECATED, and rb_warning_category_enabled_p().

## ◆ rb_copy_generic_ivar()

void rb_copy_generic_ivar | ( | VALUE | clone,
|  | VALUE | obj
| ) |  |

Definition at line 1447 of file variable.c.

References FL_EXIVAR, FL_TEST, FL_UNSET, obj, rb_check_frozen, and rb_free_generic_ivar().

## ◆ rb_cv_get()

VALUE rb_cv_get | ( | VALUE | klass,
|  | const char * | name
| ) |  |

Definition at line 3138 of file variable.c.

## ◆ rb_cv_set()

void rb_cv_set | ( | VALUE | klass,
|  | const char * | name,
|  | VALUE | val
| ) |  |

Definition at line 3131 of file variable.c.

## ◆ rb_cvar_defined()

VALUE rb_cvar_defined | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 3112 of file variable.c.

References CVAR_LOOKUP, klass, Qfalse, and Qtrue.

Referenced by rb_mod_remove_cvar().

## ◆ rb_cvar_get()

VALUE rb_cvar_get | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 3096 of file variable.c.

References CVAR_LOOKUP, ID2SYM, klass, and rb_name_err_raise.

## ◆ rb_cvar_set()

void rb_cvar_set | ( | VALUE | klass,
|  | ID | id,
|  | VALUE | val
| ) |  |

Definition at line 3074 of file variable.c.

References CVAR_LOOKUP, and klass.

## ◆ rb_define_class_variable()

void rb_define_class_variable | ( | VALUE | klass,
|  | const char * | name,
|  | VALUE | val
| ) |  |

Definition at line 3145 of file variable.c.

## ◆ rb_define_hooked_variable()

void rb_define_hooked_variable | ( | const char * | name,
|  | VALUE * | var,
|  | rb_gvar_getter_t * | getter,
|  | rb_gvar_setter_t * | setter
| ) |  |

Definition at line 480 of file variable.c.

References Qnil.

Referenced by rb_define_readonly_variable(), rb_define_variable(), and rb_define_virtual_variable().

## ◆ rb_define_virtual_variable()

void rb_define_virtual_variable | ( | const char * | name,
|  | rb_gvar_getter_t * | getter,
|  | rb_gvar_setter_t * | setter
| ) |  |

Definition at line 511 of file variable.c.

References rb_global_variable::getter, name, rb_define_hooked_variable(), rb_gvar_readonly_setter(), rb_gvar_val_getter(), and rb_global_variable::setter.

## ◆ rb_deprecate_constant()

void rb_deprecate_constant | ( | VALUE | mod,
|  | const char * | name
| ) |  |

Definition at line 2947 of file variable.c.

References id, len, mod, name, NULL, rb_check_id_cstr(), rb_class_modify_check(), and strlen().

Referenced by Init_Bignum().

## ◆ rb_f_global_variables()

VALUE rb_f_global_variables | ( | void |  | ) |

Definition at line 728 of file variable.c.

References rb_ary_new(), rb_backref_get(), rb_id_table_foreach(), and sym.

## ◆ rb_f_trace_var()

VALUE rb_f_trace_var | ( | int | argc,
|  | const VALUE * | argv
| ) |  |

Definition at line 528 of file variable.c.

References ALLOC, argc, argv, trace_var::func, trace_var::next, NIL_P, rb_block_proc(), rb_f_untrace_var(), rb_global_entry(), rb_scan_args, rb_to_id(), rb_global_variable::trace, and rb_global_entry::var.

## ◆ rb_f_untrace_var()

VALUE rb_f_untrace_var | ( | int | argc,
|  | const VALUE * | argv
| ) |  |

Definition at line 574 of file variable.c.

References argc, argv, trace_var::data, id, PRIsVALUE, QUOTE, rb_check_id(), rb_id_table_lookup(), rb_name_error_str(), and rb_scan_args.

Referenced by rb_f_trace_var().

## ◆ rb_free_generic_ivar()

void rb_free_generic_ivar | ( | VALUE | obj | ) |

Definition at line 993 of file variable.c.

References key, obj, st_data_t, and st_delete().

Referenced by rb_copy_generic_ivar().

## ◆ rb_gc_mark_global_tbl()

void rb_gc_mark_global_tbl | ( | void |  | ) |

Definition at line 434 of file variable.c.

## ◆ rb_generic_ivar_memsize()

RUBY_FUNC_EXPORTED size_t rb_generic_ivar_memsize | ( | VALUE | obj | ) |

Definition at line 1010 of file variable.c.

## ◆ rb_global_entry()

MJIT_FUNC_EXPORTED struct rb_global_entry* rb_global_entry | ( | ID | id | ) |

Definition at line 326 of file variable.c.

Referenced by rb_alias_variable(), rb_f_trace_var(), rb_gv_set(), rb_gvar_undef_setter(), and rb_gvar_val_setter().

## ◆ rb_gvar_defined()

MJIT_FUNC_EXPORTED VALUE rb_gvar_defined | ( | struct rb_global_entry * | entry | ) |

Definition at line 695 of file variable.c.

References rb_global_variable::getter, Qfalse, Qtrue, rb_gvar_undef_getter(), and rb_global_entry::var.

## ◆ rb_gvar_get()

MJIT_FUNC_EXPORTED VALUE rb_gvar_get | ( | struct rb_global_entry * | entry | ) |

Definition at line 619 of file variable.c.

References rb_global_variable::data, rb_global_variable::getter, rb_global_entry::id, and rb_global_entry::var.

## ◆ rb_gvar_getter_function_of()

rb_gvar_getter_t* rb_gvar_getter_function_of | ( | const struct rb_global_entry * | entry | ) |

Definition at line 702 of file variable.c.

References rb_global_variable::getter, and rb_global_entry::var.

## ◆ rb_gvar_is_traced()

bool rb_gvar_is_traced | ( | const struct rb_global_entry * | entry | ) |

Definition at line 714 of file variable.c.

References rb_global_variable::trace, and rb_global_entry::var.

## ◆ rb_gvar_readonly_setter()

void rb_gvar_readonly_setter | ( | VALUE | v,
|  | ID | id,
|  | VALUE * | _
| ) |  |

Definition at line 412 of file variable.c.

References PRIsVALUE, QUOTE_ID, and rb_name_error().

Referenced by rb_define_readonly_variable(), and rb_define_virtual_variable().

## ◆ rb_gvar_set()

MJIT_FUNC_EXPORTED VALUE rb_gvar_set | ( | struct rb_global_entry * | entry,
|  | VALUE | val
| ) |  |

Definition at line 654 of file variable.c.

References rb_global_variable::block_trace, rb_global_variable::data, rb_global_entry::id, rb_ensure(), rb_global_variable::setter, rb_global_variable::trace, trace_data::trace, and rb_global_entry::var.

## ◆ rb_gvar_setter_function_of()

rb_gvar_setter_t* rb_gvar_setter_function_of | ( | const struct rb_global_entry * | entry | ) |

Definition at line 708 of file variable.c.

References rb_global_variable::setter, and rb_global_entry::var.

## ◆ rb_gvar_undef_getter()

VALUE rb_gvar_undef_getter | ( | ID | id,
|  | VALUE * | _
| ) |  |

Definition at line 349 of file variable.c.

References PRIsVALUE, Qnil, QUOTE_ID, and rb_warning().

Referenced by rb_gvar_defined().

## ◆ rb_gvar_undef_marker()

void rb_gvar_undef_marker | ( | VALUE * | var | ) |

Definition at line 368 of file variable.c.

## ◆ rb_gvar_undef_setter()

void rb_gvar_undef_setter | ( | VALUE | val,
|  | ID | id,
|  | VALUE * | _
| ) |  |

Definition at line 357 of file variable.c.

References rb_global_variable::data, rb_global_variable::getter, rb_global_variable::marker, rb_global_entry(), rb_gvar_val_getter(), rb_gvar_val_marker(), rb_gvar_val_setter(), rb_global_variable::setter, and rb_global_entry::var.

## ◆ rb_gvar_val_getter()

VALUE rb_gvar_val_getter | ( | ID | id,
|  | VALUE * | data
| ) |  |

Definition at line 373 of file variable.c.

References rb_global_variable::data.

Referenced by rb_define_virtual_variable(), and rb_gvar_undef_setter().

## ◆ rb_gvar_val_marker()

void rb_gvar_val_marker | ( | VALUE * | var | ) |

Definition at line 386 of file variable.c.

References rb_global_variable::data, and rb_gc_mark_maybe().

Referenced by rb_gvar_undef_setter().

## ◆ rb_gvar_val_setter()

void rb_gvar_val_setter | ( | VALUE | val,
|  | ID | id,
|  | VALUE * | _
| ) |  |

Definition at line 379 of file variable.c.

References rb_global_variable::data, rb_global_entry(), and rb_global_entry::var.

Referenced by rb_gvar_undef_setter().

## ◆ rb_gvar_var_getter()

VALUE rb_gvar_var_getter | ( | ID | id,
|  | VALUE * | var
| ) |  |

Definition at line 393 of file variable.c.

References Qnil.

## ◆ rb_gvar_var_marker()

void rb_gvar_var_marker | ( | VALUE * | var | ) |

Definition at line 406 of file variable.c.

References rb_gc_mark_maybe().

## ◆ rb_gvar_var_setter()

void rb_gvar_var_setter | ( | VALUE | val,
|  | ID | id,
|  | VALUE * | data
| ) |  |

Definition at line 400 of file variable.c.

References rb_global_variable::data.

## ◆ rb_iv_tbl_copy()

void rb_iv_tbl_copy | ( | VALUE | dst,
|  | VALUE | src
| ) |  |

Definition at line 3332 of file variable.c.

References RCLASS_IV_TBL, src, st_copy(), and st_foreach().

## ◆ rb_ivar_count()

st_index_t rb_ivar_count | ( | VALUE | obj | ) |

Definition at line 1511 of file variable.c.

References BUILTIN_TYPE, count, FL_EXIVAR, FL_TEST, i, st_table::num_entries, obj, Qundef, RCLASS_IV_TBL, ROBJECT_IV_INDEX_TBL, ROBJECT_IVPTR, ROBJECT_NUMIV, SPECIAL_CONST_P, T_CLASS, T_MODULE, and T_OBJECT.

## ◆ rb_ivar_defined()

VALUE rb_ivar_defined | ( | VALUE | obj,
|  | ID | id
| ) |  |

Definition at line 1317 of file variable.c.

References BUILTIN_TYPE, FL_EXIVAR, FL_TEST, index, obj, Qfalse, Qtrue, Qundef, RCLASS_IV_TBL, ROBJECT_IV_INDEX_TBL, ROBJECT_IVPTR, ROBJECT_NUMIV, SPECIAL_CONST_P, st_is_member, st_lookup(), T_CLASS, T_MODULE, and T_OBJECT.

## ◆ rb_ivar_foreach()

void rb_ivar_foreach | ( | VALUE | obj,
|  | rb_ivar_foreach_callback_func * | func,
|  | st_data_t | arg
| ) |  |

Definition at line 1489 of file variable.c.

References BUILTIN_TYPE, obj, SPECIAL_CONST_P, and T_OBJECT.

Referenced by rb_obj_instance_variables().

## ◆ rb_ivar_generic_ivtbl()

MJIT_FUNC_EXPORTED struct st_table* rb_ivar_generic_ivtbl | ( | void |  | ) |

Definition at line 803 of file variable.c.

## ◆ rb_ivar_get()

VALUE rb_ivar_get | ( | VALUE | obj,
|  | ID | id
| ) |  |

Definition at line 1070 of file variable.c.

References obj, PRIsVALUE, Qnil, Qundef, QUOTE_ID, RB_DEBUG_COUNTER_INC, rb_ivar_lookup(), rb_warning(), RTEST, and ruby_verbose.

Referenced by rb_class_modify_check(), rb_iv_get(), rb_method_name_error(), and rb_singleton_class_get().

## ◆ rb_ivar_lookup()

VALUE rb_ivar_lookup | ( | VALUE | obj,
|  | ID | id,
|  | VALUE | undef
| ) |  |

Definition at line 1035 of file variable.c.

References BUILTIN_TYPE, FL_EXIVAR, FL_TEST, index, len, obj, ptr, Qundef, RCLASS_IV_TBL, ROBJECT_IV_INDEX_TBL, ROBJECT_IVPTR, ROBJECT_NUMIV, SPECIAL_CONST_P, st_lookup(), T_CLASS, T_MODULE, and T_OBJECT.

Referenced by rb_attr_get(), and rb_ivar_get().

## ◆ rb_ivar_set()

VALUE rb_ivar_set | ( | VALUE | obj,
|  | ID | id,
|  | VALUE | val
| ) |  |

Definition at line 1300 of file variable.c.

References obj, and rb_check_frozen.

Referenced by rb_error_frozen_object(), rb_frozen_error_raise(), rb_iv_set(), and rb_key_err_new().

## ◆ rb_ivar_set_internal()

void rb_ivar_set_internal | ( | VALUE | obj,
|  | ID | id,
|  | VALUE | val
| ) |  |

Definition at line 1308 of file variable.c.

References rb_is_instance_id(), and VM_ASSERT.

## ◆ rb_mark_generic_ivar()

void rb_mark_generic_ivar | ( | VALUE | obj | ) |

Definition at line 973 of file variable.c.

## ◆ rb_mod_class_variables()

VALUE rb_mod_class_variables | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | mod
| ) |  |

Definition at line 3237 of file variable.c.

References argc, argv, rb_check_arity, and RTEST.

## ◆ rb_mod_const_at()

void* rb_mod_const_at | ( | VALUE | mod,
|  | void * | data
| ) |  |

Definition at line 2559 of file variable.c.

References mod, rb_id_table_foreach(), RCLASS_CONST_TBL, and st_init_numtable().

Referenced by rb_mod_const_of().

## ◆ rb_mod_const_missing()

VALUE rb_mod_const_missing | ( | VALUE | klass,
|  | VALUE | name
| ) |  |

Definition at line 1739 of file variable.c.

References GET_EC, name, rb_name_err_raise, and rb_vm_pop_cfunc_frame().

## ◆ rb_mod_const_of()

void* rb_mod_const_of | ( | VALUE | mod,
|  | void * | data
| ) |  |

Definition at line 2572 of file variable.c.

References mod, rb_cObject, rb_mod_const_at(), and RCLASS_SUPER.

Referenced by rb_mod_constants().

## ◆ rb_mod_constants()

VALUE rb_mod_constants | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | mod
| ) |  |

Definition at line 2626 of file variable.c.

References argc, argv, mod, rb_check_arity, rb_const_list(), rb_mod_const_of(), and RTEST.

## ◆ rb_mod_deprecate_constant()

VALUE rb_mod_deprecate_constant | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | obj
| ) |  |

Definition at line 3011 of file variable.c.

## ◆ rb_mod_name()

VALUE rb_mod_name | ( | VALUE | mod | ) |

Definition at line 102 of file variable.c.

## ◆ rb_mod_private_constant()

VALUE rb_mod_private_constant | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | obj
| ) |  |

Definition at line 2971 of file variable.c.

## ◆ rb_mod_public_constant()

VALUE rb_mod_public_constant | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | obj
| ) |  |

Definition at line 2985 of file variable.c.

## ◆ rb_mod_remove_const()

VALUE rb_mod_remove_const | ( | VALUE | mod,
|  | VALUE | name
| ) |  |

Definition at line 2479 of file variable.c.

References id_for_var, mod, and name.

## ◆ rb_mod_remove_cvar()

VALUE rb_mod_remove_cvar | ( | VALUE | mod,
|  | VALUE | name
| ) |  |

Definition at line 3273 of file variable.c.

References id, ID2SYM, id_for_var_message, mod, n, name, rb_check_frozen, rb_cvar_defined(), rb_name_err_raise, RCLASS_IV_TBL, and st_delete().

## ◆ rb_mv_generic_ivar()

void rb_mv_generic_ivar | ( | VALUE | rsrc,
|  | VALUE | dst
| ) |  |

Definition at line 983 of file variable.c.

References key, st_data_t, and st_delete().

## ◆ rb_obj_instance_variables()

VALUE rb_obj_instance_variables | ( | VALUE | obj | ) |

Definition at line 1579 of file variable.c.

References obj, rb_ary_new(), and rb_ivar_foreach().

## ◆ rb_obj_remove_instance_variable()

VALUE rb_obj_remove_instance_variable | ( | VALUE | obj,
|  | VALUE | name
| ) |  |

Definition at line 1634 of file variable.c.

References BUILTIN_TYPE, FL_EXIVAR, FL_TEST, id, id_for_var, index, n, name, obj, Qnil, Qundef, rb_check_frozen, RCLASS_IV_TBL, ROBJECT_IV_INDEX_TBL, ROBJECT_IVPTR, ROBJECT_NUMIV, st_delete(), st_lookup(), T_CLASS, T_MODULE, T_OBJECT, and v.

## ◆ rb_obj_transient_heap_evacuate()

void rb_obj_transient_heap_evacuate | ( | VALUE | obj,
|  | int | promote
| ) |  |

Definition at line 1215 of file variable.c.

References ALLOC_N, len, obj, ROBJ_TRANSIENT_P, ROBJ_TRANSIENT_UNSET, ROBJECT_IVPTR, and ROBJECT_NUMIV.

## ◆ rb_path2class()

VALUE rb_path2class | ( | const char * | path | ) |

Definition at line 268 of file variable.c.

References path, rb_path_to_class(), and rb_str_new_cstr.

Referenced by Init_ossl_digest().

## ◆ rb_path_to_class()

VALUE rb_path_to_class | ( | VALUE | pathname | ) |

Definition at line 226 of file variable.c.

References id, path, PRIsVALUE, QUOTE, rb_check_id_cstr(), rb_cObject, rb_eArgError, rb_enc_asciicompat, rb_enc_get(), rb_encoding, rb_raise(), rb_str_subseq(), RSTRING_LEN, and RSTRING_PTR.

Referenced by rb_path2class().

## ◆ rb_public_const_defined_from()

MJIT_FUNC_EXPORTED int rb_public_const_defined_from | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2694 of file variable.c.

## ◆ rb_public_const_get_at()

MJIT_FUNC_EXPORTED VALUE rb_public_const_get_at | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2405 of file variable.c.

## ◆ rb_public_const_get_from()

MJIT_FUNC_EXPORTED VALUE rb_public_const_get_from | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2399 of file variable.c.

## ◆ rb_search_class_path()

VALUE rb_search_class_path | ( | VALUE | klass | ) |

Definition at line 175 of file variable.c.

Referenced by rb_vm_bugreport().

## ◆ rb_set_class_path()

void rb_set_class_path | ( | VALUE | klass,
|  | VALUE | under,
|  | const char * | name
| ) |  |

Definition at line 218 of file variable.c.

References klass, name, OBJ_FREEZE, rb_set_class_path_string(), rb_str_new2, and str.

## ◆ rb_set_class_path_string()

void rb_set_class_path_string | ( | VALUE | klass,
|  | VALUE | under,
|  | VALUE | name
| ) |  |

Definition at line 198 of file variable.c.

References str.

Referenced by rb_define_class_id_under(), rb_define_module_id_under(), and rb_set_class_path().

v
int VALUE v
Definition: rb_mjit_min_header-2.7.0.h:12332
RCLASS_SUPER
#define RCLASS_SUPER(c)
Definition: classext.h:16
klass
VALUE klass
Definition: rb_mjit_min_header-2.7.0.h:13254