[pypy-commit] pypy gc-incminimark-pinning: move tests around
groggi
noreply at buildbot.pypy.org
Mon Jun 2 17:24:09 CEST 2014
Author: Gregor Wegberg <code at gregorwegberg.com>
Branch: gc-incminimark-pinning
Changeset: r71828:1bc4c3b0bd3a
Date: 2014-05-19 21:24 +0200
http://bitbucket.org/pypy/pypy/changeset/1bc4c3b0bd3a/
Log: move tests around
shadowing is a GC specific feature, test on incminimark only for now
diff --git a/rpython/memory/gc/test/test_object_pinning.py b/rpython/memory/gc/test/test_object_pinning.py
--- a/rpython/memory/gc/test/test_object_pinning.py
+++ b/rpython/memory/gc/test/test_object_pinning.py
@@ -31,30 +31,6 @@
py.test.raises(Exception,
self.gc.unpin, llmemory.cast_ptr_to_adr(ptr))
- def test_pin_id(self):
- ptr = self.malloc(S)
- adr = llmemory.cast_ptr_to_adr(ptr)
- self.stackroots.append(ptr)
- ptr.someInt = 100
- assert self.gc.pin(adr)
- # XXX incminimark: leads to a shadow.
- # Check if this really works. (groggi)
- self.gc.id(ptr)
- self.gc.collect()
- assert ptr.someInt == 100
-
- def test_pin_hash(self):
- ptr = self.malloc(S)
- adr = llmemory.cast_ptr_to_adr(ptr)
- self.stackroots.append(ptr)
- ptr.someInt = 100
- assert self.gc.pin(adr)
- # XXX incminimark: leads to a shadow.
- # Check if this really works. (groggi)
- self.gc.identityhash(ptr)
- self.gc.collect()
- assert ptr.someInt == 100
-
# XXX test with multiple mallocs, and only part of them is pinned
class TestIncminimark(PinningGCTest):
@@ -139,6 +115,26 @@
assert first_ptr.someInt == 101
assert second_ptr.someInt == 102
+ def test_pin_shadow_1(self):
+ ptr = self.malloc(S)
+ adr = llmemory.cast_ptr_to_adr(ptr)
+ self.stackroots.append(ptr)
+ ptr.someInt = 100
+ assert self.gc.pin(adr)
+ self.gc.id(ptr) # allocate shadow
+ self.gc.collect()
+ assert ptr.someInt == 100
+
+ def test_pin_shadow_2(self):
+ ptr = self.malloc(S)
+ adr = llmemory.cast_ptr_to_adr(ptr)
+ self.stackroots.append(ptr)
+ ptr.someInt = 100
+ assert self.gc.pin(adr)
+ self.gc.identityhash(ptr) # allocate shadow
+ self.gc.collect()
+ assert ptr.someInt == 100
+
# XXX test/define what happens if we try to pin an object that is too
# big for the nursery and will be raw-malloc'ed.
More information about the pypy-commit
mailing list