Author: Armin Rigo <[email protected]>
Branch: gc_no_cleanup_nursery
Changeset: r73673:419bb943f8e2
Date: 2014-09-24 15:46 +0200
http://bitbucket.org/pypy/pypy/changeset/419bb943f8e2/
Log: Write this test
diff --git a/rpython/jit/backend/test/runner_test.py
b/rpython/jit/backend/test/runner_test.py
--- a/rpython/jit/backend/test/runner_test.py
+++ b/rpython/jit/backend/test/runner_test.py
@@ -4480,7 +4480,24 @@
assert not s.x
def test_zero_ptr_field(self):
- XXX # write me!
+ from rpython.jit.backend.llsupport import symbolic
+ S = lltype.GcStruct('S', ('x', lltype.Signed),
+ ('p', llmemory.GCREF),
+ ('y', lltype.Signed))
+ s = lltype.malloc(S)
+ s.x = -1296321
+ s.y = -4398176
+ s_ref = lltype.cast_opaque_ptr(llmemory.GCREF, s)
+ s.p = s_ref
+ ofs_p, _ = symbolic.get_field_token(S, 'p', False)
+ #
+ self.execute_operation(rop.ZERO_PTR_FIELD, [
+ BoxPtr(s_ref), ConstInt(ofs_p)], # OK for now to assume that the
+ 'void') # 2nd argument is a constant
+ #
+ assert s.x == -1296321
+ assert s.p == lltype.nullptr(llmemory.GCREF.TO)
+ assert s.y == -4398176
def test_zero_array(self):
PAIR = lltype.Struct('PAIR', ('a', lltype.Signed), ('b',
lltype.Signed))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit