Author: Alex Gaynor <alex.gay...@gmail.com> Branch: dynamic-specialized-tuple Changeset: r53614:4069a795cd40 Date: 2012-03-14 14:40 -0700 http://bitbucket.org/pypy/pypy/changeset/4069a795cd40/
Log: (arigo, alex): random progress, mostly will be deleted diff --git a/pypy/jit/backend/llgraph/runner.py b/pypy/jit/backend/llgraph/runner.py --- a/pypy/jit/backend/llgraph/runner.py +++ b/pypy/jit/backend/llgraph/runner.py @@ -408,6 +408,11 @@ token = '?' return self.getdescr(size, token) + def copy_and_change_descr_typeinfo_to_ptr(self, descr): + return self.getdescr(descr.ofs, "r", descr.extrainfo, descr.name, + descr.arg_types, descr.count_fields_if_immut, + descr.ffi_flags, descr.width) + # ---------- the backend-dependent operations ---------- def bh_strlen(self, string): diff --git a/pypy/jit/codewriter/jtransform.py b/pypy/jit/codewriter/jtransform.py --- a/pypy/jit/codewriter/jtransform.py +++ b/pypy/jit/codewriter/jtransform.py @@ -237,8 +237,7 @@ raise Exception("Must cast_adr_to_ptr of directly read adr") prev_op.opname = 'getinteriorfield_gc_r' prev_op.result = op.result - descr = copy.copy(prev_op.args[2]) - descr.typeinfo = "r" + descr = self.cpu.copy_and_change_descr_typeinfo_to_ptr(prev_op.args[2]) prev_op.args = prev_op.args[:2] + [descr] return prev_op @@ -841,9 +840,9 @@ return SpaceOperation(opname, [op.args[0], op.args[2], op.args[3]], op.result) else: - kind = None orig_value = None orig_result = None + prev_op = None if self._newoperations and self._newoperations[-1].opname == "cast_ptr_to_adr": prev_op = self._newoperations.pop() [orig_value] = prev_op.args @@ -862,9 +861,11 @@ if orig_value is not None: v_value = orig_value + descr = self.cpu.interiorfielddescrof(v_inst.concretetype.TO, + c_field.value) + if prev_op is not None: + descr = self.cpu.copy_and_change_descr_typeinfo_to_ptr(descr) kind = getkind(v_value.concretetype)[0] - descr = self.cpu.interiorfielddescrof(v_inst.concretetype.TO, - c_field.value, force_kind=kind) args = [v_inst, v_index, v_value, descr] return SpaceOperation('setinteriorfield_gc_%s' % kind, args, op.result) diff --git a/pypy/jit/codewriter/test/test_jtransform.py b/pypy/jit/codewriter/test/test_jtransform.py --- a/pypy/jit/codewriter/test/test_jtransform.py +++ b/pypy/jit/codewriter/test/test_jtransform.py @@ -38,12 +38,14 @@ return ('calldescr', FUNC, ARGS, RESULT) def fielddescrof(self, STRUCT, name): return ('fielddescr', STRUCT, name) - def interiorfielddescrof(self, ARRAY, name, force_kind=None): + def interiorfielddescrof(self, ARRAY, name): return ('interiorfielddescr', ARRAY, name) def arraydescrof(self, ARRAY): return FakeDescr(('arraydescr', ARRAY)) def sizeof(self, STRUCT): return FakeDescr(('sizedescr', STRUCT)) + def copy_and_change_descr_typeinfo_to_ptr(self, descr): + return (descr, "r") class FakeDescr(tuple): def as_vtable_size_descr(self): @@ -1273,7 +1275,7 @@ Transformer(FakeCPU()).optimize_block(block) [op1] = block.operations assert op1.opname == "getinteriorfield_gc_r" - assert op1.args == [v0, const(0), ('interiorfielddescr', S, 'data')] + assert op1.args == [v0, const(0), (('interiorfielddescr', S, 'data'), "r")] assert op1.result == v2 def test_cast_ptr_to_adr(): @@ -1296,4 +1298,4 @@ Transformer(FakeCPU()).optimize_block(block) [op1] = block.operations assert op1.opname == "setinteriorfield_gc_r" - assert op1.args == [v0, const(0), v1, ('interiorfielddescr', S, 'data')] + assert op1.args == [v0, const(0), v1, (('interiorfielddescr', S, 'data'), "r")] _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit