[pypy-svn] r49837 - in pypy/branch/lazy-write-barrier/pypy/rpython/memory: gc gctransform
fijal at codespeak.net
fijal at codespeak.net
Sun Dec 16 15:38:46 CET 2007
Author: fijal
Date: Sun Dec 16 15:38:45 2007
New Revision: 49837
Modified:
pypy/branch/lazy-write-barrier/pypy/rpython/memory/gc/generation.py
pypy/branch/lazy-write-barrier/pypy/rpython/memory/gc/semispace.py
pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/framework.py
Log:
Check this in not to forget. It contains debug prints and messy code, to clean
up
Modified: pypy/branch/lazy-write-barrier/pypy/rpython/memory/gc/generation.py
==============================================================================
--- pypy/branch/lazy-write-barrier/pypy/rpython/memory/gc/generation.py (original)
+++ pypy/branch/lazy-write-barrier/pypy/rpython/memory/gc/generation.py Sun Dec 16 15:38:45 2007
@@ -39,6 +39,7 @@
get_roots = get_roots)
self.nursery_size = nursery_size
assert nursery_size <= space_size // 2
+ self.created = 0
def setup(self):
SemiSpaceGC.setup(self)
@@ -294,6 +295,7 @@
self.remember_young_pointer(addr_struct, newvalue)
def append_to_static_roots(self, pointer, arg):
+ self.created += 1
self.get_roots.append_static_root(pointer)
def move_to_static_roots(self, addr_struct):
@@ -311,4 +313,5 @@
oldhdr.tid &= ~GCFLAG_NO_YOUNG_PTRS
if oldhdr.tid & GCFLAG_NEVER_SET:
self.move_to_static_roots(addr_struct)
+ llop.debug_print(lltype.Void, "new statc root", self.created)
remember_young_pointer.dont_inline = True
Modified: pypy/branch/lazy-write-barrier/pypy/rpython/memory/gc/semispace.py
==============================================================================
--- pypy/branch/lazy-write-barrier/pypy/rpython/memory/gc/semispace.py (original)
+++ pypy/branch/lazy-write-barrier/pypy/rpython/memory/gc/semispace.py Sun Dec 16 15:38:45 2007
@@ -228,11 +228,14 @@
def collect_roots(self):
roots = self.get_roots()
+ counter = 0
while 1:
root = roots.pop()
+ counter += 1
if root == NULL:
break
root.address[0] = self.copy(root.address[0])
+ llop.debug_print(lltype.Void, "collected: ", counter)
free_non_gc_object(roots)
def copy(self, obj):
Modified: pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/framework.py
==============================================================================
--- pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/framework.py (original)
+++ pypy/branch/lazy-write-barrier/pypy/rpython/memory/gctransform/framework.py Sun Dec 16 15:38:45 2007
@@ -17,6 +17,7 @@
from pypy.rpython.memory.gctypelayout import convert_weakref_to, WEAKREFPTR
from pypy.rpython.memory.gctransform.log import log
from pypy.tool.sourcetools import func_with_new_name
+from pypy.rpython.lltypesystem.lloperation import llop
import sys
@@ -127,6 +128,7 @@
gcdata.static_root_start = a_random_address # patched in finish()
gcdata.static_root_nongcstart = a_random_address # patched in finish()
gcdata.static_root_end = a_random_address # patched in finish()
+ gcdata.static_root_real_end = a_random_address
self.gcdata = gcdata
self.malloc_fnptr_cache = {}
@@ -157,6 +159,9 @@
data_classdef.generalize_attr(
'static_root_end',
annmodel.SomeAddress())
+ data_classdef.generalize_attr(
+ 'static_root_real_end',
+ annmodel.SomeAddress())
annhelper = annlowlevel.MixLevelHelperAnnotator(self.translator.rtyper)
@@ -380,13 +385,15 @@
self.static_current = gcdata.static_root_start
else:
self.static_current = gcdata.static_root_nongcstart
+ self.with_static = with_static
def pop(self):
- while self.static_current != gcdata.static_root_end:
- result = self.static_current
- self.static_current += sizeofaddr
- if result.address[0].address[0] != llmemory.NULL:
- return result.address[0]
+ if self.with_static:
+ while self.static_current != gcdata.static_root_end:
+ result = self.static_current
+ self.static_current += sizeofaddr
+ if result.address[0].address[0] != llmemory.NULL:
+ return result.address[0]
while self.stack_current != gcdata.root_stack_base:
self.stack_current -= sizeofaddr
if self.stack_current.address[0] != llmemory.NULL:
@@ -446,13 +453,14 @@
log.info("additional %d potential static roots" % additional_ptrs)
ll_static_roots_inside = lltype.malloc(lltype.Array(llmemory.Address),
len(addresses_of_static_ptrs) +
- additional_ptrs,
+ int(additional_ptrs),
immortal=True)
for i in range(len(addresses_of_static_ptrs)):
ll_static_roots_inside[i] = addresses_of_static_ptrs[i]
ll_instance.inst_static_root_start = llmemory.cast_ptr_to_adr(ll_static_roots_inside) + llmemory.ArrayItemsOffset(lltype.Array(llmemory.Address))
ll_instance.inst_static_root_nongcstart = ll_instance.inst_static_root_start + llmemory.sizeof(llmemory.Address) * len(self.layoutbuilder.addresses_of_static_ptrs)
ll_instance.inst_static_root_end = ll_instance.inst_static_root_start + llmemory.sizeof(llmemory.Address) * (len(ll_static_roots_inside) - additional_ptrs)
+ ll_instance.inst_static_root_real_end = ll_instance.inst_static_root_start + llmemory.sizeof(llmemory.Address) * len(ll_static_roots_inside)
newgcdependencies = []
newgcdependencies.append(self.gcdata.type_info_table)
More information about the Pypy-commit
mailing list