1#ifndef INTERNAL_OBJECT_H
2#define INTERNAL_OBJECT_H
11#include "internal/basic_operators.h"
12#include "internal/string.h"
13#include "internal/vm.h"
19VALUE rb_class_allocate_instance_capa(
VALUE klass, uint8_t max_iv_count);
21NORETURN(
void rb_undefined_alloc(
VALUE klass));
22double rb_num_to_dbl(
VALUE val);
27VALUE rb_check_convert_type_with_id_slow(
VALUE,
int,
const char*,
ID);
28int rb_bool_expected(
VALUE,
const char *,
int raise);
31rb_check_convert_type_with_id(
VALUE val,
int type,
const char *tname,
ID method)
34 return rb_check_convert_type_with_id_slow(val,
type, tname, method);
36static inline void RBASIC_CLEAR_CLASS(
VALUE obj);
37static inline void RBASIC_SET_CLASS_RAW(
VALUE obj,
VALUE klass);
38static inline void RBASIC_SET_CLASS(
VALUE obj,
VALUE klass);
40RUBY_SYMBOL_EXPORT_BEGIN
42int rb_opts_exception_p(
VALUE opts,
int default_value);
50VALUE rb_convert_type_with_id(
VALUE v,
int t,
const char* nam,
ID mid);
58 *(
VALUE *)ptr = klass;
62RBASIC_CLEAR_CLASS(
VALUE obj)
64 RBASIC_SET_CLASS_RAW(obj, 0);
71 RBASIC_SET_CLASS_RAW(obj, klass);
76ROBJECT_SET_EXTENDED(
VALUE obj,
VALUE fields_obj)
84rb_obj_embedded_size(uint32_t fields_count)
86 size_t size = offsetof(
struct RObject, as.ary) + (
sizeof(
VALUE) * fields_count);
93opt_equality_specialized_miss(
VALUE recv,
VALUE obj)
96 if (BASIC_OP_UNREDEFINED_P(BOP_EQ, ANY_REDEFINED_OP_FLAG)) {
113 return rb_str_eql_internal(recv, obj);
126 if (obj1 == obj2)
return Qtrue;
128 VALUE result = opt_equality_specialized_miss(obj1, obj2);
129 if (UNDEF_P(result)) {
130 result = rb_equal_opt(obj1, obj2);
135#define rb_equal rb_equal_inline
140 if (obj1 == obj2)
return TRUE;
142 VALUE result = opt_equality_specialized_miss(obj1, obj2);
143 if (UNDEF_P(result)) {
144 result = rb_eql_opt(obj1, obj2);
146 return RTEST(result);
149#define rb_eql rb_eql_inline
#define T_STRING
Old name of RUBY_T_STRING.
#define Qundef
Old name of RUBY_Qundef.
#define T_IMEMO
Old name of RUBY_T_IMEMO.
#define SPECIAL_CONST_P
Old name of RB_SPECIAL_CONST_P.
#define T_DATA
Old name of RUBY_T_DATA.
#define FLONUM_P
Old name of RB_FLONUM_P.
#define Qtrue
Old name of RUBY_Qtrue.
#define Qfalse
Old name of RUBY_Qfalse.
#define T_OBJECT
Old name of RUBY_T_OBJECT.
#define IMMEDIATE_P
Old name of RB_IMMEDIATE_P.
#define FIXNUM_P
Old name of RB_FIXNUM_P.
VALUE rb_cSymbol
Symbol class.
VALUE rb_cString
String class.
#define RB_OBJ_WRITTEN(old, oldv, young)
Identical to RB_OBJ_WRITE(), except it doesn't write any values, but only a WB declaration.
#define RB_OBJ_WRITE(old, slot, young)
Declaration of a "back" pointer.
#define RBIMPL_ASSERT_OR_ASSUME(...)
This is either RUBY_ASSERT or RBIMPL_ASSUME, depending on RUBY_DEBUG.
#define RUBY_ASSERT(...)
Asserts that the given expression is truthy if and only if RUBY_DEBUG is truthy.
VALUE type(ANYARGS)
ANYARGS-ed function type.
static VALUE RBASIC_CLASS(VALUE obj)
Queries the class of an object.
#define RBASIC(obj)
Convenient casting macro.
#define ROBJECT(obj)
Convenient casting macro.
#define RTEST
This is an old name of RB_TEST.
uintptr_t ID
Type that represents a Ruby identifier such as a variable name.
uintptr_t VALUE
Type that represents a Ruby object.
static bool RB_TYPE_P(VALUE obj, enum ruby_value_type t)
Queries if the given object is of given type.