summaryrefslogtreecommitdiff
path: root/internal/object.h
diff options
context:
space:
mode:
Diffstat (limited to 'internal/object.h')
-rw-r--r--internal/object.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/internal/object.h b/internal/object.h
index 06595bdd91..99aa1f524b 100644
--- a/internal/object.h
+++ b/internal/object.h
@@ -11,11 +11,14 @@
#include "ruby/ruby.h" /* for VALUE */
/* object.c */
-size_t rb_obj_embedded_size(uint32_t numiv);
+
+VALUE rb_class_allocate_instance(VALUE klass);
VALUE rb_class_search_ancestor(VALUE klass, VALUE super);
NORETURN(void rb_undefined_alloc(VALUE klass));
double rb_num_to_dbl(VALUE val);
VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound);
+VALUE rb_obj_clone_setup(VALUE obj, VALUE clone, VALUE kwfreeze);
+VALUE rb_obj_dup_setup(VALUE obj, VALUE dup);
VALUE rb_immutable_obj_clone(int, VALUE *, VALUE);
VALUE rb_check_convert_type_with_id(VALUE,int,const char*,ID);
int rb_bool_expected(VALUE, const char *, int raise);
@@ -57,4 +60,13 @@ RBASIC_SET_CLASS(VALUE obj, VALUE klass)
RBASIC_SET_CLASS_RAW(obj, klass);
RB_OBJ_WRITTEN(obj, oldv, klass);
}
+
+static inline size_t
+rb_obj_embedded_size(uint32_t fields_count)
+{
+ size_t size = offsetof(struct RObject, as.ary) + (sizeof(VALUE) * fields_count);
+ // Ensure enough room for the heap pointer if this expands
+ if (size < sizeof(struct RObject)) size = sizeof(struct RObject);
+ return size;
+}
#endif /* INTERNAL_OBJECT_H */