[pypy-commit] pypy stmgc-c7: Test and fix
arigo
noreply at buildbot.pypy.org
Sat Apr 19 18:34:19 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7
Changeset: r70774:a546ea9be6e4
Date: 2014-04-19 17:47 +0200
http://bitbucket.org/pypy/pypy/changeset/a546ea9be6e4/
Log: Test and fix
diff --git a/rpython/translator/stm/funcgen.py b/rpython/translator/stm/funcgen.py
--- a/rpython/translator/stm/funcgen.py
+++ b/rpython/translator/stm/funcgen.py
@@ -225,12 +225,17 @@
def stm_setup_expand_marker_for_pypy(funcgen, op):
# hack hack hack
- node = funcgen.db.gettypedefnode(op.args[0].concretetype.TO)
- typename = funcgen.db.gettype(op.args[0].concretetype.TO)
- names = [''.join(arg.value.chars) for arg in op.args[1:]]
- names = [node.c_struct_field_name('inst_' + name) for name in names]
- offsets = ['offsetof(%s, %s)' % (cdecl(typename, ''), name)
- for name in names]
+ offsets = []
+ for arg in op.args[1:]:
+ name = 'inst_' + ''.join(arg.value.chars)
+ S = op.args[0].concretetype.TO
+ while True:
+ node = funcgen.db.gettypedefnode(S)
+ if name in node.fieldnames:
+ break
+ S = S.super
+ name = node.c_struct_field_name(name)
+ offsets.append('offsetof(struct %s, %s)' % (node.name, name))
assert len(offsets) == 4
return 'pypy_stm_setup_expand_marker(%s, %s, %s, %s);' % (
offsets[0], offsets[1], offsets[2], offsets[3])
diff --git a/rpython/translator/stm/test/test_ztranslated.py b/rpython/translator/stm/test/test_ztranslated.py
--- a/rpython/translator/stm/test/test_ztranslated.py
+++ b/rpython/translator/stm/test/test_ztranslated.py
@@ -495,7 +495,9 @@
assert '-1298\n' in data
def test_pypy_marker(self):
- class PyCode(object):
+ class Code(object):
+ pass
+ class PyCode(Code):
def __init__(self, co_filename, co_name,
co_firstlineno, co_lnotab):
self.co_filename = co_filename
@@ -520,6 +522,7 @@
"/tmp/some/where/very/very/long/path/bla/br/project/foobaz.py",
"some_extremely_longish_and_boring_function_name",
80, "\x00\x01\x04\x02")
+ Code().co_name = "moved up"
llop.stm_setup_expand_marker_for_pypy(
lltype.Void, pycode1,
"co_filename", "co_name", "co_firstlineno", "co_lnotab")
More information about the pypy-commit
mailing list