Ruby: internal/variable.h Source File

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

variable.h
1#ifndef INTERNAL_VARIABLE_H /*-*-C-*-vi:se ft=c:*/
2#define INTERNAL_VARIABLE_H
11#include "ruby/internal/config.h"
12#include <stddef.h> /* for size_t */
13#include "constant.h" /* for rb_const_entry_t */
14#include "ruby/internal/stdbool.h" /* for bool */
15#include "ruby/ruby.h" /* for VALUE */
16#include "shape.h" /* for rb_shape_t */
17
18/* global variable */
19
20#define ROBJECT_TRANSIENT_FLAG FL_USER2
21
22/* variable.c */
23void rb_gc_mark_global_tbl(void);
24void rb_gc_update_global_tbl(void);
25size_t rb_generic_ivar_memsize(VALUE);
26 VALUE rb_search_class_path(VALUE);
27 VALUE rb_attr_delete(VALUE, ID);
28void rb_autoload_str(VALUE mod, ID id, VALUE file);
29 VALUE rb_autoload_at_p(VALUE, ID, int);
30NORETURN(VALUE rb_mod_const_missing(VALUE,VALUE));
31 rb_gvar_getter_t *rb_gvar_getter_function_of(ID);
32 rb_gvar_setter_t *rb_gvar_setter_function_of(ID);
33void rb_gvar_readonly_setter(VALUE v, ID id, VALUE *_);
34void rb_gvar_ractor_local(const char *name);
35static inline bool ROBJ_TRANSIENT_P(VALUE obj);
36static inline void ROBJ_TRANSIENT_SET(VALUE obj);
37static inline void ROBJ_TRANSIENT_UNSET(VALUE obj);
38
39struct gen_ivtbl;
40int rb_gen_ivtbl_get(VALUE obj, ID id, struct gen_ivtbl **ivtbl);
41int rb_obj_evacuate_ivs_to_hash_table(ID key, VALUE val, st_data_t arg);
42
43RUBY_SYMBOL_EXPORT_BEGIN
44/* variable.c (export) */
45void rb_mark_generic_ivar(VALUE);
46void rb_mv_generic_ivar(VALUE src, VALUE dst);
47 VALUE rb_const_missing(VALUE klass, VALUE name);
48int rb_class_ivar_set(VALUE klass, ID vid, VALUE value);
49void rb_iv_tbl_copy(VALUE dst, VALUE src);
50RUBY_SYMBOL_EXPORT_END
51
52MJIT_SYMBOL_EXPORT_BEGIN
53 VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
54 VALUE rb_gvar_get(ID);
55 VALUE rb_gvar_set(ID, VALUE);
56 VALUE rb_gvar_defined(ID);
57void rb_const_warn_if_deprecated(const rb_const_entry_t *, VALUE, ID);
58 rb_shape_t * rb_grow_iv_list(VALUE obj);
59void rb_ensure_iv_list_size(VALUE obj, uint32_t len, uint32_t newsize);
60struct gen_ivtbl *rb_ensure_generic_iv_list_size(VALUE obj, rb_shape_t *shape, uint32_t newsize);
61attr_index_t rb_obj_ivar_set(VALUE obj, ID id, VALUE val);
62MJIT_SYMBOL_EXPORT_END
63
64static inline bool
65ROBJ_TRANSIENT_P(VALUE obj)
66{
67#if USE_TRANSIENT_HEAP
68 return FL_TEST_RAW(obj, ROBJECT_TRANSIENT_FLAG);
69#else
70 return false;
71#endif
72}
73
74static inline void
75ROBJ_TRANSIENT_SET(VALUE obj)
76{
77#if USE_TRANSIENT_HEAP
78 FL_SET_RAW(obj, ROBJECT_TRANSIENT_FLAG);
79#endif
80}
81
82static inline void
83ROBJ_TRANSIENT_UNSET(VALUE obj)
84{
85#if USE_TRANSIENT_HEAP
86 FL_UNSET_RAW(obj, ROBJECT_TRANSIENT_FLAG);
87#endif
88}
89
90#endif /* INTERNAL_VARIABLE_H */
FL_UNSET_RAW
#define FL_UNSET_RAW
Old name of RB_FL_UNSET_RAW.
Definition fl_type.h:142
FL_TEST_RAW
#define FL_TEST_RAW
Old name of RB_FL_TEST_RAW.
Definition fl_type.h:140
FL_SET_RAW
#define FL_SET_RAW
Old name of RB_FL_SET_RAW.
Definition fl_type.h:138
rb_gvar_setter_t
void rb_gvar_setter_t(VALUE val, ID id, VALUE *data)
Type that represents a global variable setter function.
Definition variable.h:46
rb_gvar_readonly_setter
rb_gvar_setter_t rb_gvar_readonly_setter
This function just raises rb_eNameError.
Definition variable.h:135
rb_gvar_getter_t
VALUE rb_gvar_getter_t(ID id, VALUE *data)
Type that represents a global variable getter function.
Definition variable.h:37
ruby.h
_
#define _(args)
This was a transition path from K&R to ANSI.
Definition stdarg.h:35
stdbool.h
C99 shim for <stdbool.h>
gen_ivtbl
Definition variable.h:13
rb_const_entry_struct
Definition constant.h:33
rb_shape
Definition shape.h:42
ID
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
Definition value.h:52
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40