1. Pypy
  2. Untitled project
  3. pypy

Commits

Alex Gaynor  committed 4f3e2c9

translation-ish fix, except it still breaks

  • Participants
  • Parent commits fc59632
  • Branches jit-dynamic-getarrayitem

Comments (0)

Files changed (2)

File pypy/jit/backend/llgraph/llimpl.py

View file
  • Ignore whitespace
     loop = _from_opaque(loop)
     loop.operations.append(Operation(opnum))
 
-def compile_add_descr(loop, ofs, type, arg_types, extrainfo):
+def compile_add_descr(loop, ofs, type, arg_types, extrainfo, width):
     from pypy.jit.backend.llgraph.runner import Descr
     loop = _from_opaque(loop)
     op = loop.operations[-1]
     assert isinstance(type, str) and len(type) == 1
-    op.descr = Descr(ofs, type, arg_types=arg_types, extrainfo=extrainfo)
+    op.descr = Descr(ofs, type, arg_types=arg_types, extrainfo=extrainfo, width=width)
 
 def compile_add_descr_arg(loop, ofs, type, arg_types):
     from pypy.jit.backend.llgraph.runner import Descr
 
     def op_getinteriorfield_raw(self, descr, array, index):
         if descr.typeinfo == REF:
-            return do_getinteriorfield_raw_ptr(array, index, descr.extrainfo, descr.ofs)
+            return do_getinteriorfield_raw_ptr(array, index, descr.width, descr.ofs)
         elif descr.typeinfo == INT:
-            return do_getinteriorfield_raw_int(array, index, descr.extrainfo, descr.ofs)
+            return do_getinteriorfield_raw_int(array, index, descr.width, descr.ofs)
         elif descr.typeinfo == FLOAT:
-            return do_getinteriorfield_raw_float(array, index, descr.extrainfo, descr.ofs)
+            return do_getinteriorfield_raw_float(array, index, descr.width, descr.ofs)
         else:
             raise NotImplementedError
 
 
     def op_setinteriorfield_raw(self, descr, array, index, newvalue):
         if descr.typeinfo == REF:
-            return do_setinteriorfield_raw_ptr(array, index, newvalue, descr.extrainfo, descr.ofs)
+            return do_setinteriorfield_raw_ptr(array, index, newvalue, descr.width, descr.ofs)
         elif descr.typeinfo == INT:
-            return do_setinteriorfield_raw_int(array, index, newvalue, descr.extrainfo, descr.ofs)
+            return do_setinteriorfield_raw_int(array, index, newvalue, descr.width, descr.ofs)
         elif descr.typeinfo == FLOAT:
-            return do_setinteriorfield_raw_float(array, index, newvalue, descr.extrainfo, descr.ofs)
+            return do_setinteriorfield_raw_float(array, index, newvalue, descr.width, descr.ofs)
         else:
             raise NotImplementedError
 

File pypy/jit/backend/llgraph/runner.py

View file
  • Ignore whitespace
 class Descr(history.AbstractDescr):
 
     def __init__(self, ofs, typeinfo, extrainfo=None, name=None,
-                 arg_types=None, count_fields_if_immut=-1, ffi_flags=0):
+                 arg_types=None, count_fields_if_immut=-1, ffi_flags=0, width=-1):
+
         self.ofs = ofs
+        self.width = width
         self.typeinfo = typeinfo
         self.extrainfo = extrainfo
         self.name = name
         return False
 
     def getdescr(self, ofs, typeinfo='?', extrainfo=None, name=None,
-                 arg_types=None, count_fields_if_immut=-1, ffi_flags=0):
+                 arg_types=None, count_fields_if_immut=-1, ffi_flags=0, width=-1):
         key = (ofs, typeinfo, extrainfo, name, arg_types,
-               count_fields_if_immut, ffi_flags)
+               count_fields_if_immut, ffi_flags, width)
         try:
             return self._descrs[key]
         except KeyError:
             descr = Descr(ofs, typeinfo, extrainfo, name, arg_types,
-                          count_fields_if_immut, ffi_flags)
+                          count_fields_if_immut, ffi_flags, width)
             self._descrs[key] = descr
             return descr
 
             descr = op.getdescr()
             if isinstance(descr, Descr):
                 llimpl.compile_add_descr(c, descr.ofs, descr.typeinfo,
-                                         descr.arg_types, descr.extrainfo)
+                                         descr.arg_types, descr.extrainfo,
+                                         descr.width)
             if (isinstance(descr, history.LoopToken) and
                 op.getopnum() != rop.JUMP):
                 llimpl.compile_add_loop_token(c, descr)
 
     def interiorfielddescrof(self, A, fieldname):
         S = A.OF
-        ofs2 = symbolic.get_size(A)
+        width = symbolic.get_size(A)
         ofs, size = symbolic.get_field_token(S, fieldname)
         token = history.getkind(getattr(S, fieldname))
-        return self.getdescr(ofs, token[0], name=fieldname, extrainfo=ofs2)
+        return self.getdescr(ofs, token[0], name=fieldname, width=width)
 
     def interiorfielddescrof_dynamic(self, offset, width, fieldsize,
         is_pointer, is_float, is_signed):
         else:
             typeinfo = INT
         # we abuse the arg_types field to distinguish dynamic and static descrs
-        return Descr(offset, typeinfo, arg_types='dynamic', name='<dynamic interior field>', extrainfo=width)
+        return Descr(offset, typeinfo, arg_types='dynamic', name='<dynamic interior field>', width=width)
 
     def calldescrof(self, FUNC, ARGS, RESULT, extrainfo):
         arg_types = []