Matti Picus avatar Matti Picus committed f84c2c9 Merge

merge heads

Comments (0)

Files changed (2)

 def _contains_gcptr(TP):
-    TP = TP.OF
     if not isinstance(TP, lltype.Struct):
         if isinstance(TP, lltype.Ptr) and TP.TO._gckind == 'gc':
             return True
         return False
     for TP in TP._flds.itervalues():
-        if isinstance(TP, lltype.Ptr) and TP.TO._gckind == 'gc':
+        if _contains_gcptr(TP):
             return True
     return False
     TP = lltype.typeOf(source).TO
     assert TP == lltype.typeOf(dest).TO
-    if _contains_gcptr(TP):
+    if _contains_gcptr(TP.OF):
         # perform a write barrier that copies necessary flags from
         # source to dest
         if not llop.gc_writebarrier_before_copy(lltype.Bool, source, dest,


     assert a2[2].y == 15
 def test__contains_gcptr():
-    assert not rgc._contains_gcptr(lltype.GcArray(lltype.Signed))
-    assert not rgc._contains_gcptr(lltype.GcArray(
-        lltype.Struct('x', ('x', lltype.Signed))))
-    assert rgc._contains_gcptr(lltype.GcArray(
+    assert not rgc._contains_gcptr(lltype.Signed)
+    assert not rgc._contains_gcptr(
+        lltype.Struct('x', ('x', lltype.Signed)))
+    assert rgc._contains_gcptr(
         lltype.Struct('x', ('x', lltype.Signed),
-                      ('y', lltype.Ptr(lltype.GcArray(lltype.Signed))))))
-    assert rgc._contains_gcptr(lltype.GcArray(
+                      ('y', lltype.Ptr(lltype.GcArray(lltype.Signed)))))
+    assert rgc._contains_gcptr(
         lltype.Struct('x', ('x', lltype.Signed),
-                      ('y', llmemory.GCREF))))
-    assert rgc._contains_gcptr(lltype.GcArray(lltype.Ptr(lltype.GcStruct('x'))))
-    assert not rgc._contains_gcptr(lltype.GcArray(lltype.Ptr(lltype.Struct('x'))))
+                      ('y', llmemory.GCREF)))
+    assert rgc._contains_gcptr(lltype.Ptr(lltype.GcStruct('x')))
+    assert not rgc._contains_gcptr(lltype.Ptr(lltype.Struct('x')))
+    GCPTR = lltype.Ptr(lltype.GcStruct('x'))
+    assert rgc._contains_gcptr(
+        lltype.Struct('FOO', ('s', lltype.Struct('BAR', ('y', GCPTR)))))
 def test_ll_arraycopy_small():
     TYPE = lltype.GcArray(lltype.Signed)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.