From 673234cb910923d41badca51b383e3188f375691 Mon Sep 17 00:00:00 2001 From: Juho Snellman Date: Sun, 6 Nov 2005 02:59:06 +0000 Subject: [PATCH] 0.9.6.23: Batch mprotect calls in write_protect_generation_pages, instead of doing individual calls for each 4096 byte page (faster startup). --- src/runtime/gencgc.c | 33 +++++++++++++++++++++++---------- version.lisp-expr | 2 +- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/runtime/gencgc.c b/src/runtime/gencgc.c index 2e7707a..d39bf9b 100644 --- a/src/runtime/gencgc.c +++ b/src/runtime/gencgc.c @@ -3503,26 +3503,39 @@ verify_dynamic_space(void) static void write_protect_generation_pages(generation_index_t generation) { - page_index_t i; + page_index_t start; gc_assert(generation < SCRATCH_GENERATION); - for (i = 0; i < last_free_page; i++) - if ((page_table[i].allocated == BOXED_PAGE_FLAG) - && (page_table[i].bytes_used != 0) - && !page_table[i].dont_move - && (page_table[i].gen == generation)) { + for (start = 0; start < last_free_page; start++) { + if ((page_table[start].allocated == BOXED_PAGE_FLAG) + && (page_table[start].bytes_used != 0) + && !page_table[start].dont_move + && (page_table[start].gen == generation)) { void *page_start; + page_index_t last; - page_start = (void *)page_address(i); + /* Note the page as protected in the page tables. */ + page_table[start].write_protected = 1; + + for (last = start + 1; last < last_free_page; last++) { + if ((page_table[last].allocated != BOXED_PAGE_FLAG) + || (page_table[last].bytes_used == 0) + || page_table[last].dont_move + || (page_table[last].gen != generation)) + break; + page_table[last].write_protected = 1; + } + + page_start = (void *)page_address(start); os_protect(page_start, - PAGE_BYTES, + PAGE_BYTES * (last - start), OS_VM_PROT_READ | OS_VM_PROT_EXECUTE); - /* Note the page as protected in the page tables. */ - page_table[i].write_protected = 1; + start = last; } + } if (gencgc_verbose > 1) { FSHOW((stderr, diff --git a/version.lisp-expr b/version.lisp-expr index c998555..a267a31 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.6.22" +"0.9.6.23" -- 1.7.10.4