Ruby: include/ruby/internal/fl_type.h File Reference

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

Macros | Enumerations | Functions
fl_type.h File Reference

Defines enum ruby_fl_type. More...

`#include "ruby/internal/config.h"`
`#include "ruby/internal/attr/artificial.h"`
`#include "ruby/internal/attr/deprecated.h"`
`#include "ruby/internal/attr/flag_enum.h"`
`#include "ruby/internal/attr/forceinline.h"`
`#include "ruby/internal/attr/noalias.h"`
`#include "ruby/internal/attr/pure.h"`
`#include "ruby/internal/cast.h"`
`#include "ruby/internal/compiler_since.h"`
`#include "ruby/internal/core/rbasic.h"`
`#include "ruby/internal/dllexport.h"`
`#include "ruby/internal/has/extension.h"`
`#include "ruby/internal/special_consts.h"`
`#include "ruby/internal/stdbool.h"`
`#include "ruby/internal/value.h"`
`#include "ruby/internal/value_type.h"`
`#include "ruby/assert.h"`
`#include "ruby/defines.h"`

Go to the source code of this file.

## Macros
#define | FL_SINGLETON RBIMPL_CAST((VALUE)RUBY_FL_SINGLETON)
| Old name of RUBY_FL_SINGLETON.
#define | FL_WB_PROTECTED RBIMPL_CAST((VALUE)RUBY_FL_WB_PROTECTED)
| Old name of RUBY_FL_WB_PROTECTED.
#define | FL_PROMOTED0 RBIMPL_CAST((VALUE)RUBY_FL_PROMOTED0)
| Old name of RUBY_FL_PROMOTED0.
#define | FL_PROMOTED1 RBIMPL_CAST((VALUE)RUBY_FL_PROMOTED1)
| Old name of RUBY_FL_PROMOTED1.
#define | FL_FINALIZE RBIMPL_CAST((VALUE)RUBY_FL_FINALIZE)
| Old name of RUBY_FL_FINALIZE.
#define | FL_TAINT RBIMPL_CAST((VALUE)RUBY_FL_TAINT)
| Old name of RUBY_FL_TAINT.
#define | FL_SHAREABLE RBIMPL_CAST((VALUE)RUBY_FL_SHAREABLE)
| Old name of RUBY_FL_SHAREABLE.
#define | FL_UNTRUSTED RBIMPL_CAST((VALUE)RUBY_FL_UNTRUSTED)
| Old name of RUBY_FL_UNTRUSTED.
#define | FL_SEEN_OBJ_ID RBIMPL_CAST((VALUE)RUBY_FL_SEEN_OBJ_ID)
| Old name of RUBY_FL_SEEN_OBJ_ID.
#define | FL_EXIVAR RBIMPL_CAST((VALUE)RUBY_FL_EXIVAR)
| Old name of RUBY_FL_EXIVAR.
#define | FL_FREEZE RBIMPL_CAST((VALUE)RUBY_FL_FREEZE)
| Old name of RUBY_FL_FREEZE.
#define | FL_USHIFT RBIMPL_CAST((VALUE)RUBY_FL_USHIFT)
| Old name of RUBY_FL_USHIFT.
#define | FL_USER0 RBIMPL_CAST((VALUE)RUBY_FL_USER0)
| Old name of RUBY_FL_USER0.
#define | FL_USER1 RBIMPL_CAST((VALUE)RUBY_FL_USER1)
| Old name of RUBY_FL_USER1.
#define | FL_USER2 RBIMPL_CAST((VALUE)RUBY_FL_USER2)
| Old name of RUBY_FL_USER2.
#define | FL_USER3 RBIMPL_CAST((VALUE)RUBY_FL_USER3)
| Old name of RUBY_FL_USER3.
#define | FL_USER4 RBIMPL_CAST((VALUE)RUBY_FL_USER4)
| Old name of RUBY_FL_USER4.
#define | FL_USER5 RBIMPL_CAST((VALUE)RUBY_FL_USER5)
| Old name of RUBY_FL_USER5.
#define | FL_USER6 RBIMPL_CAST((VALUE)RUBY_FL_USER6)
| Old name of RUBY_FL_USER6.
#define | FL_USER7 RBIMPL_CAST((VALUE)RUBY_FL_USER7)
| Old name of RUBY_FL_USER7.
#define | FL_USER8 RBIMPL_CAST((VALUE)RUBY_FL_USER8)
| Old name of RUBY_FL_USER8.
#define | FL_USER9 RBIMPL_CAST((VALUE)RUBY_FL_USER9)
| Old name of RUBY_FL_USER9.
#define | FL_USER10 RBIMPL_CAST((VALUE)RUBY_FL_USER10)
| Old name of RUBY_FL_USER10.
#define | FL_USER11 RBIMPL_CAST((VALUE)RUBY_FL_USER11)
| Old name of RUBY_FL_USER11.
#define | FL_USER12 RBIMPL_CAST((VALUE)RUBY_FL_USER12)
| Old name of RUBY_FL_USER12.
#define | FL_USER13 RBIMPL_CAST((VALUE)RUBY_FL_USER13)
| Old name of RUBY_FL_USER13.
#define | FL_USER14 RBIMPL_CAST((VALUE)RUBY_FL_USER14)
| Old name of RUBY_FL_USER14.
#define | FL_USER15 RBIMPL_CAST((VALUE)RUBY_FL_USER15)
| Old name of RUBY_FL_USER15.
#define | FL_USER16 RBIMPL_CAST((VALUE)RUBY_FL_USER16)
| Old name of RUBY_FL_USER16.
#define | FL_USER17 RBIMPL_CAST((VALUE)RUBY_FL_USER17)
| Old name of RUBY_FL_USER17.
#define | FL_USER18 RBIMPL_CAST((VALUE)RUBY_FL_USER18)
| Old name of RUBY_FL_USER18.
#define | FL_USER19 RBIMPL_CAST((VALUE)(unsigned int)RUBY_FL_USER19)
| Old name of RUBY_FL_USER19.
#define | ELTS_SHARED RUBY_ELTS_SHARED
| Old name of RUBY_ELTS_SHARED.
#define | RB_OBJ_FREEZE rb_obj_freeze_inline
| Just another name of rb_obj_freeze_inline.
#define | FL_ABLE RB_FL_ABLE
| Old name of RB_FL_ABLE.
#define | FL_ALL RB_FL_ALL
| Old name of RB_FL_ALL.
#define | FL_ALL_RAW RB_FL_ALL_RAW
| Old name of RB_FL_ALL_RAW.
#define | FL_ANY RB_FL_ANY
| Old name of RB_FL_ANY.
#define | FL_ANY_RAW RB_FL_ANY_RAW
| Old name of RB_FL_ANY_RAW.
#define | FL_REVERSE RB_FL_REVERSE
| Old name of RB_FL_REVERSE.
#define | FL_REVERSE_RAW RB_FL_REVERSE_RAW
| Old name of RB_FL_REVERSE_RAW.
#define | FL_SET RB_FL_SET
| Old name of RB_FL_SET.
#define | FL_SET_RAW RB_FL_SET_RAW
| Old name of RB_FL_SET_RAW.
#define | FL_TEST RB_FL_TEST
| Old name of RB_FL_TEST.
#define | FL_TEST_RAW RB_FL_TEST_RAW
| Old name of RB_FL_TEST_RAW.
#define | FL_UNSET RB_FL_UNSET
| Old name of RB_FL_UNSET.
#define | FL_UNSET_RAW RB_FL_UNSET_RAW
| Old name of RB_FL_UNSET_RAW.
#define | OBJ_FREEZE RB_OBJ_FREEZE
| Old name of RB_OBJ_FREEZE.
#define | OBJ_FREEZE_RAW RB_OBJ_FREEZE_RAW
| Old name of RB_OBJ_FREEZE_RAW.
#define | OBJ_FROZEN RB_OBJ_FROZEN
| Old name of RB_OBJ_FROZEN.
#define | OBJ_FROZEN_RAW RB_OBJ_FROZEN_RAW
| Old name of RB_OBJ_FROZEN_RAW.
#define | OBJ_INFECT RB_OBJ_INFECT
| Old name of RB_OBJ_INFECT.
#define | OBJ_INFECT_RAW RB_OBJ_INFECT_RAW
| Old name of RB_OBJ_INFECT_RAW.
#define | OBJ_TAINT RB_OBJ_TAINT
| Old name of RB_OBJ_TAINT.
#define | OBJ_TAINTABLE RB_OBJ_TAINTABLE
| Old name of RB_OBJ_TAINT_RAW.
#define | OBJ_TAINTED RB_OBJ_TAINTED
| Old name of RB_OBJ_TAINTED.
#define | OBJ_TAINTED_RAW RB_OBJ_TAINTED_RAW
| Old name of RB_OBJ_TAINTED_RAW.
#define | OBJ_TAINT_RAW RB_OBJ_TAINT_RAW
| Old name of RB_OBJ_TAINT_RAW.
#define | OBJ_UNTRUST RB_OBJ_UNTRUST
| Old name of RB_OBJ_TAINT.
#define | OBJ_UNTRUSTED RB_OBJ_UNTRUSTED
| Old name of RB_OBJ_TAINTED.
#define | RBIMPL_FL_USER_N(n)
| (@shyouhei doesn't know how to excude this macro from doxygen).

## Enumerations
enum | ruby_fl_ushift { RUBY_FL_USHIFT = 12 }
| This is an enum because GDB wants it (rather than a macro). More...
enum | ruby_fl_type { RUBY_FL_WB_PROTECTED = (1<<5) , RUBY_FL_PROMOTED0 = (1<<5) , RUBY_FL_PROMOTED1 = (1<<6) , RUBY_FL_PROMOTED = RUBY_FL_PROMOTED0 | RUBY_FL_PROMOTED1 , RUBY_FL_FINALIZE = (1<<7) , RUBY_FL_TAINT = (1<<8) , RUBY_FL_SHAREABLE = (1<<8) , RUBY_FL_UNTRUSTED = (1<<8) , RUBY_FL_SEEN_OBJ_ID = (1<<9) , RUBY_FL_EXIVAR = (1<<10) , RUBY_FL_FREEZE = (1<<11) , RUBY_FL_USER0 = (1<<(RUBY_FL_USHIFT+0)) , RUBY_FL_USER1 = (1<<(RUBY_FL_USHIFT+1)) , RUBY_FL_USER2 = (1<<(RUBY_FL_USHIFT+2)) , RUBY_FL_USER3 = (1<<(RUBY_FL_USHIFT+3)) , RUBY_FL_USER4 = (1<<(RUBY_FL_USHIFT+4)) , RUBY_FL_USER5 = (1<<(RUBY_FL_USHIFT+5)) , RUBY_FL_USER6 = (1<<(RUBY_FL_USHIFT+6)) , RUBY_FL_USER7 = (1<<(RUBY_FL_USHIFT+7)) , RUBY_FL_USER8 = (1<<(RUBY_FL_USHIFT+8)) , RUBY_FL_USER9 = (1<<(RUBY_FL_USHIFT+9)) , RUBY_FL_USER10 = (1<<(RUBY_FL_USHIFT+10)) , RUBY_FL_USER11 = (1<<(RUBY_FL_USHIFT+11)) , RUBY_FL_USER12 = (1<<(RUBY_FL_USHIFT+12)) , RUBY_FL_USER13 = (1<<(RUBY_FL_USHIFT+13)) , RUBY_FL_USER14 = (1<<(RUBY_FL_USHIFT+14)) , RUBY_FL_USER15 = (1<<(RUBY_FL_USHIFT+15)) , RUBY_FL_USER16 = (1<<(RUBY_FL_USHIFT+16)) , RUBY_FL_USER17 = (1<<(RUBY_FL_USHIFT+17)) , RUBY_FL_USER18 = (1<<(RUBY_FL_USHIFT+18)) , RUBY_FL_USER19 = (1<<(RUBY_FL_USHIFT+19)) , RUBY_ELTS_SHARED = RUBY_FL_USER2 , RUBY_FL_SINGLETON = RUBY_FL_USER0 }
| The flags. More...
enum | { RUBY_FL_DUPPED = (int)RUBY_T_MASK | (int)RUBY_FL_EXIVAR }

## Functions
void | rb_freeze_singleton_class (VALUE klass)
| This is an implementation detail of RB_OBJ_FREEZE().
static bool | RB_FL_ABLE (VALUE obj)
| Checks if the object is flaggable.
static VALUE | RB_FL_TEST_RAW (VALUE obj, VALUE flags)
| This is an implenentation detail of RB_FL_TEST().
static VALUE | RB_FL_TEST (VALUE obj, VALUE flags)
| Tests if the given flag(s) are set or not.
static bool | RB_FL_ANY_RAW (VALUE obj, VALUE flags)
| This is an implenentation detail of RB_FL_ANY().
static bool | RB_FL_ANY (VALUE obj, VALUE flags)
| Identical to RB_FL_TEST(), except it returns bool.
static bool | RB_FL_ALL_RAW (VALUE obj, VALUE flags)
| This is an implenentation detail of RB_FL_ALL().
static bool | RB_FL_ALL (VALUE obj, VALUE flags)
| Identical to RB_FL_ANY(), except it mandates all passed flags be set.
static void | RB_FL_SET_RAW (VALUE obj, VALUE flags)
| This is an implenentation detail of RB_FL_SET().
static void | RB_FL_SET (VALUE obj, VALUE flags)
| Sets the given flag(s).
static void | RB_FL_UNSET_RAW (VALUE obj, VALUE flags)
| This is an implenentation detail of RB_FL_UNSET().
static void | RB_FL_UNSET (VALUE obj, VALUE flags)
| Clears the given flag(s).
static void | RB_FL_REVERSE_RAW (VALUE obj, VALUE flags)
| This is an implenentation detail of RB_FL_REVERSE().
static void | RB_FL_REVERSE (VALUE obj, VALUE flags)
| Reverses the flags.
static bool | RB_OBJ_TAINTABLE (VALUE obj)
static VALUE | RB_OBJ_TAINTED_RAW (VALUE obj)
static bool | RB_OBJ_TAINTED (VALUE obj)
static void | RB_OBJ_TAINT_RAW (VALUE obj)
static void | RB_OBJ_TAINT (VALUE obj)
static void | RB_OBJ_INFECT_RAW (VALUE dst, VALUE src)
static void | RB_OBJ_INFECT (VALUE dst, VALUE src)
static VALUE | RB_OBJ_FROZEN_RAW (VALUE obj)
| This is an implenentation detail of RB_OBJ_FROZEN().
static bool | RB_OBJ_FROZEN (VALUE obj)
| Checks if an object is frozen.
static void | RB_OBJ_FREEZE_RAW (VALUE obj)
| This is an implenentation detail of RB_OBJ_FREEZE().
void | rb_obj_freeze_inline (VALUE obj)
| Prevents further modifications to the given object.

## Detailed Description

Defines enum ruby_fl_type.

Author
  Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Copyright
  This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.

Warning
  Symbols prefixed with either `RBIMPL` or `rbimpl` are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.

Note
  To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance `__VA_ARGS__` is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Definition in file fl_type.h.

## Macro Definition Documentation

## ◆ RB_OBJ_FREEZE

#define RB_OBJ_FREEZE rb_obj_freeze_inline

Just another name of rb_obj_freeze_inline.

Definition at line 94 of file fl_type.h.

## ◆ RBIMPL_FL_USER_N

#define RBIMPL_FL_USER_N | ( |  | n | ) |

Value:
RUBY_FL_USER##n = (1<<(RUBY_FL_USHIFT+n))
RUBY_FL_USHIFT
@ RUBY_FL_USHIFT
Number of bits in ruby_fl_type that are not open to users.
Definition fl_type.h:167

(@shyouhei doesn't know how to excude this macro from doxygen).

Definition at line 359 of file fl_type.h.

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
RUBY_FL_DUPPED | Deprecated This flag once was a thing back in the old days, but makes no sense any longer today. Exists here for backwards compatibility only. You can safely forget about it.

Definition at line 433 of file fl_type.h.

## ◆ ruby_fl_type

enum ruby_fl_type

The flags.

Each ruby objects have their own characteristics apart from their classes. For instance whether an object is frozen or not is not controlled by its class. This is the type that represents such properties.

Note
  About the `FL_USER` terminology: the "user" here does not necessarily mean only you. For instance struct RString instances use these bits to cache their encodings etc. Devs discussed about this topic, reached their consensus that RUBY_T_DATA is the only valid data structure that can use these bits; other data structures including RUBY_T_OBJECT use these bits for their own purpose. See also https://bugs.ruby-lang.org/issues/18059

Enumerator
RUBY_FL_WB_PROTECTED | Deprecated This flag once was a thing back in the old days, but makes no sense any longer today. Exists here for backwards compatibility only. You can safely forget about it.
RUBY_FL_PROMOTED0 | This flag has something to do with our garbage collector. These days ruby objects are "generational". There are those who are young and those who are old. Young objects are prone to die; monitored relatively extensively by the garbage collector. OTOH old objects tend to live longer. They are relatively rarely considered. This flag is set when a object experienced promotion i.e. survived a garbage collection.
RUBY_FL_PROMOTED1 | This flag has something to do with our garbage collector. These days ruby objects are "generational". There are those who are young and those who are old. Young objects are prone to die; monitored relatively extensively by the garbage collector. OTOH old objects tend to live longer. They are relatively rarely considered. This flag is set when a object experienced two promotions i.e. survived garbage collections twice.
RUBY_FL_PROMOTED | This flag has something to do with our garbage collector. These days ruby objects are "generational". There are those who are young and those who are old. Young objects are prone to die; monitored relatively extensively by the garbage collector. OTOH old objects tend to live longer. They are relatively rarely considered. This flag is set when a object experienced promotions i.e. survived more than one garbage collections.
RUBY_FL_FINALIZE | This flag has something to do with finalisers. A ruby object can have its finaliser, which is another object that evaluates when the target object is about to die. This flag is used to denote that there is an attached finaliser.
RUBY_FL_TAINT | Deprecated This flag once was a thing back in the old days, but makes no sense any longer today. Exists here for backwards compatibility only. You can safely forget about it.
RUBY_FL_SHAREABLE | This flag has something to do with Ractor. Multiple Ractors run without protecting each other. Sharing an object among Ractors are basically dangerous, disabled by default. This flag is used to bypass that restriction. Of course, you have to manually prevent race conditions then. This flag needs deep understanding of multithreaded programming. You would better not use it.
RUBY_FL_UNTRUSTED | Deprecated This flag once was a thing back in the old days, but makes no sense any longer today. Exists here for backwards compatibility only. You can safely forget about it.
RUBY_FL_SEEN_OBJ_ID | This flag has something to do with object IDs. Unlike in the old days, an object's object ID (that a user can query using `Object#object_id`) is no longer its physical address represented using Ruby level integers. It is now a monotonic-increasing integer unrelated to the underlying memory arrangement. Object IDs are assigned when necessary; objects are born without one, and will eventually have such property when queried. The interpreter has to manage which one is which. This is the flag that helps the management. Objects with this flag set are the ones with object IDs assigned.
RUBY_FL_EXIVAR | This flag has something to do with instance variables. 3rd parties need not know, but there are several ways to store an object's instance variables. Objects with this flag use so-called "generic" backend storage. This distinction is purely an implementation detail. People need not be aware of this working behind-the-scene.
RUBY_FL_FREEZE | This flag has something to do with data immutability. When this flag is set an object is considered "frozen". No modification are expected to happen beyond that point for the particular object. Immutability is basically considered to be a good property these days. Library authors are expected to obey. Test this bit before you touch a data structure. See also rb_check_frozen()
RUBY_FL_USER0 | User-defined flag.
RUBY_FL_USER1 | User-defined flag.
RUBY_FL_USER2 | User-defined flag.
RUBY_FL_USER3 | User-defined flag.
RUBY_FL_USER4 | User-defined flag.
RUBY_FL_USER5 | User-defined flag.
RUBY_FL_USER6 | User-defined flag.
RUBY_FL_USER7 | User-defined flag.
RUBY_FL_USER8 | User-defined flag.
RUBY_FL_USER9 | User-defined flag.
RUBY_FL_USER10 | User-defined flag.
RUBY_FL_USER11 | User-defined flag.
RUBY_FL_USER12 | User-defined flag.
RUBY_FL_USER13 | User-defined flag.
RUBY_FL_USER14 | User-defined flag.
RUBY_FL_USER15 | User-defined flag.
RUBY_FL_USER16 | User-defined flag.
RUBY_FL_USER17 | User-defined flag.
RUBY_FL_USER18 | User-defined flag.
RUBY_FL_USER19 | User-defined flag.
RUBY_ELTS_SHARED | This flag has something to do with data structures. Over time, ruby evolved to reduce memory footprints. One of such attempt is so-called copy-on-write, which delays duplication of resources until ultimately necessary. Some data structures share this scheme. For example multiple instances of struct RArray could point identical memory region in common, as long as they don't differ. As people favour immutable style of programming than before, this situation is getting more and more common. Because such "shared" memory regions have nuanced ownership by nature, each structures need special care for them. This flag is used to distinguish such shared constructs.
RUBY_FL_SINGLETON | This flag has something to do with an object's class. There are kind of classes called "singleton class", each of which have exactly one instance. What is interesting about singleton classes is that they are created after their instance were instantiated, like this: foo = Object.new # foo is an instance of Object... bar = foo.singleton_class # foo is now an instance of bar. Here as you see `bar` is a singleton class of `foo`, which is injected into `foo`'s inheritance tree in a different statement (== distinct sequence point). In order to achieve this property singleton classes are special-cased in the interpreter. There is one bit flag that distinguishes if a class is a singleton class or not, and this is it.

Definition at line 191 of file fl_type.h.

## ◆ ruby_fl_ushift

enum ruby_fl_ushift

This is an enum because GDB wants it (rather than a macro).

People need not bother.

Enumerator
RUBY_FL_USHIFT | Number of bits in ruby_fl_type that are not open to users. This is an implementation detail. Please ignore.

Definition at line 162 of file fl_type.h.

## Function Documentation

## ◆ RB_FL_ABLE()

static bool RB_FL_ABLE | ( | VALUE | obj | ) |
| static

Checks if the object is flaggable.

There are some special cases (most notably RUBY_Qfalse) where appending a flag to an object is not possible. This function can detect that.

Parameters

  [in] | obj | Object in question

Return values

  true | It is flaggable.
  false | No it isn't.

Definition at line 476 of file fl_type.h.

Referenced by RB_FL_REVERSE(), RB_FL_REVERSE_RAW(), RB_FL_SET(), RB_FL_SET_RAW(), RB_FL_TEST(), RB_FL_TEST_RAW(), RB_FL_UNSET(), RB_FL_UNSET_RAW(), rb_obj_freeze_inline(), RB_OBJ_FROZEN(), RB_OBJ_PROMOTED(), and RB_OBJ_PROMOTED_RAW().

## ◆ RB_FL_ALL()

static bool RB_FL_ALL | ( | VALUE | obj,
|  | VALUE | flags )
| inlinestatic

Identical to RB_FL_ANY(), except it mandates all passed flags be set.

Parameters

  [in] | obj | Object in question.
  [in] | flags | A set of enum ruby_fl_type.

Return values

  true | The object has all of the flags set.
  false | The object lacks any of the flags.

Definition at line 600 of file fl_type.h.

## ◆ RB_FL_ALL_RAW()

static bool RB_FL_ALL_RAW | ( | VALUE | obj,
|  | VALUE | flags )
| inlinestatic

This is an implenentation detail of RB_FL_ALL().

3rd parties need not use this. Just always use RB_FL_ALL().

Parameters

  [in] | obj | Object in question.
  [in] | flags | A set of enum ruby_fl_type.

Return values

  true | The object has all of the flags set.
  false | The object lacks any of the flags.

Precondition
  The object must not be an enum ruby_special_consts.

Definition at line 584 of file fl_type.h.

## ◆ RB_FL_ANY()

static bool RB_FL_ANY | ( | VALUE | obj,
|  | VALUE | flags )
| inlinestatic

Identical to RB_FL_TEST(), except it returns bool.

Parameters

  [in] | obj | Object in question.
  [in] | flags | A set of enum ruby_fl_type.

Return values

  true | The object has any of the flags set.
  false | No it doesn't at all.

Definition at line 566 of file fl_type.h.

## ◆ RB_FL_ANY_RAW()

static bool RB_FL_ANY_RAW | ( | VALUE | obj,
|  | VALUE | flags )
| inlinestatic

This is an implenentation detail of RB_FL_ANY().

3rd parties need not use this. Just always use RB_FL_ANY().

Parameters

  [in] | obj | Object in question.
  [in] | flags | A set of enum ruby_fl_type.

Return values

  true | The object has any of the flags set.
  false | No it doesn't at all.

Precondition
  The object must not be an enum ruby_special_consts.

Definition at line 550 of file fl_type.h.

Referenced by RARRAY_EMBED_LEN(), RARRAY_TRANSIENT_P(), rb_array_len(), RB_OBJ_PROMOTED_RAW(), ROBJECT_IVPTR(), and RSTRING_EMBED_LEN().

## ◆ RB_FL_REVERSE()

static void RB_FL_REVERSE | ( | VALUE | obj,
|  | VALUE | flags )
| inlinestatic

Reverses the flags.

This function is here mainly for symmetry on set/unset. Rarely used in practice.

Parameters

  [out] | obj | Object in question.
  [in] | flags | A set of enum ruby_fl_type.

Postcondition
  `obj` has `flags` reversed.

Definition at line 769 of file fl_type.h.

## ◆ RB_FL_REVERSE_RAW()

static void RB_FL_REVERSE_RAW | ( | VALUE | obj,
|  | VALUE | flags )
| inlinestatic

This is an implenentation detail of RB_FL_REVERSE().

3rd parties need not use this. Just always use RB_FL_REVERSE().

Parameters

  [out] | obj | Object in question.
  [in] | flags | A set of enum ruby_fl_type.

Postcondition
  `obj` has `flags` cleared.

Definition at line 753 of file fl_type.h.

Referenced by RB_FL_REVERSE().

## ◆ RB_FL_SET()

static void RB_FL_SET | ( | VALUE | obj,
|  | VALUE | flags )
| inlinestatic

Sets the given flag(s).

auto v = rb_eval_string("...");
RB_FL_SET(v, RUBY_FL_FREEZE);
RB_FL_SET
static void RB_FL_SET(VALUE obj, VALUE flags)
Sets the given flag(s).
Definition fl_type.h:658
RUBY_FL_FREEZE
@ RUBY_FL_FREEZE
This flag has something to do with data immutability.
Definition fl_type.h:356
rb_eval_string
VALUE rb_eval_string(const char *str)
Evaluates the given string.
Definition vm_eval.c:1848

Parameters

  [out] | obj | Object in question.
  [in] | flags | A set of enum ruby_fl_type.

Postcondition
  `obj` has `flags` set.

Definition at line 658 of file fl_type.h.

## ◆ RB_FL_SET_RAW()

static void RB_FL_SET_RAW | ( | VALUE | obj,
|  | VALUE | flags )
| inlinestatic

This is an implenentation detail of RB_FL_SET().

3rd parties need not use this. Just always use RB_FL_SET().

Parameters

  [out] | obj | Object in question.
  [in] | flags | A set of enum ruby_fl_type.

Postcondition
  `obj` has `flags` set.

Definition at line 638 of file fl_type.h.

Referenced by RB_ENC_CODERANGE_SET(), RB_ENCODING_SET_INLINED(), RB_FL_SET(), and RB_OBJ_FREEZE_RAW().

## ◆ RB_FL_TEST()

static VALUE RB_FL_TEST | ( | VALUE | obj,
|  | VALUE | flags )
| inlinestatic

Tests if the given flag(s) are set or not.

You can pass multiple flags at once:

auto obj = rb_eval_string("...");
if (RB_FL_TEST(obj, RUBY_FL_FREEZE | RUBY_FL_SHAREABLE)) {
printf("Ractor ready!\n");
}
RB_FL_TEST
static VALUE RB_FL_TEST(VALUE obj, VALUE flags)
Tests if the given flag(s) are set or not.
Definition fl_type.h:527
RUBY_FL_SHAREABLE
@ RUBY_FL_SHAREABLE
This flag has something to do with Ractor.
Definition fl_type.h:298

Parameters

  [in] | obj | Object in question.
  [in] | flags | A set of enum ruby_fl_type.

Returns
  `obj`'s flags, masked by `flags`.

Note
  It is intentional for this function to return VALUE. The return value could be passed to RB_FL_STE() etc.

Definition at line 527 of file fl_type.h.

Referenced by RB_FL_ALL(), and RB_FL_ANY().

## ◆ RB_FL_TEST_RAW()

static VALUE RB_FL_TEST_RAW | ( | VALUE | obj,
|  | VALUE | flags )
| inlinestatic

This is an implenentation detail of RB_FL_TEST().

3rd parties need not use this. Just always use RB_FL_TEST().

Parameters

  [in] | obj | Object in question.
  [in] | flags | A set of enum ruby_fl_type.

Precondition
  The object must not be an enum ruby_special_consts.

Returns
  `obj`'s flags, masked by `flags`.

Definition at line 501 of file fl_type.h.

Referenced by RB_ENC_CODERANGE(), RB_ENCODING_GET_INLINED(), RB_FL_ALL_RAW(), RB_FL_ANY_RAW(), RB_FL_TEST(), and RB_OBJ_FROZEN_RAW().

## ◆ RB_FL_UNSET()

static void RB_FL_UNSET | ( | VALUE | obj,
|  | VALUE | flags )
| inlinestatic

Clears the given flag(s).

Parameters

  [out] | obj | Object in question.
  [in] | flags | A set of enum ruby_fl_type.

Postcondition
  `obj` has `flags` cleard.

Definition at line 713 of file fl_type.h.

## ◆ RB_FL_UNSET_RAW()

static void RB_FL_UNSET_RAW | ( | VALUE | obj,
|  | VALUE | flags )
| inlinestatic

This is an implenentation detail of RB_FL_UNSET().

3rd parties need not use this. Just always use RB_FL_UNSET().

Parameters

  [out] | obj | Object in question.
  [in] | flags | A set of enum ruby_fl_type.

Postcondition
  `obj` has `flags` cleared.

Definition at line 698 of file fl_type.h.

Referenced by RB_ENC_CODERANGE_CLEAR(), RB_ENC_CODERANGE_SET(), RB_ENCODING_SET_INLINED(), and RB_FL_UNSET().

## ◆ rb_obj_freeze_inline()

void rb_obj_freeze_inline | ( | VALUE | x | ) |

Prevents further modifications to the given object.

rb_eFrozenError shall be raised if modification is attempted.

Parameters

  [out] | x | Object in question.

Definition at line 1569 of file variable.c.

## ◆ RB_OBJ_FREEZE_RAW()

static void RB_OBJ_FREEZE_RAW | ( | VALUE | obj | ) |
| inlinestatic

This is an implenentation detail of RB_OBJ_FREEZE().

3rd parties need not use this. Just always use RB_OBJ_FREEZE().

Parameters

  [out] | obj | Object in question.

Definition at line 939 of file fl_type.h.

Referenced by rb_obj_freeze_inline().

## ◆ RB_OBJ_FROZEN()

static bool RB_OBJ_FROZEN | ( | VALUE | obj | ) |
| inlinestatic

Checks if an object is frozen.

Parameters

  [in] | obj | Object in question.

Return values

  true | Yes it is.
  false | No it isn't.

Definition at line 921 of file fl_type.h.

Referenced by rb_check_frozen_inline().

## ◆ RB_OBJ_FROZEN_RAW()

static VALUE RB_OBJ_FROZEN_RAW | ( | VALUE | obj | ) |
| inlinestatic

This is an implenentation detail of RB_OBJ_FROZEN().

3rd parties need not use this. Just always use RB_OBJ_FROZEN().

Parameters

  [in] | obj | Object in question.

Return values

  RUBY_FL_FREEZE | Yes it is.
  0 | No it isn't.

Definition at line 906 of file fl_type.h.

Referenced by RB_OBJ_FROZEN().

## ◆ RB_OBJ_INFECT()

static void RB_OBJ_INFECT | ( | VALUE | dst,
|  | VALUE | src )
| inlinestatic

Deprecated
  This function once was a thing in the old days, but makes no sense any longer today. Exists here for backwards compatibility only. You can safely forget about it.

Parameters

  [in] | dst | Victim object.
  [in] | src | Infectant object.

Definition at line 884 of file fl_type.h.

## ◆ RB_OBJ_INFECT_RAW()

static void RB_OBJ_INFECT_RAW | ( | VALUE | dst,
|  | VALUE | src )
| inlinestatic

Deprecated
  This function once was a thing in the old days, but makes no sense any longer today. Exists here for backwards compatibility only. You can safely forget about it.

Parameters

  [in] | dst | Victim object.
  [in] | src | Infectant object.

Definition at line 868 of file fl_type.h.

## ◆ RB_OBJ_TAINT()

static void RB_OBJ_TAINT | ( | VALUE | obj | ) |
| inlinestatic

Deprecated
  This function once was a thing in the old days, but makes no sense any longer today. Exists here for backwards compatibility only. You can safely forget about it.

Parameters

  [in] | obj | Object in question.

Definition at line 852 of file fl_type.h.

## ◆ RB_OBJ_TAINT_RAW()

static void RB_OBJ_TAINT_RAW | ( | VALUE | obj | ) |
| inlinestatic

Deprecated
  This function once was a thing in the old days, but makes no sense any longer today. Exists here for backwards compatibility only. You can safely forget about it.

Parameters

  [in] | obj | Object in question.

Definition at line 837 of file fl_type.h.

## ◆ RB_OBJ_TAINTABLE()

static bool RB_OBJ_TAINTABLE | ( | VALUE | obj | ) |
| inlinestatic

Deprecated
  This function once was a thing in the old days, but makes no sense any longer today. Exists here for backwards compatibility only. You can safely forget about it.

Parameters

  [in] | obj | Object in question.

Returns
  false always.

Definition at line 788 of file fl_type.h.

## ◆ RB_OBJ_TAINTED()

static bool RB_OBJ_TAINTED | ( | VALUE | obj | ) |
| inlinestatic

Deprecated
  This function once was a thing in the old days, but makes no sense any longer today. Exists here for backwards compatibility only. You can safely forget about it.

Parameters

  [in] | obj | Object in question.

Returns
  false always.

Definition at line 822 of file fl_type.h.

## ◆ RB_OBJ_TAINTED_RAW()

static VALUE RB_OBJ_TAINTED_RAW | ( | VALUE | obj | ) |
| inlinestatic

Deprecated
  This function once was a thing in the old days, but makes no sense any longer today. Exists here for backwards compatibility only. You can safely forget about it.

Parameters

  [in] | obj | Object in question.

Returns
  false always.

Definition at line 805 of file fl_type.h.