Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -12167,7 +12167,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
case TS_CDHASH:
{
int i;
VALUE map = rb_hash_alloc_fixed_size(Qfalse, RARRAY_LEN(op)/2);
VALUE map = rb_hash_new_with_size(RARRAY_LEN(op)/2);

RHASH_TBL_RAW(map)->type = &cdhash_type;
op = rb_to_array_type(op);
Expand All @@ -12179,7 +12179,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *const anchor,
rb_hash_aset(map, key, (VALUE)label | 1);
}
RB_GC_GUARD(op);
RB_OBJ_SET_SHAREABLE(map); // allow mutation while compiling
RB_OBJ_SET_SHAREABLE(rb_obj_hide(map)); // allow mutation while compiling
argv[j] = map;
RB_OBJ_WRITTEN(iseq, Qundef, map);
}
Expand Down
3 changes: 3 additions & 0 deletions hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ RHASH_AR_TABLE_SIZE_DEC(VALUE h)
static inline void
RHASH_AR_TABLE_CLEAR(VALUE h)
{
RUBY_ASSERT(rb_gc_obj_slot_size(h) >= sizeof(struct RHash) + sizeof(ar_table));
RBASIC(h)->flags &= ~RHASH_AR_TABLE_SIZE_MASK;
RBASIC(h)->flags &= ~RHASH_AR_TABLE_BOUND_MASK;

Expand Down Expand Up @@ -719,6 +720,8 @@ ar_force_convert_table(VALUE hash, const char *file, int line)
st_hash_t hashes[RHASH_AR_TABLE_MAX_SIZE];
unsigned int bound, size;

RUBY_ASSERT(rb_gc_obj_slot_size(hash) >= sizeof(struct RHash) + sizeof(ar_table));

// prepare hash values
do {
st_data_t keys[RHASH_AR_TABLE_MAX_SIZE];
Expand Down
8 changes: 4 additions & 4 deletions internal/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ RBASIC_SET_CLASS(VALUE obj, VALUE klass)
static inline size_t
rb_obj_embedded_size(uint32_t fields_count)
{
#if (defined(RACTOR_CHECK_MODE) && RACTOR_CHECK_MODE) || (defined(GC_DEBUG) && GC_DEBUG)
if (fields_count < 1) fields_count = 1;
#endif
return offsetof(struct RObject, as.ary) + (sizeof(VALUE) * 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 */
6 changes: 4 additions & 2 deletions zjit/src/hir_type/gen_hir_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def base_type name, c_name: nil
[type, exact]
end

# Define a new type that cannot be subclassed.
# Define a new type that has no subclasses and cannot be subclassed.
# If c_name is given, mark the rb_cXYZ object as equivalent to this type.
def final_type name, base: $object, c_name: nil
if c_name
Expand All @@ -109,7 +109,9 @@ def final_type name, base: $object, c_name: nil
base_type "Set", c_name: "rb_cSet"
base_type "Regexp", c_name: "rb_cRegexp"
module_class, _ = base_type "Module", c_name: "rb_cModule"
class_ = final_type "Class", base: module_class, c_name: "rb_cClass"
# Class cannot be subclassed by doing `class Sub < Class`,
# but every metaclass is a subclass of `Class`. It's not final.
module_class.subtype "Class"

numeric, _ = base_type "Numeric", c_name: "rb_cNumeric"

Expand Down
11 changes: 4 additions & 7 deletions zjit/src/hir_type/hir_type.inc.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.