Ruby: internal/variable.h Source File

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

variable.h
Go to the documentation of this file.
1#ifndef INTERNAL_VARIABLE_H /*-*-C-*-vi:se ft=c:*/
2#define INTERNAL_VARIABLE_H
12#include "ruby/internal/config.h"
13#include <stddef.h> /* for size_t */
14#include "constant.h" /* for rb_const_entry_t */
15#include "ruby/internal/stdbool.h" /* for bool */
16#include "ruby/ruby.h" /* for VALUE */
17
18/* global variable */
19
20#define ROBJECT_TRANSIENT_FLAG FL_USER13
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);
28 VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
29void rb_autoload_str(VALUE mod, ID id, VALUE file);
30 VALUE rb_autoload_at_p(VALUE, ID, int);
31 NORETURN(VALUE rb_mod_const_missing(VALUE,VALUE));
32 rb_gvar_getter_t *rb_gvar_getter_function_of(ID);
33 rb_gvar_setter_t *rb_gvar_setter_function_of(ID);
34void rb_gvar_readonly_setter(VALUE v, ID id, VALUE *_);
35void rb_gvar_ractor_local(const char *name);
36static inline bool ROBJ_TRANSIENT_P(VALUE obj);
37static inline void ROBJ_TRANSIENT_SET(VALUE obj);
38static inline void ROBJ_TRANSIENT_UNSET(VALUE obj);
39
40RUBY_SYMBOL_EXPORT_BEGIN
41/* variable.c (export) */
42void rb_mark_generic_ivar(VALUE);
43void rb_mv_generic_ivar(VALUE src, VALUE dst);
44 VALUE rb_const_missing(VALUE klass, VALUE name);
45int rb_class_ivar_set(VALUE klass, ID vid, VALUE value);
46void rb_iv_tbl_copy(VALUE dst, VALUE src);
47void rb_deprecate_constant(VALUE mod, const char *name);
48RUBY_SYMBOL_EXPORT_END
49
50 MJIT_SYMBOL_EXPORT_BEGIN
51 VALUE rb_gvar_get(ID);
52 VALUE rb_gvar_set(ID, VALUE);
53 VALUE rb_gvar_defined(ID);
54void rb_const_warn_if_deprecated(const rb_const_entry_t *, VALUE, ID);
55void rb_init_iv_list(VALUE obj);
56 MJIT_SYMBOL_EXPORT_END
57
58static inline bool
59ROBJ_TRANSIENT_P(VALUE obj)
60{
61#if USE_TRANSIENT_HEAP
62 return FL_TEST_RAW(obj, ROBJECT_TRANSIENT_FLAG);
63#else
64 return false;
65#endif
66}
67
68static inline void
69ROBJ_TRANSIENT_SET(VALUE obj)
70{
71#if USE_TRANSIENT_HEAP
72 FL_SET_RAW(obj, ROBJECT_TRANSIENT_FLAG);
73#endif
74}
75
76static inline void
77ROBJ_TRANSIENT_UNSET(VALUE obj)
78{
79#if USE_TRANSIENT_HEAP
80 FL_UNSET_RAW(obj, ROBJECT_TRANSIENT_FLAG);
81#endif
82}
83
84#endif /* INTERNAL_VARIABLE_H */
NORETURN
#define NORETURN(x)
Definition: attributes.h:152
constant.h
mod
#define mod(x, y)
Definition: date_strftime.c:28
MJIT_SYMBOL_EXPORT_END
#define MJIT_SYMBOL_EXPORT_END
Definition: dllexport.h:63
MJIT_SYMBOL_EXPORT_BEGIN
#define MJIT_SYMBOL_EXPORT_BEGIN
Definition: dllexport.h:62
rb_deprecate_constant
#define rb_deprecate_constant(mod, name)
Definition: etc.c:60
FL_UNSET_RAW
#define FL_UNSET_RAW
Definition: fl_type.h:133
FL_TEST_RAW
#define FL_TEST_RAW
Definition: fl_type.h:131
FL_SET_RAW
#define FL_SET_RAW
Definition: fl_type.h:129
config.h
Thin wrapper to ruby/config.h.
rb_gvar_setter_t
void rb_gvar_setter_t(VALUE val, ID id, VALUE *data)
Definition: variable.h:30
rb_gvar_readonly_setter
rb_gvar_setter_t rb_gvar_readonly_setter
Definition: variable.h:46
rb_gvar_getter_t
VALUE rb_gvar_getter_t(ID id, VALUE *data)
Definition: variable.h:29
rb_mod_const_missing
VALUE rb_mod_const_missing(VALUE, VALUE)
Definition: variable.c:1960
rb_gvar_getter_function_of
rb_gvar_getter_t * rb_gvar_getter_function_of(ID)
Definition: variable.c:789
rb_gc_mark_global_tbl
void rb_gc_mark_global_tbl(void)
Definition: variable.c:497
rb_mark_generic_ivar
void rb_mark_generic_ivar(VALUE)
Definition: variable.c:1137
rb_gvar_ractor_local
void rb_gvar_ractor_local(const char *name)
Definition: variable.c:359
rb_ivar_lookup
VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
Definition: variable.c:1192
rb_autoload_at_p
VALUE rb_autoload_at_p(VALUE, ID, int)
Definition: variable.c:2517
ROBJECT_TRANSIENT_FLAG
#define ROBJECT_TRANSIENT_FLAG
Definition: variable.h:20
rb_generic_ivar_memsize
size_t rb_generic_ivar_memsize(VALUE)
Definition: variable.c:1167
rb_gvar_setter_function_of
rb_gvar_setter_t * rb_gvar_setter_function_of(ID)
Definition: variable.c:796
rb_gvar_set
VALUE rb_gvar_set(ID, VALUE)
Definition: variable.c:745
rb_iv_tbl_copy
void rb_iv_tbl_copy(VALUE dst, VALUE src)
Definition: variable.c:3605
rb_gvar_defined
VALUE rb_gvar_defined(ID)
Definition: variable.c:781
rb_autoload_str
void rb_autoload_str(VALUE mod, ID id, VALUE file)
Definition: variable.c:2158
rb_class_ivar_set
int rb_class_ivar_set(VALUE klass, ID vid, VALUE value)
Definition: variable.c:3589
rb_gc_update_global_tbl
void rb_gc_update_global_tbl(void)
Definition: variable.c:515
rb_gvar_get
VALUE rb_gvar_get(ID)
Definition: variable.c:760
rb_const_missing
VALUE rb_const_missing(VALUE klass, VALUE name)
Definition: variable.c:1915
rb_mv_generic_ivar
void rb_mv_generic_ivar(VALUE src, VALUE dst)
Definition: variable.c:1147
rb_const_warn_if_deprecated
void rb_const_warn_if_deprecated(const rb_const_entry_t *, VALUE, ID)
Definition: variable.c:2533
rb_attr_delete
VALUE rb_attr_delete(VALUE, ID)
Definition: variable.c:1287
rb_init_iv_list
void rb_init_iv_list(VALUE obj)
Definition: variable.c:1438
rb_search_class_path
VALUE rb_search_class_path(VALUE)
Definition: variable.c:191
name
const char * name
Definition: nkf.c:208
ruby.h
_
#define _(args)
Definition: stdarg.h:31
stdbool.h
C99 shim for <stdbool.h>
file
Definition: gzappend.c:170
rb_const_entry_struct
Definition: constant.h:33
VALUE
unsigned long VALUE
Definition: value.h:38
ID
unsigned long ID
Definition: value.h:39