[pypy-svn] r31642 - in pypy/dist/pypy/rpython/memory: . test
arigo at codespeak.net
arigo at codespeak.net
Fri Aug 25 16:44:01 CEST 2006
Author: arigo
Date: Fri Aug 25 16:43:58 2006
New Revision: 31642
Modified:
pypy/dist/pypy/rpython/memory/gc.py
pypy/dist/pypy/rpython/memory/gctransform.py
pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py
Log:
(pedronis, arigo)
Fix. See failure in rpython.memory.test.test_transformed_gc,
test_llinterp_lists.
Modified: pypy/dist/pypy/rpython/memory/gc.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gc.py (original)
+++ pypy/dist/pypy/rpython/memory/gc.py Fri Aug 25 16:43:58 2006
@@ -448,7 +448,9 @@
hdr = next
self.collect_in_progress = False
- STATISTICS_NUMBERS = 2
+ STAT_HEAP_USAGE = 0
+ STAT_BYTES_MALLOCED = 1
+ STATISTICS_NUMBERS = 2
def add_reachable_to_stack(self, obj, objects):
size_gc_header = self.gcheaderbuilder.size_gc_header
@@ -477,8 +479,13 @@
j += 1
i += 1
- def statistics(self):
- return self.heap_usage, self.bytes_malloced
+ def statistics(self, index):
+ # no memory allocation here!
+ if index == self.STAT_HEAP_USAGE:
+ return self.heap_usage
+ if index == self.STAT_BYTES_MALLOCED:
+ return self.bytes_malloced
+ return -1
def size_gc_header(self, typeid=0):
return self.gcheaderbuilder.size_gc_header
Modified: pypy/dist/pypy/rpython/memory/gctransform.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gctransform.py (original)
+++ pypy/dist/pypy/rpython/memory/gctransform.py Fri Aug 25 16:43:58 2006
@@ -922,9 +922,9 @@
self.collect_ptr = getfn(GCClass.collect.im_func,
[s_gc], annmodel.s_None)
- statics_s = (annmodel.SomeInteger(),)*GCClass.STATISTICS_NUMBERS
self.statistics_ptr = getfn(GCClass.statistics.im_func,
- [s_gc], annmodel.SomeTuple(statics_s))
+ [s_gc, annmodel.SomeInteger()],
+ annmodel.SomeInteger())
# experimental gc_x_* operations
s_x_pool = annmodel.SomePtr(gc.X_POOL_PTR)
Modified: pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py (original)
+++ pypy/dist/pypy/rpython/memory/test/test_transformed_gc.py Fri Aug 25 16:43:58 2006
@@ -219,8 +219,8 @@
if statistics:
statisticsgraph = db.gctransformer.statistics_ptr.value._obj.graph
ll_gc = db.gctransformer.c_const_gc.value
- def statistics():
- return llinterp.eval_graph(statisticsgraph, [ll_gc])
+ def statistics(index):
+ return llinterp.eval_graph(statisticsgraph, [ll_gc, index])
return run, statistics
else:
return run
@@ -230,7 +230,11 @@
class gcpolicy(gc.FrameworkGcPolicy):
class transformerclass(gctransform.FrameworkGCTransformer):
GC_PARAMS = {'start_heap_size': 4096 }
-
+
+ def heap_usage(self, statistics):
+ return statistics(
+ self.gcpolicy.transformerclass.GCClass.STAT_HEAP_USAGE)
+
def test_llinterp_lists(self):
def malloc_a_lot():
i = 0
@@ -244,7 +248,7 @@
return 0
run, statistics = self.runner(malloc_a_lot, statistics=True)
run([])
- heap_size = statistics().item0
+ heap_size = self.heap_usage(statistics)
assert heap_size < 16000 * INT_SIZE / 4 # xxx
def test_llinterp_tuples(self):
@@ -261,7 +265,7 @@
return 0
run, statistics = self.runner(malloc_a_lot, statistics=True)
run([])
- heap_size = statistics().item0
+ heap_size = self.heap_usage(statistics)
assert heap_size < 16000 * INT_SIZE / 4 # xxx
def test_global_list(self):
@@ -290,7 +294,7 @@
run, statistics = self.runner(concat, nbargs=2, statistics=True)
res = run([100, 0])
assert res == concat(100, 0)
- heap_size = statistics().item0
+ heap_size = self.heap_usage(statistics)
assert heap_size < 16000 * INT_SIZE / 4 # xxx
def test_finalizer(self):
More information about the Pypy-commit
mailing list