Revert "add_heap_page should not be invoked in gc_alloc, but should be in obj_alloc"

This reverts commit f11623f075.
This commit is contained in:
Yuichi Nishiwaki 2013-11-27 13:04:03 +09:00
parent 4701f86ff0
commit 5e3f2dacf4
1 changed files with 4 additions and 6 deletions

View File

@ -139,7 +139,8 @@ gc_alloc(pic_state *pic, size_t size)
if (p->s.size >= nunits)
break;
if (p == freep) {
return NULL;
if ((p = add_heap_page(pic)) == NULL)
return NULL;
}
}
if (p->s.size == nunits) {
@ -493,11 +494,8 @@ pic_obj_alloc_unsafe(pic_state *pic, size_t size, enum pic_tt tt)
if (obj == NULL) {
pic_gc_run(pic);
obj = (struct pic_object *)gc_alloc(pic, size);
if (obj == NULL) {
if (add_heap_page(pic) == NULL)
pic_abort(pic, "GC memory exhausted");
obj = (struct pic_object *)gc_alloc(pic, size);
}
if (obj == NULL)
pic_abort(pic, "GC memory exhausted");
}
obj->tt = tt;