Author: Remi Meier <remi.me...@inf.ethz.ch> Branch: Changeset: r1633:dbbeeda92d3e Date: 2015-02-18 10:30 +0100 http://bitbucket.org/pypy/stmgc/changeset/dbbeeda92d3e/
Log: fix to make small old objs survive major gc diff --git a/c8/stm/core.c b/c8/stm/core.c --- a/c8/stm/core.c +++ b/c8/stm/core.c @@ -228,14 +228,14 @@ addr >= stm_object_pages+TOTAL_MEMORY) { /* actual segfault, unrelated to stmgc */ fprintf(stderr, "Segmentation fault: accessing %p\n", addr); - abort(); + raise(SIGINT); } int segnum = get_segment_of_linear_address(addr); if (segnum != STM_SEGMENT->segment_num) { fprintf(stderr, "Segmentation fault: accessing %p (seg %d) from" " seg %d\n", addr, segnum, STM_SEGMENT->segment_num); - abort(); + raise(SIGINT); } dprintf(("-> segment: %d\n", segnum)); @@ -244,7 +244,7 @@ if (pagenum < END_NURSERY_PAGE) { fprintf(stderr, "Segmentation fault: accessing %p (seg %d " "page %lu)\n", addr, segnum, pagenum); - abort(); + raise(SIGINT); } DEBUG_EXPECT_SEGFAULT(false); diff --git a/c8/stm/gcpage.c b/c8/stm/gcpage.c --- a/c8/stm/gcpage.c +++ b/c8/stm/gcpage.c @@ -2,7 +2,6 @@ # error "must be compiled via stmgc.c" #endif -static struct list_s *testing_prebuilt_objs = NULL; static struct tree_s *tree_prebuilt_objs = NULL; /* XXX refactor */ @@ -446,7 +445,7 @@ assert(realobj = (struct object_s*)REAL_ADDRESS(pseg->pub.segment_base, item)); assert(realobj->stm_flags & GCFLAG_WB_EXECUTED); - /* clear VISITED and ensure WB_EXECUTED in seg0 */ + /* clear VISITED (garbage) and ensure WB_EXECUTED in seg0 */ mark_visited_test_and_clear(item); realobj = (struct object_s*)REAL_ADDRESS(stm_object_pages, item); realobj->stm_flags |= GCFLAG_WB_EXECUTED; diff --git a/c8/stm/gcpage.h b/c8/stm/gcpage.h --- a/c8/stm/gcpage.h +++ b/c8/stm/gcpage.h @@ -8,7 +8,7 @@ #define GC_MAJOR_COLLECT 1.82 - +static struct list_s *testing_prebuilt_objs; static char *uninitialized_page_start; /* within segment 0 */ static char *uninitialized_page_stop; diff --git a/c8/stm/smallmalloc.c b/c8/stm/smallmalloc.c --- a/c8/stm/smallmalloc.c +++ b/c8/stm/smallmalloc.c @@ -196,6 +196,10 @@ memset(REAL_ADDRESS(STM_SEGMENT->segment_base, o), 0, size_rounded_up); o->stm_flags = GCFLAG_WRITE_BARRIER; + if (testing_prebuilt_objs == NULL) + testing_prebuilt_objs = list_create(); + LIST_APPEND(testing_prebuilt_objs, o); + dprintf(("_stm_allocate_old_small(%lu): %p, seg=%d, page=%lu\n", size_rounded_up, p, get_segment_of_linear_address(stm_object_pages + (uintptr_t)p), @@ -204,6 +208,7 @@ return o; } + /************************************************************/ static inline bool _smallmalloc_sweep_keep(char *p) diff --git a/c8/test/test_gcpage.py b/c8/test/test_gcpage.py --- a/c8/test/test_gcpage.py +++ b/c8/test/test_gcpage.py @@ -466,3 +466,10 @@ stm_major_collect() stm_major_collect() self.commit_transaction() + + def test_small_old_surives_major(self): + s = stm_allocate_old_small(16) + self.start_transaction() + stm_major_collect() + assert stm_get_char(s) == '\0' + self.commit_transaction() _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit