[pypy-commit] stmgc default: Use a more ad-hoc string variant
arigo
noreply at buildbot.pypy.org
Sat Jul 6 18:52:36 CEST 2013
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r362:fd4fd6cb406b
Date: 2013-07-06 15:47 +0200
http://bitbucket.org/pypy/stmgc/changeset/fd4fd6cb406b/
Log: Use a more ad-hoc string variant
diff --git a/c4/extra.c b/c4/extra.c
--- a/c4/extra.c
+++ b/c4/extra.c
@@ -224,7 +224,10 @@
rps = *(char **)(object + offset);
offset = *fieldoffsets++;
if (rps) {
- rps_size = stmcb_size((gcptr)rps) - offset;
+ /* xxx a bit ad-hoc: it's a string whose length is a
+ * long at 'offset', following immediately the offset */
+ rps_size = *(long *)(rps + offset);
+ offset += sizeof(long);
assert(rps_size >= 0);
res_size = sprintf(buffer, "%zu:", rps_size);
WRITE_BUF(buffer, res_size);
diff --git a/c4/test/test_extra.py b/c4/test/test_extra.py
--- a/c4/test/test_extra.py
+++ b/c4/test/test_extra.py
@@ -54,24 +54,23 @@
sys.maxint, sys.maxint * 2 + 1))
def test_inspect_abort_info_string():
- fo1 = ffi.new("long[]", [3, HDR, HDR + 1, 0])
+ fo1 = ffi.new("long[]", [3, HDR + WORD, HDR, 0])
#
@perform_transaction
def run(retry_counter):
if retry_counter == 0:
- p = nalloc_refs(1)
+ p = nalloc_refs(2)
q = nalloc(HDR + 2 * WORD)
- lib.setptr(p, 0, q)
- lib.setlong(q, 0, -937251491)
- lib.setlong(q, 1, -389541051)
+ lib.setptr(p, 1, q)
+ lib.setlong(q, 0, 3)
+ word = "ABC" + "\xFF" * (WORD - 3)
+ lib.setlong(q, 1, struct.unpack("l", word)[0])
lib.stm_abort_info_push(p, fo1)
abort_and_retry()
else:
c = lib.stm_inspect_abort_info()
assert c
- expected = struct.pack("ll", -937251491, -389541051)
- assert ffi.string(c).endswith("e%d:%se" % (
- len(expected) - 1, expected[1:]))
+ assert ffi.string(c).endswith("e3:ABCe")
def test_inspect_null():
fo1 = ffi.new("long[]", [3, HDR, HDR + 1, 0])
More information about the pypy-commit
mailing list