[pypy-svn] r70966 - in pypy/trunk/pypy: jit/metainterp rlib rlib/test
pedronis at codespeak.net
pedronis at codespeak.net
Fri Jan 29 14:33:23 CET 2010
Author: pedronis
Date: Fri Jan 29 14:33:22 2010
New Revision: 70966
Modified:
pypy/trunk/pypy/jit/metainterp/virtualref.py
pypy/trunk/pypy/rlib/rgc.py
pypy/trunk/pypy/rlib/test/test_rgc.py
Log:
(fijal, pedronis)
test and fix
Modified: pypy/trunk/pypy/jit/metainterp/virtualref.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/virtualref.py (original)
+++ pypy/trunk/pypy/jit/metainterp/virtualref.py Fri Jan 29 14:33:22 2010
@@ -86,6 +86,7 @@
return
vref = lltype.cast_opaque_ptr(lltype.Ptr(self.JIT_VIRTUAL_REF), gcref)
assert not vref.virtual_token
+ assert vref.forced
vref.virtual_token = self.TOKEN_TRACING_RESCALL
def tracing_after_residual_call(self, gcref):
@@ -100,6 +101,7 @@
return False
else:
# marker "modified during residual call" set.
+ XXX
return True
def forced_single_vref(self, gcref, real_object):
Modified: pypy/trunk/pypy/rlib/rgc.py
==============================================================================
--- pypy/trunk/pypy/rlib/rgc.py (original)
+++ pypy/trunk/pypy/rlib/rgc.py Fri Jan 29 14:33:22 2010
@@ -258,7 +258,7 @@
if isinstance(TP.OF, lltype.Ptr) and TP.OF.TO._gckind == 'gc':
# perform a write barrier that copies necessary flags from
# source to dest
- if not llop.gc_writebarrier_before_copy(lltype.Void, source, dest):
+ if not llop.gc_writebarrier_before_copy(lltype.Bool, source, dest):
# if the write barrier is not supported, copy by hand
for i in range(length):
dest[i + dest_start] = source[i + source_start]
Modified: pypy/trunk/pypy/rlib/test/test_rgc.py
==============================================================================
--- pypy/trunk/pypy/rlib/test/test_rgc.py (original)
+++ pypy/trunk/pypy/rlib/test/test_rgc.py Fri Jan 29 14:33:22 2010
@@ -1,5 +1,5 @@
from pypy.rpython.test.test_llinterp import gengraph, interpret
-from pypy.rpython.lltypesystem import lltype
+from pypy.rpython.lltypesystem import lltype, llmemory
from pypy.rlib import rgc # Force registration of gc.collect
import gc
import py, sys
@@ -114,6 +114,28 @@
else:
assert a2[i] == org2[i]
+def test_ll_arraycopy_5(monkeypatch):
+ S = lltype.GcStruct('S')
+ TYPE = lltype.GcArray(lltype.Ptr(S))
+ def f():
+ a1 = lltype.malloc(TYPE, 10)
+ a2 = lltype.malloc(TYPE, 6)
+ rgc.ll_arraycopy(a2, a1, 0, 1, 5)
+
+ CHK = lltype.Struct('CHK', ('called', lltype.Bool))
+ check = lltype.malloc(CHK, immortal=True)
+
+ def raw_memcopy(*args):
+ check.called = True
+
+ monkeypatch.setattr(llmemory, "raw_memcopy", raw_memcopy)
+
+ interpret(f, [])
+
+ assert check.called
+
+
+
def test_ll_shrink_array_1():
py.test.skip("implement ll_shrink_array for GcStructs or GcArrays that "
"don't have the shape of STR or UNICODE")
More information about the Pypy-commit
mailing list