mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:🎏: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
This commit is contained in:
parent
0455a25541
commit
e5e37c20c9
2 changed files with 15 additions and 7 deletions
|
@ -1,3 +1,12 @@
|
|||
Fri Jan 8 17:07:14 2016 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* 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.
|
||||
|
||||
Fri Jan 8 12:30:54 2016 Shugo Maeda <shugo@ruby-lang.org>
|
||||
|
||||
* tool/make-snapshot: fix for the changes of version.h in r53314.
|
||||
|
|
13
gc.c
13
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;
|
||||
|
|
Loading…
Reference in a new issue