17struct rb_gc_vm_context {
18 rb_nativethread_lock_t lock;
23typedef int (*vm_table_foreach_callback_func)(
VALUE value,
void *data);
24typedef int (*vm_table_update_callback_func)(
VALUE *value,
void *data);
27enum rb_gc_vm_weak_tables {
29 RB_GC_VM_OVERLOADED_CME_TABLE,
30 RB_GC_VM_GLOBAL_SYMBOLS_TABLE,
31 RB_GC_VM_GENERIC_IV_TABLE,
32 RB_GC_VM_FROZEN_STRINGS_TABLE,
33 RB_GC_VM_WEAK_TABLE_COUNT
37RUBY_SYMBOL_EXPORT_BEGIN
38unsigned int rb_gc_vm_lock(
void);
39void rb_gc_vm_unlock(
unsigned int lev);
40unsigned int rb_gc_cr_lock(
void);
41void rb_gc_cr_unlock(
unsigned int lev);
42unsigned int rb_gc_vm_lock_no_barrier(
void);
43void rb_gc_vm_unlock_no_barrier(
unsigned int lev);
44void rb_gc_vm_barrier(
void);
45size_t rb_gc_obj_optimal_size(
VALUE obj);
47void rb_gc_update_object_references(
void *
objspace,
VALUE obj);
48void rb_gc_update_vm_references(
void *
objspace);
50void *rb_gc_get_objspace(
void);
51size_t rb_size_mul_or_raise(
size_t x,
size_t y,
VALUE exc);
52void rb_gc_run_obj_finalizer(
VALUE objid,
long count,
VALUE (*callback)(
long i,
void *data),
void *data);
53void rb_gc_set_pending_interrupt(
void);
54void rb_gc_unset_pending_interrupt(
void);
55void rb_gc_obj_free_vm_weak_references(
VALUE obj);
57void rb_gc_save_machine_context(
void);
58void rb_gc_mark_roots(
void *
objspace,
const char **categoryp);
59void rb_gc_ractor_newobj_cache_foreach(
void (*func)(
void *cache,
void *data),
void *data);
60bool rb_gc_multi_ractor_p(
void);
61void rb_objspace_reachable_objects_from_root(
void (func)(
const char *category,
VALUE,
void *),
void *passing_data);
62void rb_objspace_reachable_objects_from(
VALUE obj,
void (func)(
VALUE,
void *),
void *data);
63void rb_obj_info_dump(
VALUE obj);
64const char *rb_obj_info(
VALUE obj);
65bool rb_gc_shutdown_call_finalizer_p(
VALUE obj);
66uint32_t rb_gc_get_shape(
VALUE obj);
67void rb_gc_set_shape(
VALUE obj, uint32_t shape_id);
68uint32_t rb_gc_rebuild_shape(
VALUE obj,
size_t heap_id);
69size_t rb_obj_memsize_of(
VALUE obj);
70void rb_gc_prepare_heap_process_object(
VALUE obj);
71bool ruby_free_at_exit_p(
void);
72bool rb_memerror_reentered(
void);
76void *rb_gc_get_ractor_newobj_cache(
void);
77void rb_gc_initialize_vm_context(
struct rb_gc_vm_context *context);
78void rb_gc_worker_thread_set_vm_context(
struct rb_gc_vm_context *context);
79void rb_gc_worker_thread_unset_vm_context(
struct rb_gc_vm_context *context);
80void rb_gc_vm_weak_table_foreach(vm_table_foreach_callback_func callback, vm_table_update_callback_func update_callback,
void *data,
enum rb_gc_vm_weak_tables table);
84void rb_ractor_finish_marking(
void);
89#ifdef BUILDING_MODULAR_GC
102#ifndef RGENGC_CHECK_MODE
103# define RGENGC_CHECK_MODE 0
107# define GC_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(RGENGC_CHECK_MODE > 0, expr, #expr)
111hash_foreach_replace_value(st_data_t key, st_data_t value, st_data_t argp,
int error)
113 if (rb_gc_location((
VALUE)value) != (
VALUE)value) {
120hash_replace_ref_value(st_data_t *key, st_data_t *value, st_data_t argp,
int existing)
122 *value = rb_gc_location((
VALUE)*value);
128gc_ref_update_table_values_only(
st_table *tbl)
130 if (!tbl || tbl->num_entries == 0)
return;
132 if (st_foreach_with_replace(tbl, hash_foreach_replace_value, hash_replace_ref_value, 0)) {
138gc_mark_tbl_no_pin_i(st_data_t key, st_data_t value, st_data_t data)
140 rb_gc_mark_movable((
VALUE)value);
146hash_foreach_replace(st_data_t key, st_data_t value, st_data_t argp,
int error)
148 if (rb_gc_location((
VALUE)key) != (
VALUE)key) {
152 if (rb_gc_location((
VALUE)value) != (
VALUE)value) {
160hash_replace_ref(st_data_t *key, st_data_t *value, st_data_t argp,
int existing)
162 if (rb_gc_location((
VALUE)*key) != (
VALUE)*key) {
163 *key = rb_gc_location((
VALUE)*key);
166 if (rb_gc_location((
VALUE)*value) != (
VALUE)*value) {
167 *value = rb_gc_location((
VALUE)*value);
176 if (!tbl || tbl->num_entries == 0)
return;
178 if (st_foreach_with_replace(tbl, hash_foreach_replace, hash_replace_ref, 0)) {
184xmalloc2_size(
const size_t count,
const size_t elsize)
186 return rb_size_mul_or_raise(count, elsize, rb_eArgError);
193#define COUNT_TYPE(t) case (t): return ID2SYM(rb_intern(#t)); break;
226#ifdef BUILDING_MODULAR_GC
uint32_t rb_event_flag_t
Represents event(s).
#define T_COMPLEX
Old name of RUBY_T_COMPLEX.
#define T_FILE
Old name of RUBY_T_FILE.
#define T_STRING
Old name of RUBY_T_STRING.
#define T_NIL
Old name of RUBY_T_NIL.
#define T_FLOAT
Old name of RUBY_T_FLOAT.
#define T_IMEMO
Old name of RUBY_T_IMEMO.
#define T_BIGNUM
Old name of RUBY_T_BIGNUM.
#define T_STRUCT
Old name of RUBY_T_STRUCT.
#define T_FIXNUM
Old name of RUBY_T_FIXNUM.
#define T_DATA
Old name of RUBY_T_DATA.
#define T_NONE
Old name of RUBY_T_NONE.
#define T_NODE
Old name of RUBY_T_NODE.
#define SIZET2NUM
Old name of RB_SIZE2NUM.
#define T_MODULE
Old name of RUBY_T_MODULE.
#define T_TRUE
Old name of RUBY_T_TRUE.
#define T_RATIONAL
Old name of RUBY_T_RATIONAL.
#define T_ICLASS
Old name of RUBY_T_ICLASS.
#define T_HASH
Old name of RUBY_T_HASH.
#define T_FALSE
Old name of RUBY_T_FALSE.
#define T_UNDEF
Old name of RUBY_T_UNDEF.
#define T_ZOMBIE
Old name of RUBY_T_ZOMBIE.
#define T_ARRAY
Old name of RUBY_T_ARRAY.
#define T_OBJECT
Old name of RUBY_T_OBJECT.
#define T_SYMBOL
Old name of RUBY_T_SYMBOL.
#define T_MATCH
Old name of RUBY_T_MATCH.
#define T_CLASS
Old name of RUBY_T_CLASS.
#define T_MOVED
Old name of RUBY_T_MOVED.
#define T_REGEXP
Old name of RUBY_T_REGEXP.
VALUE rb_eRuntimeError
RuntimeError exception.
VALUE type(ANYARGS)
ANYARGS-ed function type.
uintptr_t VALUE
Type that represents a Ruby object.
#define RBIMPL_WARNING_IGNORED(flag)
Suppresses a warning.
#define RBIMPL_WARNING_PUSH()
Pushes compiler warning state.
#define RBIMPL_WARNING_POP()
Pops compiler warning state.