23#include "ruby/internal/config.h"
29#ifdef HAVE_SYS_TYPES_H
30# include <sys/types.h>
47#define RUBY_REF_EDGE(s, p) offsetof(s, p)
48#define RUBY_REFS_LIST_PTR(l) (RUBY_DATA_FUNC)(uintptr_t)(l)
49#define RUBY_REF_END SIZE_MAX
50#define RUBY_REFERENCES(t) static const size_t t[]
51#define RUBY_REFERENCES_START(t) RUBY_REFERENCES(t) = {
52#define RUBY_REFERENCES_END RUBY_REF_END, };
65void rb_memerror(
void);
74int rb_during_gc(
void);
92void rb_gc_mark_locations(const
VALUE *start, const
VALUE *end);
104void rb_mark_tbl(struct st_table *tbl);
115void rb_mark_tbl_no_pin(struct st_table *tbl);
127void rb_mark_set(struct st_table *tbl);
137void rb_mark_hash(struct st_table *tbl);
148void rb_gc_update_tbl_refs(st_table *ptr);
160void rb_gc_mark_maybe(
VALUE obj);
169void rb_gc_mark(
VALUE obj);
200void rb_gc_mark_movable(
VALUE obj);
223void rb_gc_update_moved(
VALUE *ptr);
266void rb_gc_copy_finalizer(
VALUE dst,
VALUE src);
280VALUE rb_gc_enable(
void);
297VALUE rb_gc_disable(
void);
304VALUE rb_gc_start(
void);
346size_t rb_gc_count(
void);
364size_t rb_gc_stat(
VALUE key_or_buf);
397void rb_gc_adjust_memory_usage(ssize_t diff);
427void rb_gc_register_address(
VALUE *valptr);
444void rb_gc_unregister_address(
VALUE *valptr);
452void rb_gc_register_mark_object(
VALUE object);
470#ifndef USE_RGENGC_LOGGING_WB_UNPROTECT
471# define USE_RGENGC_LOGGING_WB_UNPROTECT 0
492#define RB_OBJ_WRITE(old, slot, young) \
493 RBIMPL_CAST(rb_obj_write((VALUE)(old), (VALUE *)(slot), (VALUE)(young), __FILE__, __LINE__))
504#define RB_OBJ_WRITTEN(old, oldv, young) \
505 RBIMPL_CAST(rb_obj_written((VALUE)(old), (VALUE)(oldv), (VALUE)(young), __FILE__, __LINE__))
508#define OBJ_PROMOTED_RAW RB_OBJ_PROMOTED_RAW
509#define OBJ_PROMOTED RB_OBJ_PROMOTED
510#define OBJ_WB_UNPROTECT RB_OBJ_WB_UNPROTECT
519#define RB_OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
532#define RB_OBJ_WB_UNPROTECT_FOR(type, obj) OBJ_WB_UNPROTECT(obj)
540#define RGENGC_LOGGING_WB_UNPROTECT rb_gc_unprotect_logging
543#define RB_OBJ_PROMOTED_RAW RB_OBJ_PROMOTED_RAW
544#define RB_OBJ_PROMOTED RB_OBJ_PROMOTED
555void rb_gc_writebarrier(
VALUE old,
VALUE young);
563void rb_gc_writebarrier_unprotect(
VALUE obj);
565#if USE_RGENGC_LOGGING_WB_UNPROTECT
578void rb_gc_unprotect_logging(
void *objptr,
const char *filename,
int line);
637 const char *filename,
641#if USE_RGENGC_LOGGING_WB_UNPROTECT
668 const char *filename,
672#if USE_RGENGC_LOGGING_WB_UNPROTECT
673 RGENGC_LOGGING_OBJ_WRITTEN(a, oldv, b, filename, line);
700 const char *filename,
704#ifdef RGENGC_LOGGING_WRITE
705 RGENGC_LOGGING_WRITE(a, slot, b, filename, line);
710 rb_obj_written(a,
RUBY_Qundef , b, filename, line);
Defines RBIMPL_ATTR_ARTIFICIAL.
#define RBIMPL_ATTR_ARTIFICIAL()
Wraps (or simulates) __attribute__((artificial)).
Defines RBIMPL_ATTR_COLD.
#define RBIMPL_ATTR_COLD()
Wraps (or simulates) __attribute__((cold)).
Tweaking visibility of C variables/functions.
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
static bool RB_FL_ABLE(VALUE obj)
Checks if the object is flaggable.
static bool RB_FL_ANY_RAW(VALUE obj, VALUE flags)
This is an implementation detail of RB_FL_ANY().
@ RUBY_FL_PROMOTED
Ruby objects are "generational".
#define RBIMPL_ASSERT_OR_ASSUME(...)
This is either RUBY_ASSERT or RBIMPL_ASSUME, depending on RUBY_DEBUG.
Defines RBIMPL_ATTR_NONNULL.
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull)).
static VALUE rb_obj_wb_unprotect(VALUE x, const char *filename, int line)
This is the implementation of RB_OBJ_WB_UNPROTECT().
void rb_gc_writebarrier(VALUE old, VALUE young)
This is the implementation of RB_OBJ_WRITE().
void rb_gc_writebarrier_unprotect(VALUE obj)
This is the implementation of RB_OBJ_WB_UNPROTECT().
#define RGENGC_LOGGING_WB_UNPROTECT
This is an implementation detail of rb_obj_wb_unprotect().
static bool RB_OBJ_PROMOTED(VALUE obj)
Tests if the object is "promoted" – that is, whether the object experienced one or more GC marks.
static bool RB_OBJ_PROMOTED_RAW(VALUE obj)
This is the implementation of RB_OBJ_PROMOTED().
Defines RBIMPL_ATTR_MAYBE_UNUSED.
#define RBIMPL_ATTR_MAYBE_UNUSED()
Wraps (or simulates) [[maybe_unused]].
Defines RBIMPL_ATTR_NORETURN.
#define RBIMPL_ATTR_NORETURN()
Wraps (or simulates) [[noreturn]].
Defines RBIMPL_ATTR_PURE.
#define RBIMPL_ATTR_PURE()
Wraps (or simulates) __attribute__((pure)).
#define RBIMPL_ATTR_PURE_UNLESS_DEBUG()
Enables RBIMPL_ATTR_PURE if and only if.
Defines enum ruby_special_consts.
static bool RB_SPECIAL_CONST_P(VALUE obj)
Checks if the given object is of enum ruby_special_consts.
@ RUBY_Qundef
Represents so-called undef.
C99 shim for <stdbool.h>.
uintptr_t VALUE
Type that represents a Ruby object.