* gc.c (heap_get_freeobj): improve hot path performance.

* gc.c (heap_get_freeobj_from_next_freepage): replace with
  heap_get_freepage(). It returns freeobj instead of freepage.
  This is not on hot path.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2013-12-19 05:04:55 +00:00
Родитель f8bcd57cb7
Коммит 0a8c1142b0
2 изменённых файлов: 24 добавлений и 11 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Thu Dec 19 14:03:04 2013 Koichi Sasada <ko1@atdot.net>
* gc.c (heap_get_freeobj): improve hot path performance.
* gc.c (heap_get_freeobj_from_next_freepage): replace with
heap_get_freepage(). It returns freeobj instead of freepage.
This is not on hot path.
Thu Dec 19 12:05:17 2013 Eric Hodel <drbrain@segment7.net>
* lib/rubygems: Update to RubyGems master af60443. Changes include:

27
gc.c
Просмотреть файл

@ -1218,18 +1218,23 @@ heap_prepare_freepage(rb_objspace_t *objspace, rb_heap_t *heap)
return heap->free_pages;
}
static inline struct heap_page *
heap_get_freepage(rb_objspace_t *objspace, rb_heap_t *heap)
static RVALUE *
heap_get_freeobj_from_next_freepage(rb_objspace_t *objspace, rb_heap_t *heap)
{
struct heap_page *page;
RVALUE *p;
page = heap->free_pages;
while (page == NULL) {
page = heap_prepare_freepage(objspace, heap);
}
heap->free_pages = page->free_next;
heap->using_page = page;
return page;
p = page->freelist;
page->freelist = NULL;
return p;
}
static inline VALUE
@ -1237,15 +1242,15 @@ heap_get_freeobj(rb_objspace_t *objspace, rb_heap_t *heap)
{
RVALUE *p = heap->freelist;
while (UNLIKELY(p == NULL)) {
struct heap_page *page = heap_get_freepage(objspace, heap);
heap->using_page = page;
p = page->freelist;
page->freelist = NULL;
while (1) {
if (p) {
heap->freelist = p->as.free.next;
return (VALUE)p;
}
else {
p = heap_get_freeobj_from_next_freepage(objspace, heap);
}
}
heap->freelist = p->as.free.next;
return (VALUE)p;
}
void