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
1 change: 1 addition & 0 deletions gc/default/default.c
Original file line number Diff line number Diff line change
Expand Up @@ -6044,6 +6044,7 @@ rb_gc_impl_writebarrier(void *objspace_ptr, VALUE a, VALUE b)

if (SPECIAL_CONST_P(b)) return;

GC_ASSERT(!during_gc);
GC_ASSERT(RB_BUILTIN_TYPE(a) != T_NONE);
GC_ASSERT(RB_BUILTIN_TYPE(a) != T_MOVED);
GC_ASSERT(RB_BUILTIN_TYPE(a) != T_ZOMBIE);
Expand Down
5 changes: 4 additions & 1 deletion struct.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,10 +834,13 @@ struct_alloc(VALUE klass)
else {
NEWOBJ_OF(st, struct RStruct, klass, flags, sizeof(struct RStruct), 0);

st->as.heap.ptr = NULL;
st->as.heap.fields_obj = 0;
st->as.heap.len = 0;

st->as.heap.ptr = struct_heap_alloc((VALUE)st, n);
rb_mem_clear((VALUE *)st->as.heap.ptr, n);
st->as.heap.len = n;
st->as.heap.fields_obj = 0;

return (VALUE)st;
}
Expand Down
3 changes: 2 additions & 1 deletion tool/lib/envutil.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ def invoke_ruby(args, stdin_data = "", capture_stdout = false, capture_stderr =

args = [args] if args.kind_of?(String)
# use the same parser as current ruby
if args.none? { |arg| arg.start_with?("--parser=") }
if (args.none? { |arg| arg.start_with?("--parser=") } and
/^ +--parser=/ =~ IO.popen([rubybin, "--help"], &:read))
args = ["--parser=#{current_parser}"] + args
end
pid = spawn(child_env, *precommand, rubybin, *args, opt)
Expand Down
15 changes: 11 additions & 4 deletions vm_insnhelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2120,8 +2120,9 @@ vm_evict_cc(VALUE klass, VALUE cc_tbl, ID mid)
return;
}

struct rb_class_cc_entries *ccs = NULL;
rb_managed_id_table_lookup(cc_tbl, mid, (VALUE *)&ccs);
VALUE ccs_obj = 0;
rb_managed_id_table_lookup(cc_tbl, mid, &ccs_obj);
struct rb_class_cc_entries *ccs = (struct rb_class_cc_entries *)ccs_obj;

if (!ccs || !METHOD_ENTRY_INVALIDATED(ccs->cme)) {
// Another ractor replaced that entry while we were waiting on the VM lock.
Expand Down Expand Up @@ -2182,7 +2183,11 @@ vm_populate_cc(VALUE klass, const struct rb_callinfo * const ci, ID mid)
if (ccs == NULL) {
VM_ASSERT(cc_tbl);

if (!LIKELY(rb_managed_id_table_lookup(cc_tbl, mid, (VALUE *)&ccs))) {
VALUE ccs_obj;
if (UNLIKELY(rb_managed_id_table_lookup(cc_tbl, mid, &ccs_obj))) {
ccs = (struct rb_class_cc_entries *)ccs_obj;
}
else {
// TODO: required?
ccs = vm_ccs_create(klass, cc_tbl, mid, cme);
}
Expand Down Expand Up @@ -2217,7 +2222,9 @@ vm_lookup_cc(const VALUE klass, const struct rb_callinfo * const ci, ID mid)
// CCS data is keyed on method id, so we don't need the method id
// for doing comparisons in the `for` loop below.

if (rb_managed_id_table_lookup(cc_tbl, mid, (VALUE *)&ccs)) {
VALUE ccs_obj;
if (rb_managed_id_table_lookup(cc_tbl, mid, &ccs_obj)) {
ccs = (struct rb_class_cc_entries *)ccs_obj;
const int ccs_len = ccs->len;

if (UNLIKELY(METHOD_ENTRY_INVALIDATED(ccs->cme))) {
Expand Down
5 changes: 3 additions & 2 deletions vm_method.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,9 @@ rb_vm_ccs_invalidate_and_free(struct rb_class_cc_entries *ccs)
void
rb_vm_cc_table_delete(VALUE table, ID mid)
{
struct rb_class_cc_entries *ccs;
if (rb_managed_id_table_lookup(table, mid, (VALUE *)&ccs)) {
VALUE ccs_obj;
if (rb_managed_id_table_lookup(table, mid, &ccs_obj)) {
struct rb_class_cc_entries *ccs = (struct rb_class_cc_entries *)ccs_obj;
rb_managed_id_table_delete(table, mid);
rb_vm_ccs_invalidate_and_free(ccs);
}
Expand Down
Loading