aboutsummaryrefslogtreecommitdiffstats
path: root/gc.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-08 08:23:58 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-08 08:23:58 +0000
commitd99957877d1dbe70922fb26914f55dc09e4e7de2 (patch)
treeae4309b40dea541b242ddec2bcbcb210c4af9f62 /gc.c
parent7d9054e2d315a5f3fdcb0fac4bc639e485bf835a (diff)
downloadruby-d99957877d1dbe70922fb26914f55dc09e4e7de2.tar.gz
* gc.c: remove heap_page::heap. This field is only used to recognize
whether a page is in a tomb or not. Instead of this field, heap_page::flags::in_tomb (1 bit field) is added. Also type of heap_page::(total|free|final)_slots are changed from int to short. 2B is enough for them. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/gc.c b/gc.c
index 97f3ebad70..45940560d0 100644
--- a/gc.c
+++ b/gc.c
@@ -644,14 +644,14 @@ enum {
struct heap_page {
struct heap_page_body *body;
struct heap_page *prev;
- rb_heap_t *heap;
- int total_slots;
- int free_slots;
- int final_slots;
+ short total_slots;
+ short free_slots;
+ short final_slots;
struct {
unsigned int before_sweep : 1;
unsigned int has_remembered_objects : 1;
unsigned int has_uncollectible_shady_objects : 1;
+ unsigned int in_tomb : 1;
} flags;
struct heap_page *free_next;
@@ -1390,7 +1390,6 @@ heap_unlink_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *pag
if (heap->pages == page) heap->pages = page->next;
page->prev = NULL;
page->next = NULL;
- page->heap = NULL;
heap->page_length--;
heap->total_slots -= page->total_slots;
}
@@ -1413,7 +1412,7 @@ heap_pages_free_unused_pages(rb_objspace_t *objspace)
for (i = j = 1; j < heap_allocated_pages; i++) {
struct heap_page *page = heap_pages_sorted[i];
- if (page->heap == heap_tomb && page->free_slots == page->total_slots) {
+ if (page->flags.in_tomb && page->free_slots == page->total_slots) {
if (heap_pages_swept_slots - page->total_slots > heap_pages_max_free_slots) {
if (0) fprintf(stderr, "heap_pages_free_unused_pages: %d free page %p, heap_pages_swept_slots: %d, heap_pages_max_free_slots: %d\n",
(int)i, page, (int)heap_pages_swept_slots, (int)heap_pages_max_free_slots);
@@ -1542,7 +1541,7 @@ heap_page_create(rb_objspace_t *objspace)
static void
heap_add_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
{
- page->heap = heap;
+ page->flags.in_tomb = (heap == heap_tomb);
page->next = heap->pages;
if (heap->pages) heap->pages->prev = page;
heap->pages = page;