Author: Remi Meier <remi.me...@inf.ethz.ch> Branch: c8-private-pages Changeset: r1539:3ae30d429859 Date: 2015-01-16 16:54 +0100 http://bitbucket.org/pypy/stmgc/changeset/3ae30d429859/
Log: fix for old-smallmalloced objs diff --git a/c8/stm/smallmalloc.c b/c8/stm/smallmalloc.c --- a/c8/stm/smallmalloc.c +++ b/c8/stm/smallmalloc.c @@ -183,7 +183,7 @@ memset(REAL_ADDRESS(STM_SEGMENT->segment_base, o), 0, size_rounded_up); o->stm_flags = GCFLAG_WRITE_BARRIER; - dprintf(("allocate_old_small(%lu): %p, seg=%d, page=%lu\n", + 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), (uintptr_t)p / 4096UL)); @@ -201,7 +201,7 @@ return _stm_smallmalloc_keep((char*)(p - stm_object_pages)); } #endif - abort(); + return true; //return smallmalloc_keep_object_at(p); } @@ -248,7 +248,6 @@ } else if (!_smallmalloc_sweep_keep(p)) { /* the location should be freed now */ - //dprintf(("free small obj %p\n", (object_t*)(p - stm_object_pages))); #ifdef STM_TESTS /* fill location with 0xdd in all segs except seg0 */ int j; @@ -258,6 +257,7 @@ if (get_page_status_in(j, page) == PAGE_ACCESSIBLE) memset(get_virtual_address(j, obj), 0xdd, szword*8); #endif + //dprintf(("free small %p : %lu\n", (char*)(p - stm_object_pages), szword*8)); if (flprev == NULL) { flprev = (struct small_free_loc_s *)p; @@ -273,6 +273,7 @@ any_object_dying = true; } else { + //dprintf(("keep small %p : %lu\n", (char*)(p - stm_object_pages), szword*8)); any_object_remaining = true; } } @@ -308,7 +309,8 @@ small_page_lists[szword] = NULL; /* process the pages that the various segments are busy filling */ - for (i = 1; i < NB_SEGMENTS; i++) { + /* including sharing seg0 for old-malloced things */ + for (i = 0; i < NB_SEGMENTS; i++) { struct stm_priv_segment_info_s *pseg = get_priv_segment(i); struct small_free_loc_s **fl = &pseg->small_malloc_data.loc_free[szword]; diff --git a/c8/test/test_smallmalloc.py b/c8/test/test_smallmalloc.py --- a/c8/test/test_smallmalloc.py +++ b/c8/test/test_smallmalloc.py @@ -51,7 +51,8 @@ # allocate a page's worth of objs page0 = [stm_allocate_old_small(16) for i in range(0, 4096, 16)] assert len(set(map(pageof, page0))) == 1, "all in the same page" - tid = lib._get_type_id(page0[0]) # 58 + tid = lib._get_type_id(page0[0]) + assert tid == 58, "current way to do it" # repeatedly free a subset until no objs are left in that page while len(page0) > 0: @@ -59,6 +60,8 @@ self.keep_me = set(random.sample(page0, len(page0) // 2)) self.has_been_asked_for = [] lib._stm_smallmalloc_sweep() + + print len(page0), len(self.has_been_asked_for) assert sorted(page0) == self.has_been_asked_for, "all objs were observed" # get list of objs that were not freed _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit