mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
should be initialize jit_unit->cc_entries.
GC can invoke just after allocation of jit_unit->cc_entries so it should be zero-cleared.
This commit is contained in:
parent
670b7be6c5
commit
84d1a99a3f
3 changed files with 5 additions and 3 deletions
4
iseq.c
4
iseq.c
|
@ -363,7 +363,9 @@ rb_iseq_mark(const rb_iseq_t *iseq)
|
||||||
// TODO: move to mjit.c?
|
// TODO: move to mjit.c?
|
||||||
for (unsigned int i=0; i<body->ci_size; i++) {
|
for (unsigned int i=0; i<body->ci_size; i++) {
|
||||||
const struct rb_callcache *cc = body->jit_unit->cc_entries[i];
|
const struct rb_callcache *cc = body->jit_unit->cc_entries[i];
|
||||||
rb_gc_mark((VALUE)cc); // pindown
|
if (cc != NULL) {
|
||||||
|
rb_gc_mark((VALUE)cc); // pindown
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
2
mjit.c
2
mjit.c
|
@ -295,7 +295,7 @@ create_unit(const rb_iseq_t *iseq)
|
||||||
unit->id = current_unit_num++;
|
unit->id = current_unit_num++;
|
||||||
unit->iseq = (rb_iseq_t *)iseq;
|
unit->iseq = (rb_iseq_t *)iseq;
|
||||||
if (iseq->body->ci_size > 0) {
|
if (iseq->body->ci_size > 0) {
|
||||||
unit->cc_entries = ALLOC_N(const struct rb_callcache *, iseq->body->ci_size);
|
unit->cc_entries = ZALLOC_N(const struct rb_callcache *, iseq->body->ci_size);
|
||||||
}
|
}
|
||||||
iseq->body->jit_unit = unit;
|
iseq->body->jit_unit = unit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1141,7 +1141,7 @@ mjit_copy_cache_from_main_thread(const rb_iseq_t *iseq, union iseq_inline_storag
|
||||||
if (iseq->body->jit_unit == NULL) rb_fatal("malloc failed");
|
if (iseq->body->jit_unit == NULL) rb_fatal("malloc failed");
|
||||||
if (iseq->body->ci_size > 0) {
|
if (iseq->body->ci_size > 0) {
|
||||||
iseq->body->jit_unit->cc_entries =
|
iseq->body->jit_unit->cc_entries =
|
||||||
(const struct rb_callcache **)malloc(sizeof(const struct rb_callcache *) * iseq->body->ci_size);
|
(const struct rb_callcache **)calloc(iseq->body->ci_size, sizeof(const struct rb_callcache *));
|
||||||
if (iseq->body->jit_unit->cc_entries == NULL) rb_fatal("malloc failed");
|
if (iseq->body->jit_unit->cc_entries == NULL) rb_fatal("malloc failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue