Ruby: Write barrier (WB) interfaces:

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

Macros
Write barrier (WB) interfaces:

## Macros
#define | RB_OBJ_WRITE(old, slot, young)
| Declaration of a "back" pointer.
#define | RB_OBJ_WRITTEN(old, oldv, young)
| Identical to RB_OBJ_WRITE(), except it doesn't write any values, but only a WB declaration.

## Detailed Description

Note
  The following core interfaces can be changed in the future. Please catch up if you want to insert WB into C-extensions correctly.

## Macro Definition Documentation

## ◆ RB_OBJ_WRITE

#define RB_OBJ_WRITE | ( |  | old,
|  |  | slot,
|  |  | young )

Value:
RBIMPL_CAST(rb_obj_write((VALUE)(old), (VALUE *)(slot), (VALUE)(young), __FILE__, __LINE__))
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40

Declaration of a "back" pointer.

This is a write barrier for new reference from "old" generation to "young" generation. It writes `young` into `*slot`, which is a pointer inside of `old`.

Parameters

  [in] | old | An old object.
  [in] | slot | A pointer inside of `old`.
  [out] | young | A young object.

Definition at line 220 of file rgengc.h.

Referenced by class_alloc(), RARRAY_ASET(), rb_alias(), rb_ary_push(), rb_enc_reg_new(), rb_hash_set_ifnone(), rb_ractor_stderr_set(), rb_ractor_stdin_set(), and rb_ractor_stdout_set().

## ◆ RB_OBJ_WRITTEN

#define RB_OBJ_WRITTEN | ( |  | old,
|  |  | oldv,
|  |  | young )

Value:
RBIMPL_CAST(rb_obj_written((VALUE)(old), (VALUE)(oldv), (VALUE)(young), __FILE__, __LINE__))

Identical to RB_OBJ_WRITE(), except it doesn't write any values, but only a WB declaration.

`oldv` is replaced value with `b` (not used in current Ruby).

Parameters

  [in] | old | An old object.
  [in] | oldv | An object previously stored inside of `old`.
  [out] | young | A young object.

Definition at line 232 of file rgengc.h.

Referenced by rb_copy_generic_ivar().