зеркало из https://github.com/github/ruby.git
mjit_worker.c: handle calloc failure
Unlike ZALLOC, it's not automatically handled. mjit.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
3c1f1c3348
Коммит
5cd84d247f
5
mjit.c
5
mjit.c
|
@ -291,6 +291,11 @@ mjit_add_iseq_to_process(const rb_iseq_t *iseq)
|
|||
return;
|
||||
|
||||
node = create_list_node(iseq->body->jit_unit);
|
||||
if (node == NULL) {
|
||||
mjit_warning("failed to allocate a node to be added to unit_queue");
|
||||
return;
|
||||
}
|
||||
|
||||
CRITICAL_SECTION_START(3, "in add_iseq_to_process");
|
||||
add_to_list(node, &unit_queue);
|
||||
if (active_units.length >= mjit_opts.max_cache_size) {
|
||||
|
|
|
@ -319,6 +319,7 @@ static struct rb_mjit_unit_node *
|
|||
create_list_node(struct rb_mjit_unit *unit)
|
||||
{
|
||||
struct rb_mjit_unit_node *node = (struct rb_mjit_unit_node *)calloc(1, sizeof(struct rb_mjit_unit_node)); /* To prevent GC, don't use ZALLOC */
|
||||
if (node == NULL) return NULL;
|
||||
node->unit = unit;
|
||||
return node;
|
||||
}
|
||||
|
@ -1116,6 +1117,11 @@ convert_unit_to_func(struct rb_mjit_unit *unit)
|
|||
|
||||
if ((uintptr_t)func > (uintptr_t)LAST_JIT_ISEQ_FUNC) {
|
||||
struct rb_mjit_unit_node *node = create_list_node(unit);
|
||||
if (node == NULL) {
|
||||
mjit_warning("failed to allocate a node to be added to active_units");
|
||||
return (mjit_func_t)NOT_COMPILED_JIT_ISEQ_FUNC;
|
||||
}
|
||||
|
||||
CRITICAL_SECTION_START(3, "end of jit");
|
||||
add_to_list(node, &active_units);
|
||||
if (unit->iseq)
|
||||
|
|
Загрузка…
Ссылка в новой задаче