17#include "ccan/list/list.h"
25#include "internal/error.h"
26#include "internal/eval.h"
30#include "internal/symbol.h"
32#include "internal/variable.h"
45static ID autoload, classpath, tmp_classpath;
46static VALUE autoload_featuremap;
48static void check_before_mod_set(
VALUE,
ID,
VALUE,
const char *);
50static VALUE rb_const_search(
VALUE klass,
ID id,
int exclude,
int recurse,
int visibility);
67 autoload = rb_intern_const(
"__autoload__");
69 classpath = rb_intern_const(
"__classpath__");
71 tmp_classpath = rb_intern_const(
"__tmp_classpath__");
75rb_namespace_p(
VALUE obj)
77 if (RB_SPECIAL_CONST_P(obj))
return false;
78 switch (RB_BUILTIN_TYPE(obj)) {
94classname(
VALUE klass,
int *permanent)
121 return classname(
mod, &permanent);
133 path =
rb_sprintf(
"#<Module:%p>", (
void*)obj);
148 VALUE path = classname(klass, permanent);
160 path = rb_tmp_class_path(
RBASIC(klass)->klass, &perm, fallback);
164 return fallback(klass, path);
172 VALUE path = rb_tmp_class_path(klass, &permanent, make_temporary_path);
181 return classname(klass, &permanent);
194 return rb_tmp_class_path(klass, &permanent, no_fallback);
208build_const_path(
VALUE head,
ID tail)
210 return build_const_pathname(head,
rb_id2str(tail));
217 ID pathid = classpath;
224 str = rb_tmp_class_path(under, &permanent, make_temporary_path);
227 pathid = tmp_classpath;
245 const char *pbeg, *pend, *p, *path =
RSTRING_PTR(pathname);
254 if (path == pend || path[0] ==
'#') {
259 while (p < pend && *p !=
':') p++;
261 if (p < pend && p[0] ==
':') {
262 if ((
size_t)(pend - p) < 2 || p[1] !=
':')
goto undefined_class;
267 goto undefined_class;
270 if (c ==
Qundef)
goto undefined_class;
271 if (!rb_namespace_p(c)) {
302 VALUE path = rb_tmp_class_path(
rb_class_real(klass), &permanent, make_temporary_path);
338rb_find_global_entry(
ID id)
366rb_gvar_undef_compactor(
void *
var)
386 var->
compactor = rb_gvar_undef_compactor;
404rb_gvar_val_compactor(
void *_var)
413 var->
data = (
void*)
new;
427 var->
data = (
void*)val;
445 var->
data = (
void*)val;
458 if (!var)
return Qnil;
481mark_global_entry(
VALUE v,
void *ignored)
505update_global_entry(
VALUE v,
void *ignored)
523global_id(
const char *
name)
541find_global_id(
const char *
name)
546 if (
name[0] ==
'$') {
572 gvar->
data = (
void*)var;
625 trace->
func = rb_trace_eval;
642 while (trace->
next) {
668 if ((entry = rb_find_global_entry(
id)) ==
NULL) {
688 if (trace->
data == cmd) {
750 return rb_gvar_set_entry(entry, val);
770 ID id = find_global_id(
name);
816 if (!rb_ractor_main_p()) {
821 if (!
NIL_P(backref)) {
825 for (i = 1; i <= nmatch; ++i) {
829 buf[1] = (char)(i +
'0');
849 if (!rb_ractor_main_p()) {
879 entry1->
var = entry2->
var;
888 if (tbl ==
NULL)
return false;
897 *indexp = ent->
index;
906IVAR_ACCESSOR_SHOULD_BE_MAIN_RACTOR(
ID id)
908 if (
UNLIKELY(!rb_ractor_main_p())) {
915#define CVAR_ACCESSOR_SHOULD_BE_MAIN_RACTOR() \
916 if (UNLIKELY(!rb_ractor_main_p())) { \
917 rb_raise(rb_eRactorIsolationError, "can not access class variables from non-main Ractors"); \
921generic_ivtbl(
VALUE obj,
ID id,
bool force_check_ractor)
926 !RB_OBJ_FROZEN_RAW(obj) &&
928 UNLIKELY(rb_ractor_shareable_p(obj))) {
932 return generic_iv_tbl_;
936generic_ivtbl_no_ractor_check(
VALUE obj)
938 return generic_ivtbl(obj, 0,
false);
962 return gen_ivtbl_get(obj, 0, ivtbl);
970 if (gen_ivtbl_get(obj,
id, &ivtbl)) {
985 if (gen_ivtbl_get(obj,
id, &ivtbl)) {
989 if (iv_index_tbl && iv_index_tbl_lookup(iv_index_tbl,
id, &index)) {
990 if (index < ivtbl->
numiv) {
994 return ret ==
Qundef ? undef : ret;
1006 if (gen_ivtbl_get(obj,
id, &ivtbl)) {
1010 if (iv_index_tbl && iv_index_tbl_lookup(iv_index_tbl,
id, &index)) {
1011 if (index < ivtbl->
numiv) {
1014 return ret ==
Qundef ? undef : ret;
1022gen_ivtbl_bytes(
size_t n)
1043gen_ivtbl_dup(
const struct gen_ivtbl *orig)
1045 size_t s = gen_ivtbl_bytes(orig->
numiv);
1062 return (index+1) + (index+1)/4;
1082 uint32_t newsize = iv_index_tbl_newsize(ivup);
1083 ivtbl = gen_ivtbl_resize(ivtbl, newsize);
1090generic_ivar_defined(
VALUE obj,
ID id)
1096 if (!iv_index_tbl_lookup(iv_index_tbl,
id, &index))
return Qfalse;
1097 if (!gen_ivtbl_get(obj,
id, &ivtbl))
return Qfalse;
1112 if (!iv_index_tbl)
return 0;
1113 if (!iv_index_tbl_lookup(iv_index_tbl,
id, &index))
return 0;
1114 if (!gen_ivtbl_get(obj,
id, &ivtbl))
return 0;
1116 if (index < ivtbl->
numiv) {
1118 *valp = ivtbl->
ivptr[index];
1127gen_ivtbl_mark(
const struct gen_ivtbl *ivtbl)
1131 for (i = 0; i < ivtbl->
numiv; i++) {
1141 if (gen_ivtbl_get(obj, 0, &ivtbl)) {
1142 gen_ivtbl_mark(ivtbl);
1166RUBY_FUNC_EXPORTED
size_t
1171 if (gen_ivtbl_get(obj, 0, &ivtbl))
1172 return gen_ivtbl_bytes(ivtbl->
numiv);
1177gen_ivtbl_count(
const struct gen_ivtbl *ivtbl)
1182 for (i = 0; i < ivtbl->
numiv; i++) {
1216 IVAR_ACCESSOR_SHOULD_BE_MAIN_RACTOR(
id);
1227 return generic_ivar_get(obj,
id, undef);
1257 len = ROBJECT_NUMIV(obj);
1258 ptr = ROBJECT_IVPTR(obj);
1260 if (iv_index_tbl_lookup(iv_index_tbl,
id, &index) &&
1272 IVAR_ACCESSOR_SHOULD_BE_MAIN_RACTOR(
id);
1280 return generic_ivar_delete(obj,
id, undef);
1289 return rb_ivar_delete(obj,
id,
Qnil);
1309 return iv_index_tbl;
1319 ivup->
index = ent->index;
1327 ent->class_value = klass;
1343 iv_index_tbl_extend(&ivup,
id, klass);
1355obj_ivar_heap_alloc(
VALUE obj,
size_t newsize)
1359 if (newptr !=
NULL) {
1360 ROBJ_TRANSIENT_SET(obj);
1363 ROBJ_TRANSIENT_UNSET(obj);
1370obj_ivar_heap_realloc(
VALUE obj, int32_t
len,
size_t newsize)
1375 if (ROBJ_TRANSIENT_P(obj)) {
1377 newptr = obj_ivar_heap_alloc(obj, newsize);
1380 ROBJECT(obj)->as.heap.ivptr = newptr;
1381 for (i=0; i<(
int)
len; i++) {
1382 newptr[i] = orig_ptr[i];
1387 newptr =
ROBJECT(obj)->as.heap.ivptr;
1393#if USE_TRANSIENT_HEAP
1397 if (ROBJ_TRANSIENT_P(obj)) {
1399 const VALUE *old_ptr = ROBJECT_IVPTR(obj);
1404 ROBJ_TRANSIENT_UNSET(obj);
1407 new_ptr = obj_ivar_heap_alloc(obj,
len);
1410 ROBJECT(obj)->as.heap.ivptr = new_ptr;
1422 newptr = obj_ivar_heap_alloc(obj, newsize);
1424 RBASIC(obj)->flags &= ~ROBJECT_EMBED;
1425 ROBJECT(obj)->as.heap.ivptr = newptr;
1427 newptr = obj_ivar_heap_realloc(obj,
len, newsize);
1430 for (;
len < newsize;
len++) {
1433 ROBJECT(obj)->as.heap.numiv = newsize;
1434 ROBJECT(obj)->as.heap.iv_index_tbl = index_tbl;
1443 init_iv_list(obj,
len, newsize, index_tbl);
1457 iv_index_tbl_extend(&ivup,
id, klass);
1461 len = ROBJECT_NUMIV(obj);
1463 uint32_t newsize = iv_index_tbl_newsize(&ivup);
1478 obj_ivar_set(obj,
id, val);
1482 IVAR_ACCESSOR_SHOULD_BE_MAIN_RACTOR(
id);
1487 generic_ivar_set(obj,
id, val);
1496 ivar_set(obj,
id, val);
1506 ivar_set(obj,
id, val);
1520 if (iv_index_tbl_lookup(iv_index_tbl,
id, &index) &&
1521 index < ROBJECT_NUMIV(obj) &&
1522 (val = ROBJECT_IVPTR(obj)[index]) !=
Qundef) {
1528 IVAR_ACCESSOR_SHOULD_BE_MAIN_RACTOR(
id);
1534 return generic_ivar_defined(obj,
id);
1559 ID id = iv_index_tbl_nth_id(iv_index_tbl, i);
1560 switch (func(
id, val, arg)) {
1577 if (!iv_index_tbl)
return;
1580 for (i=0; i < ROBJECT_NUMIV(obj); i++) {
1581 VALUE val = ROBJECT_IVPTR(obj)[i];
1582 if (ivar_each_i(iv_index_tbl, val, i, func, arg)) {
1593 if (!iv_index_tbl)
return;
1594 if (!gen_ivtbl_get(obj, 0, &ivtbl))
return;
1598 if (ivar_each_i(iv_index_tbl, val, i, func, arg)) {
1622 iv_index_tbl_extend(&ivup,
id, c->
klass);
1627 uint32_t newsize = iv_index_tbl_newsize(&ivup);
1628 c->
ivtbl = gen_ivtbl_resize(c->
ivtbl, newsize);
1647 if (gen_ivtbl_get(obj, 0, &ivtbl)) {
1651 if (gen_ivtbl_count(
ivtbl) == 0)
1654 if (gen_ivtbl_get(clone, 0, &c.
ivtbl)) {
1674 generic_ivtbl_no_ractor_check(clone);
1715 obj_ivar_each(obj, func, arg);
1719 IVAR_ACCESSOR_SHOULD_BE_MAIN_RACTOR(0);
1726 gen_ivar_each(obj, func, arg);
1743 const VALUE *
const ivptr = ROBJECT_IVPTR(obj);
1744 for (i =
count = 0; i <
num; ++i) {
1762 if (gen_ivtbl_get(obj, 0, &ivtbl)) {
1763 return gen_ivtbl_count(ivtbl);
1810#define rb_is_constant_id rb_is_const_id
1811#define rb_is_constant_name rb_is_const_name
1812#define id_for_var(obj, name, part, type) \
1813 id_for_var_message(obj, name, type, "`%1$s' is not allowed as "#part" "#type" variable name")
1814#define id_for_var_message(obj, name, type, message) \
1815 check_id_type(obj, &(name), rb_is_##type##_id, rb_is_##type##_name, message, strlen(message))
1818 int (*valid_id_p)(
ID),
int (*valid_name_p)(
VALUE),
1819 const char *message,
size_t message_len)
1824 if (
id ? !valid_id_p(
id) : !valid_name_p(
name)) {
1872 if (iv_index_tbl_lookup(iv_index_tbl,
id, &index) &&
1873 index < ROBJECT_NUMIV(obj) &&
1874 (val = ROBJECT_IVPTR(obj)[index]) !=
Qundef) {
1875 ROBJECT_IVPTR(obj)[index] =
Qundef;
1881 IVAR_ACCESSOR_SHOULD_BE_MAIN_RACTOR(
id);
1889 if (generic_ivar_remove(obj,
id, &val)) {
1897 rb_name_err_raise(
"instance variable %1$s not defined",
1907 rb_name_err_raise(
"uninitialized constant %2$s::%1$s",
1910 rb_name_err_raise(
"uninitialized constant %1$s",
1962 VALUE ref = GET_EC()->private_const_reference;
1965 rb_name_err_raise(
"private constant %2$s::%1$s referenced",
1968 uninitialized_constant(klass,
name);
1974autoload_mark(
void *
ptr)
1980autoload_free(
void *
ptr)
1986autoload_memsize(
const void *
ptr)
1993autoload_compact(
void *
ptr)
2000 {autoload_mark, autoload_free, autoload_memsize, autoload_compact,},
2004#define check_autoload_table(av) \
2005 (struct st_table *)rb_check_typeddata((av), &autoload_data_type)
2048autoload_i_compact(
void *
ptr)
2055autoload_i_mark(
void *
ptr)
2068autoload_i_free(
void *
ptr)
2079autoload_i_memsize(
const void *
ptr)
2086 {autoload_i_mark, autoload_i_free, autoload_i_memsize, autoload_i_compact},
2091autoload_c_compact(
void *
ptr)
2102autoload_c_mark(
void *
ptr)
2113autoload_c_free(
void *
ptr)
2116 list_del(&ac->
cnode);
2121autoload_c_memsize(
const void *
ptr)
2128 {autoload_c_mark, autoload_c_free, autoload_c_memsize, autoload_c_compact,},
2148RUBY_FUNC_EXPORTED
void
2195 if (!autoload_featuremap) {
2203 &autoload_data_i_type, ele);
2216 &autoload_const_type, ac);
2238 ele = get_autoload_data((
VALUE)
load, &ac);
2249 list_del_init(&ac->
cnode);
2259check_autoload_required(
VALUE mod,
ID id,
const char **loadingpath)
2264 const char *loading;
2266 if (!
load || !(ele = get_autoload_data(
load, 0))) {
2289 if (loadingpath && loading) {
2290 *loadingpath = loading;
2302 if (!ac)
return FALSE;
2320 if (!
load || !(ele = get_autoload_data(
load, &ac))) {
2350 check_before_mod_set(klass,
id, ac->
value,
"constant");
2354 const_tbl_update(ac);
2362autoload_require(
VALUE arg)
2373 return state->result;
2377autoload_reset(
VALUE arg)
2380 int need_wakeups = 0;
2397 autoload_const_set(ac);
2406 list_for_each_safe((
struct list_head *)&
state->waitq, cur, nxt,
waitq) {
2410 list_del_init(&cur->
waitq);
2424autoload_sleep(
VALUE arg)
2440autoload_sleep_done(
VALUE arg)
2445 list_del(&
state->waitq);
2455 const char *loading = 0, *src;
2462 if (!autoload_defined_p(
mod,
id))
return Qfalse;
2463 load = check_autoload_required(
mod,
id, &loading);
2466 if (src && loading && strcmp(src, loading) == 0)
return Qfalse;
2473 if (!(ele = get_autoload_data(
load, &
ac))) {
2480 ele->
fork_gen = GET_VM()->fork_gen;
2486 list_head_init((
struct list_head *)&
state.waitq);
2522 while (!autoload_defined_p(
mod,
id)) {
2527 load = check_autoload_required(
mod,
id, 0);
2548rb_const_get_0(
VALUE klass,
ID id,
int exclude,
int recurse,
int visibility)
2550 VALUE c = rb_const_search(klass,
id, exclude, recurse, visibility);
2552 if (
UNLIKELY(!rb_ractor_main_p())) {
2553 if (!rb_ractor_shareable_p(c)) {
2563rb_const_search_from(
VALUE klass,
ID id,
int exclude,
int recurse,
int visibility)
2568 while (
RTEST(tmp)) {
2575 GET_EC()->private_const_reference = tmp;
2582 if (am == tmp)
break;
2584 ac = autoloading_const_entry(tmp,
id);
2585 if (ac)
return ac->
value;
2594 if (!recurse)
break;
2599 GET_EC()->private_const_reference = 0;
2604rb_const_search(
VALUE klass,
ID id,
int exclude,
int recurse,
int visibility)
2609 value = rb_const_search_from(klass,
id, exclude, recurse, visibility);
2611 if (exclude)
return value;
2614 return rb_const_search_from(
rb_cObject,
id,
FALSE, recurse, visibility);
2651 rb_name_err_raise(
"constant %2$s::%1$s not defined",
2656rb_const_location_from(
VALUE klass,
ID id,
int exclude,
int recurse,
int visibility)
2658 while (
RTEST(klass)) {
2671 if (!recurse)
break;
2680rb_const_location(
VALUE klass,
ID id,
int exclude,
int recurse,
int visibility)
2685 loc = rb_const_location_from(klass,
id, exclude, recurse, visibility);
2686 if (!
NIL_P(loc))
return loc;
2687 if (exclude)
return loc;
2690 return rb_const_location_from(
rb_cObject,
id,
FALSE, recurse, visibility);
2721 undefined_constant(
mod,
name);
2736 rb_name_err_raise(
"cannot remove %2$s::%1$s",
2746 autoload_delete(
mod,
id);
2774rb_local_constants_i(
ID const_name,
VALUE const_value,
void *ary)
2874 bool inherit =
true;
2882 return rb_local_constants(
mod);
2887rb_const_defined_0(
VALUE klass,
ID id,
int exclude,
int recurse,
int visibility)
2900 if (ce->
value ==
Qundef && !check_autoload_required(tmp,
id, 0) &&
2910 if (!recurse)
break;
2942 return rb_const_defined_0(klass,
id,
TRUE,
TRUE,
TRUE);
2946check_before_mod_set(
VALUE klass,
ID id,
VALUE val,
const char *dest)
2951static void set_namespace_path(
VALUE named_namespace,
VALUE name);
2954set_namespace_path_i(
ID id,
VALUE v,
void *payload)
2958 int has_permanent_classpath;
2963 if (!rb_namespace_p(value)) {
2966 classname(value, &has_permanent_classpath);
2967 if (has_permanent_classpath) {
2970 set_namespace_path(value, build_const_path(parental_path,
id));
2985set_namespace_path(
VALUE named_namespace,
VALUE namespace_path)
3012 if (!rb_ractor_main_p() && !rb_ractor_shareable_p(val)) {
3016 check_before_mod_set(klass,
id, val,
"constant");
3030 .
mod = klass, .id =
id,
3034 const_tbl_update(&ac);
3044 int val_path_permanent;
3045 VALUE val_path = classname(val, &val_path_permanent);
3046 if (
NIL_P(val_path) || !val_path_permanent) {
3051 int parental_path_permanent;
3052 VALUE parental_path = classname(klass, &parental_path_permanent);
3053 if (
NIL_P(parental_path)) {
3055 parental_path = rb_tmp_class_path(klass, &throwaway, make_temporary_path);
3057 if (parental_path_permanent && !val_path_permanent) {
3058 set_namespace_path(val, build_const_path(parental_path,
id));
3060 else if (!parental_path_permanent &&
NIL_P(val_path)) {
3061 rb_ivar_set(val, tmp_classpath, build_const_path(parental_path,
id));
3073 if (!
load)
return 0;
3074 ele = get_autoload_data(
load, acp);
3107 autoload_delete(klass,
id);
3108 ce->
flag = visibility;
3117 visibility = ce->
flag;
3129 setup_const_entry(ce, klass, val, visibility);
3136 setup_const_entry(ce, klass, val, visibility);
3144 ce->
flag = visibility;
3155 rb_warn(
"rb_define_const: invalid name `%s' for constant",
name);
3182 for (i = 0; i <
argc; i++) {
3191 undefined_constant(
mod, val);
3199 ele = current_autoload_data(
mod,
id, &ac);
3288original_module(
VALUE c)
3303cvar_front_klass(
VALUE klass)
3307 if (rb_namespace_p(obj)) {
3317 if (front && target != front) {
3320 if (original_module(front) != original_module(target)) {
3332#define CVAR_FOREACH_ANCESTORS(klass, v, r) \
3333 for (klass = cvar_front_klass(klass); klass; klass = RCLASS_SUPER(klass)) { \
3334 if (cvar_lookup_at(klass, id, (v))) { \
3339#define CVAR_LOOKUP(v,r) do {\
3340 CVAR_ACCESSOR_SHOULD_BE_MAIN_RACTOR(); \
3341 if (cvar_lookup_at(klass, id, (v))) {r;}\
3342 CVAR_FOREACH_ANCESTORS(klass, v, r);\
3348 VALUE tmp, front = 0, target = 0;
3351 CVAR_LOOKUP(0, {
if (!front) front = klass; target = klass;});
3353 cvar_overtaken(front, target,
id);
3360 target =
RBASIC(target)->klass;
3362 check_before_mod_set(target,
id, val,
"class variable");
3373 VALUE tmp, front = 0, target = 0;
3377 CVAR_LOOKUP(&value, {
if (!front) front = klass; target = klass;});
3379 rb_name_err_raise(
"uninitialized class variable %1$s in %2$s",
3382 cvar_overtaken(front, target,
id);
3383 return (
VALUE)value;
3389 if (!klass)
return Qfalse;
3399 rb_name_err_raise(
"wrong class variable name %1$s",
3408 ID id = cv_intern(klass,
name);
3415 ID id = cv_intern(klass,
name);
3422 ID id = cv_intern(klass,
name);
3457 data = mod_cvar_at(tmp, data);
3458 tmp = cvar_front_klass(tmp);
3462 data = mod_cvar_at(tmp, data);
3478cvar_list(
void *data)
3514 bool inherit =
true;
3519 tbl = mod_cvar_of(
mod, 0);
3522 tbl = mod_cvar_at(
mod, 0);
3524 return cvar_list(tbl);
3560 rb_name_err_raise(
"cannot remove %1$s for %2$s",
mod,
ID2SYM(
id));
3563 rb_name_err_raise(
"class variable %1$s not defined for %2$s",
#define offsetof(p_type, field)
VALUE rb_ary_push(VALUE ary, VALUE item)
VALUE rb_assoc_new(VALUE car, VALUE cdr)
#define RUBY_ASSERT(expr)
Asserts that the given expression is truthy iff RUBY_DEBUG is truthy.
#define UNREACHABLE_RETURN
#define rb_category_warn(category,...)
Internal header absorbing C compipler differences.
#define RB_CONST_PRIVATE_P(ce)
#define RB_CONST_DEPRECATED_P(ce)
#define RB_CONST_PUBLIC_P(ce)
#define RB_DEBUG_COUNTER_INC(type)
#define MJIT_FUNC_EXPORTED
rb_encoding * rb_enc_get(VALUE obj)
rb_encoding * rb_usascii_encoding(void)
char str[HTML_ESCAPE_MAX_LEN+1]
#define rb_deprecate_constant(mod, name)
#define RSTRING_LEN(string)
#define RSTRING_PTR(string)
VALUE rb_gc_location(VALUE value)
void rb_mark_tbl_no_pin(st_table *tbl)
void rb_gc_mark_movable(VALUE ptr)
void rb_gc_mark_maybe(VALUE obj)
void rb_gc_update_tbl_refs(st_table *ptr)
void rb_gc_mark(VALUE ptr)
void rb_gc_register_mark_object(VALUE obj)
Inform the garbage collector that object is a live Ruby object that should not be moved.
#define rb_obj_instance_variables(object)
void rb_class_modify_check(VALUE klass)
Asserts that klass is not a frozen class.
ID rb_frame_callee(void)
The name of the current method.
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
void rb_raise(VALUE exc, const char *fmt,...)
void rb_compile_warn(const char *file, int line, const char *fmt,...)
void rb_bug(const char *fmt,...)
void rb_name_error(ID id, const char *fmt,...)
VALUE rb_ident_hash_new(void)
void rb_name_error_str(VALUE str, const char *fmt,...)
void * rb_check_typeddata(VALUE obj, const rb_data_type_t *data_type)
void rb_warn(const char *fmt,...)
VALUE rb_ensure(VALUE(*b_proc)(VALUE), VALUE data1, VALUE(*e_proc)(VALUE), VALUE data2)
An equivalent to ensure clause.
bool rb_warning_category_enabled_p(rb_warning_category_t category)
void rb_warning(const char *fmt,...)
VALUE rb_cObject
Object class.
VALUE rb_obj_hide(VALUE obj)
Make the object invisible from Ruby code.
VALUE rb_obj_class(VALUE)
VALUE rb_cModule
Module class.
VALUE rb_class_real(VALUE)
Looks up the nearest ancestor of cl, skipping singleton classes or module inclusions.
VALUE rb_hash_delete(VALUE hash, VALUE key)
VALUE rb_hash_aref(VALUE hash, VALUE key)
VALUE rb_hash_aset(VALUE hash, VALUE key, VALUE val)
int rb_id_table_insert(struct rb_id_table *tbl, ID id, VALUE val)
int rb_id_table_lookup(struct rb_id_table *tbl, ID id, VALUE *valp)
void rb_id_table_foreach_values(struct rb_id_table *tbl, rb_id_table_foreach_values_func_t *func, void *data)
size_t rb_id_table_size(const struct rb_id_table *tbl)
struct rb_id_table * rb_id_table_create(size_t capa)
int rb_id_table_delete(struct rb_id_table *tbl, ID id)
void rb_id_table_foreach(struct rb_id_table *tbl, rb_id_table_foreach_func_t *func, void *data)
rb_id_table_iterator_result
#define rb_enc_asciicompat(enc)
ID rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc)
Thin wrapper to ruby/config.h.
@ RB_WARN_CATEGORY_DEPRECATED
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
int rb_feature_provided(const char *, const char **)
VALUE rb_backref_get(void)
int rb_is_instance_id(ID)
VALUE rb_block_proc(void)
VALUE rb_str_subseq(VALUE, long, long)
VALUE rb_str_append(VALUE, VALUE)
VALUE rb_str_new_frozen(VALUE)
VALUE rb_str_intern(VALUE)
#define rb_str_new_cstr(str)
VALUE rb_thread_wakeup_alive(VALUE)
void rb_thread_sleep_deadly(void)
VALUE rb_thread_current(void)
const char * rb_sourcefile(void)
void rb_clear_constant_cache(void)
VALUE rb_eval_cmd_kw(VALUE, VALUE, int)
const char * rb_id2name(ID)
ID rb_intern2(const char *, long)
ID rb_intern(const char *)
ID rb_check_id(volatile VALUE *)
Returns ID for the given name if it is interned already, or 0.
rb_gvar_setter_t rb_gvar_var_setter
rb_gvar_marker_t rb_gvar_var_marker
void rb_gvar_marker_t(VALUE *var)
void rb_gvar_setter_t(VALUE val, ID id, VALUE *data)
rb_gvar_setter_t rb_gvar_val_setter
rb_gvar_marker_t rb_gvar_undef_marker
rb_gvar_setter_t rb_gvar_readonly_setter
rb_gvar_getter_t rb_gvar_undef_getter
rb_gvar_marker_t rb_gvar_val_marker
VALUE rb_gvar_getter_t(ID id, VALUE *data)
rb_gvar_setter_t rb_gvar_undef_setter
rb_gvar_getter_t rb_gvar_val_getter
rb_gvar_getter_t rb_gvar_var_getter
Internal header for Class.
#define RCLASS_CONST_TBL(c)
#define RCLASS_IV_INDEX_TBL(c)
Internal header for Hash.
Internal header for Object.
#define ROBJECT_IV_INDEX_TBL
Internal header for Regexp.
int rb_match_nth_defined(int nth, VALUE match)
int rb_match_count(VALUE match)
VALUE rb_fstring_new(const char *ptr, long len)
Internal header for Thread.
int rb_thread_to_be_killed(VALUE thread)
VALUE rb_vm_top_self(void)
VALUE rb_source_location(int *pline)
void rb_vm_pop_cfunc_frame(void)
void rb_vm_inc_const_missing_count(void)
#define rb_fstring_cstr(...)
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
#define MEMCPY(p1, p2, type, n)
void * load(const char *name, size_t *len)
VALUE rb_eRactorIsolationError
#define RB_OBJ_WRITE(a, slot, b)
WB for new reference from ‘a’ to ‘b’.
#define RB_OBJ_WRITTEN(a, oldv, b)
WB for new reference from ‘a’ to ‘b’.
#define TypedData_Wrap_Struct(klass, data_type, sval)
@ RUBY_TYPED_FREE_IMMEDIATELY
#define TypedData_Make_Struct(klass, type, data_type, sval)
unsigned LONG_LONG rb_serial_t
VALUE rb_sprintf(const char *,...)
#define st_is_member(table, key)
size_t strlen(const char *)
struct autoload_state * state
struct list_head constants
struct autoload_const * ac
VALUE ivptr[FLEX_ARY_LEN]
union ivar_update::@178 u
struct rb_global_variable * var
rb_gvar_marker_t * marker
rb_gvar_compact_t * compactor
rb_gvar_getter_t * getter
rb_gvar_setter_t * setter
void(* func)(VALUE arg, VALUE val)
#define rb_obj_transient_heap_evacuate(x, y)
#define rb_transient_heap_alloc(o, s)
VALUE rb_gvar_defined(ID id)
VALUE rb_mod_remove_cvar(VALUE mod, VALUE name)
VALUE rb_const_get_at(VALUE klass, ID id)
void rb_const_warn_if_deprecated(const rb_const_entry_t *ce, VALUE klass, ID id)
rb_gvar_setter_t * rb_gvar_setter_function_of(ID id)
VALUE rb_const_source_location_at(VALUE klass, ID id)
VALUE rb_f_untrace_var(int argc, const VALUE *argv)
VALUE rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj)
VALUE rb_const_list(void *data)
void rb_define_global_const(const char *name, VALUE val)
VALUE rb_gv_get(const char *name)
const char * rb_class2name(VALUE klass)
VALUE rb_cvar_defined(VALUE klass, ID id)
VALUE rb_path2class(const char *path)
#define CVAR_LOOKUP(v, r)
void rb_define_variable(const char *name, VALUE *var)
void rb_copy_generic_ivar(VALUE clone, VALUE obj)
VALUE(* fallback_func)(VALUE obj, VALUE name)
VALUE rb_gvar_set(ID id, VALUE val)
VALUE rb_ivar_set(VALUE obj, ID id, VALUE val)
void rb_alias_variable(ID name1, ID name2)
void rb_set_class_path(VALUE klass, VALUE under, const char *name)
#define id_for_var_message(obj, name, type, message)
VALUE rb_attr_delete(VALUE obj, ID id)
void rb_gvar_compact_t(void *var)
int rb_autoloading_value(VALUE mod, ID id, VALUE *value, rb_const_flag_t *flag)
const char * rb_obj_classname(VALUE obj)
void rb_ivar_set_internal(VALUE obj, ID id, VALUE val)
void rb_gc_mark_global_tbl(void)
void rb_gvar_ractor_local(const char *name)
VALUE rb_mod_constants(int argc, const VALUE *argv, VALUE mod)
VALUE rb_const_get(VALUE klass, ID id)
VALUE rb_f_trace_var(int argc, const VALUE *argv)
VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
void rb_mv_generic_ivar(VALUE rsrc, VALUE dst)
void rb_mark_generic_ivar(VALUE obj)
VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj)
VALUE rb_search_class_path(VALUE klass)
int rb_ivar_foreach_callback_func(ID key, VALUE val, st_data_t arg)
int rb_class_ivar_set(VALUE obj, ID key, VALUE value)
VALUE rb_public_const_get_at(VALUE klass, ID id)
void rb_define_readonly_variable(const char *name, const VALUE *var)
void rb_autoload(VALUE mod, ID id, const char *file)
VALUE rb_gv_set(const char *name, VALUE val)
rb_const_entry_t * rb_const_lookup(VALUE klass, ID id)
void rb_cvar_set(VALUE klass, ID id, VALUE val)
void rb_iv_tbl_copy(VALUE dst, VALUE src)
VALUE rb_autoload_at_p(VALUE mod, ID id, int recur)
void rb_define_virtual_variable(const char *name, rb_gvar_getter_t *getter, rb_gvar_setter_t *setter)
VALUE rb_cvar_get(VALUE klass, ID id)
VALUE rb_mod_name(VALUE mod)
void rb_ivar_foreach(VALUE obj, rb_ivar_foreach_callback_func *func, st_data_t arg)
VALUE rb_ivar_get(VALUE obj, ID id)
void Init_var_tables(void)
int rb_public_const_defined_from(VALUE klass, ID id)
VALUE rb_class_path_cached(VALUE klass)
VALUE rb_autoload_load(VALUE mod, ID id)
size_t rb_generic_ivar_memsize(VALUE obj)
void rb_autoload_str(VALUE mod, ID id, VALUE file)
VALUE rb_const_remove(VALUE mod, ID id)
VALUE rb_const_get_from(VALUE klass, ID id)
void rb_set_class_path_string(VALUE klass, VALUE under, VALUE name)
int rb_const_defined(VALUE klass, ID id)
void rb_const_set(VALUE klass, ID id, VALUE val)
rb_gvar_getter_t * rb_gvar_getter_function_of(ID id)
VALUE rb_obj_remove_instance_variable(VALUE obj, VALUE name)
VALUE rb_path_to_class(VALUE pathname)
st_data_t rb_st_nth_key(st_table *tab, st_index_t index)
VALUE rb_autoload_p(VALUE mod, ID id)
#define id_for_var(obj, name, part, type)
st_index_t rb_ivar_count(VALUE obj)
void rb_gc_update_global_tbl(void)
int rb_ivar_generic_ivtbl_lookup(VALUE obj, struct gen_ivtbl **ivtbl)
void rb_replace_generic_ivar(VALUE clone, VALUE obj)
void * rb_mod_const_at(VALUE mod, void *data)
VALUE rb_cv_get(VALUE klass, const char *name)
VALUE rb_const_source_location(VALUE klass, ID id)
VALUE rb_const_missing(VALUE klass, VALUE name)
void rb_define_const(VALUE klass, const char *name, VALUE val)
VALUE rb_class_name(VALUE klass)
void rb_cv_set(VALUE klass, const char *name, VALUE val)
VALUE rb_class_path(VALUE klass)
VALUE rb_mod_class_variables(int argc, const VALUE *argv, VALUE mod)
#define check_autoload_table(av)
VALUE rb_ivar_generic_lookup_with_index(VALUE obj, ID id, uint32_t index)
VALUE rb_f_global_variables(void)
VALUE rb_iv_get(VALUE obj, const char *name)
VALUE rb_attr_get(VALUE obj, ID id)
VALUE rb_mod_const_missing(VALUE klass, VALUE name)
int rb_const_defined_at(VALUE klass, ID id)
int rb_const_defined_from(VALUE klass, ID id)
VALUE rb_public_const_get_from(VALUE klass, ID id)
VALUE rb_iv_set(VALUE obj, const char *name, VALUE val)
void * rb_mod_const_of(VALUE mod, void *data)
void rb_init_iv_list(VALUE obj)
VALUE rb_mod_remove_const(VALUE mod, VALUE name)
void rb_define_class_variable(VALUE klass, const char *name, VALUE val)
VALUE rb_ivar_defined(VALUE obj, ID id)
void rb_define_hooked_variable(const char *name, VALUE *var, rb_gvar_getter_t *getter, rb_gvar_setter_t *setter)
VALUE rb_mod_deprecate_constant(int argc, const VALUE *argv, VALUE obj)
void rb_free_generic_ivar(VALUE obj)
#define ASSERT_vm_locking()
#define RB_VM_LOCK_ENTER()
#define RB_VM_LOCK_LEAVE()
if((ID)(DISPID) nameid !=nameid)
#define ZALLOC(strm, items, size)