Author: Maciej Fijalkowski <[email protected]>
Branch: gc_no_cleanup_nursery
Changeset: r73278:5c7aa94e6c89
Date: 2014-09-01 15:04 -0600
http://bitbucket.org/pypy/pypy/changeset/5c7aa94e6c89/
Log: Handle the uninitialized value better while translating (it can
happen)
diff --git a/rpython/memory/test/test_transformed_gc.py
b/rpython/memory/test/test_transformed_gc.py
--- a/rpython/memory/test/test_transformed_gc.py
+++ b/rpython/memory/test/test_transformed_gc.py
@@ -1331,7 +1331,7 @@
run = self.runner('malloc_array_of_gcptr')
res = run([])
assert not res
- '''
+
def define_malloc_struct_of_gcptr(cls):
S1 = lltype.GcStruct('S', ('x', lltype.Signed))
S = lltype.GcStruct('S',
@@ -1347,25 +1347,7 @@
run = self.runner("malloc_struct_of_gcptr")
res = run([])
assert res
- '''
- '''
- def define_malloc_struct_of_gcptr(cls):
- S = lltype.GcForwardReference()
- S.become(lltype.GcStruct('S',
- ('x', lltype.Signed),
- ('prev', lltype.Ptr(S)),
- ('next', lltype.Ptr(S))))
- s0 = lltype.malloc(S,zero = False)
- def f():
- return s0.next == lltype.nullptr(S)
- return f
- def test_malloc_struct_of_gcptr(self):
- run = self.runner("malloc_struct_of_gcptr")
- pdb.set_trace()
- res = run([])
- assert res
- '''
# ________________________________________________________________
# tagged pointers
diff --git a/rpython/translator/c/database.py b/rpython/translator/c/database.py
--- a/rpython/translator/c/database.py
+++ b/rpython/translator/c/database.py
@@ -286,6 +286,8 @@
for value in newdependencies:
#if isinstance(value, _uninitialized):
# continue
+ if isinstance(value, lltype._uninitialized):
+ continue
if isinstance(typeOf(value), ContainerType):
node = self.getcontainernode(value)
if parent and node._funccodegen_owner is not None:
diff --git a/rpython/translator/c/test/test_newgc.py
b/rpython/translator/c/test/test_newgc.py
--- a/rpython/translator/c/test/test_newgc.py
+++ b/rpython/translator/c/test/test_newgc.py
@@ -1381,20 +1381,29 @@
for length in range(3, 76, 5)])
def define_nursery_hash_base(cls):
+ from rpython.rlib.debug import debug_print
+
class A:
pass
def fn():
objects = []
hashes = []
for i in range(200):
+ debug_print("starting nursery collection", i)
rgc.collect(0) # nursery-only collection, if possible
+ debug_print("finishing nursery collection", i)
obj = A()
objects.append(obj)
hashes.append(compute_identity_hash(obj))
unique = {}
+ debug_print("objects", len(objects))
for i in range(len(objects)):
+ debug_print(i)
assert compute_identity_hash(objects[i]) == hashes[i]
+ debug_print("storing in dict")
unique[hashes[i]] = None
+ debug_print("done")
+ debug_print("finished")
return len(unique)
return fn
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit