[pypy-commit] pypy stm-gc-2: Fixes
arigo
noreply at buildbot.pypy.org
Sat Apr 13 15:37:57 CEST 2013
Author: Armin Rigo <arigo at tunes.org>
Branch: stm-gc-2
Changeset: r63309:331f03eb4d9e
Date: 2013-04-13 15:35 +0200
http://bitbucket.org/pypy/pypy/changeset/331f03eb4d9e/
Log: Fixes
diff --git a/rpython/memory/gc/stmgc.py b/rpython/memory/gc/stmgc.py
--- a/rpython/memory/gc/stmgc.py
+++ b/rpython/memory/gc/stmgc.py
@@ -8,6 +8,7 @@
from rpython.rlib.debug import ll_assert, debug_start, debug_stop, fatalerror
from rpython.rlib.debug import debug_print
from rpython.rlib import rthread
+from rpython.memory.gc import stmshared
WORD = LONG_BIT // 8
@@ -160,18 +161,15 @@
'stm_operations': 'use_real_one',
'nursery_size': 32*1024*1024, # 32 MB
- #"page_size": 1024*WORD, # copied from minimark.py
- #"arena_size": 65536*WORD, # copied from minimark.py
- #"small_request_threshold": 35*WORD, # copied from minimark.py
+ "page_size": stmshared.TRANSLATED_PAGE_SIZE,
+ "small_request_threshold":stmshared.TRANSLATED_SMALL_REQUEST_THRESHOLD,
}
def __init__(self, config,
stm_operations='use_emulator',
nursery_size=1024,
- #page_size=16*WORD,
- #arena_size=64*WORD,
- #small_request_threshold=5*WORD,
- #ArenaCollectionClass=None,
+ page_size=14*WORD,
+ small_request_threshold=5*WORD,
**kwds):
MovingGCBase.__init__(self, config, multithread=True, **kwds)
#
@@ -182,11 +180,11 @@
from rpython.translator.stm.stmgcintf import StmOperations
stm_operations = StmOperations()
#
- from rpython.memory.gc import stmshared
self.stm_operations = stm_operations
self.nursery_size = nursery_size
#self.maximum_extra_threshold = 0
- self.sharedarea = stmshared.StmGCSharedArea(self)
+ self.sharedarea = stmshared.StmGCSharedArea(self, page_size,
+ small_request_threshold)
#
def _stm_duplicate(obj): # indirection to hide 'self'
return self.stm_duplicate(obj)
@@ -450,7 +448,7 @@
if tls.is_in_nursery(obj):
size_gc_header = self.gcheaderbuilder.size_gc_header
size = self.get_size(obj)
- shadowhdr = tls.sharedarea_tls.malloc_object(
+ shadowhdr = tls.sharedarea_tls.malloc_object_addr(
size_gc_header + size)
# XXX must initialize the shadow enough to be considered
# a valid gc object by the next major collection
diff --git a/rpython/memory/gc/stmshared.py b/rpython/memory/gc/stmshared.py
--- a/rpython/memory/gc/stmshared.py
+++ b/rpython/memory/gc/stmshared.py
@@ -96,11 +96,13 @@
# which store objects of size N.
length = sharedarea.small_request_threshold / WORD + 1
self.pages_for_size = lltype.malloc(
- rffi.CArray(PAGE_PTR), length, flavor='raw', zero=True)
+ rffi.CArray(PAGE_PTR), length, flavor='raw', zero=True,
+ track_allocation=False)
#
# This array contains 'length' chained lists of free locations.
self.free_loc_for_size = lltype.malloc(
- rffi.CArray(llmemory.Address), length, flavor='raw', zero=True)
+ rffi.CArray(llmemory.Address), length, flavor='raw', zero=True,
+ track_allocation=False)
#
if not we_are_translated():
self._seen_pages = set()
@@ -168,18 +170,21 @@
return head
- def malloc_object(self, totalsize):
+ def malloc_object_addr(self, totalsize):
"""Malloc. You should also call add_regular() later, or keep it in
some other data structure. Note that it is not zero-filled."""
nsize = llmemory.raw_malloc_usage(totalsize)
if nsize <= self.sharedarea.small_request_threshold:
size_class = (nsize + WORD_POWER_2 - 1) >> WORD_POWER_2
- result = self._malloc_size_class(size_class)
+ return self._malloc_size_class(size_class)
else:
- result = llarena.arena_malloc(
+ return llarena.arena_malloc(
llmemory.raw_malloc_usage(totalsize), 0)
- llarena.arena_reserve(result, _dummy_size(totalsize))
- return result + self.gc.gcheaderbuilder.size_gc_header
+
+ def malloc_object(self, totalsize):
+ addr = self.malloc_object_addr(totalsize)
+ llarena.arena_reserve(addr, _dummy_size(totalsize))
+ return addr + self.gc.gcheaderbuilder.size_gc_header
def add_regular(self, obj):
"""After malloc_object(), register the object in the internal chained
@@ -209,8 +214,10 @@
self.free_object(lst.pop())
def delete(self):
- lltype.free(self.free_loc_for_size, flavor='raw')
- lltype.free(self.pages_for_size, flavor='raw')
+ lltype.free(self.free_loc_for_size, flavor='raw',
+ track_allocation=False)
+ lltype.free(self.pages_for_size, flavor='raw',
+ track_allocation=False)
free_non_gc_object(self)
diff --git a/rpython/memory/gc/stmtls.py b/rpython/memory/gc/stmtls.py
--- a/rpython/memory/gc/stmtls.py
+++ b/rpython/memory/gc/stmtls.py
@@ -517,7 +517,7 @@
llmemory.sizeof(lltype.Signed))
else:
newtotalsize = totalsize_without_hash
- newaddr = self.sharedarea_tls.malloc_object(newtotalsize)
+ newaddr = self.sharedarea_tls.malloc_object_addr(newtotalsize)
#
# Initialize the copy by doing a memcpy of the bytes.
# The object header of localobj will then be fixed by the C code.
More information about the pypy-commit
mailing list