Alex Gaynor committed 4069a79

(arigo, alex): random progress, mostly will be deleted

Comments (0)

Files changed (3)


                 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.arg_types, descr.count_fields_if_immut,
+                             descr.ffi_flags, descr.width)
     # ---------- the backend-dependent operations ----------
     def bh_strlen(self, string):


             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
             return SpaceOperation(opname, [op.args[0], op.args[2], op.args[3]],
-            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
             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,


         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):
     [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():
     [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")]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.