Commits

Armin Rigo  committed 8eaaea9

Translation fixes and more tweaks

  • Participants
  • Parent commits f9b6472
  • Branches stmgc-c7

Comments (0)

Files changed (3)

File rpython/jit/backend/llsupport/llmodel.py

         for STYPE, UTYPE, itemsize in unroll_basic_sizes:
             if size == itemsize:
                 if sign:
-                    val = llop.raw_load(STYPE, gcref, ofs, pure)
+                    if pure:   # raw_load's last arg should be constant
+                        val = llop.raw_load(STYPE, gcref, ofs, True)
+                    else:
+                        val = llop.raw_load(STYPE, gcref, ofs)
                     val = rffi.cast(lltype.Signed, val)
                 else:
-                    val = llop.raw_load(UTYPE, gcref, ofs, pure)
+                    if pure:
+                        val = llop.raw_load(UTYPE, gcref, ofs, True)
+                    else:
+                        val = llop.raw_load(UTYPE, gcref, ofs)
                     val = rffi.cast(lltype.Signed, val)
                 return val
         else:
 
     @specialize.argtype(1)
     def read_ref_at_mem(self, gcref, ofs, pure=False):
-        return llop.raw_load(llmemory.GCREF, gcref, ofs, pure)
+        if pure:
+            return llop.raw_load(llmemory.GCREF, gcref, ofs, True)
+        else:
+            return llop.raw_load(llmemory.GCREF, gcref, ofs)
 
     # non-@specialized: must only be called with llmemory.GCREF
     def write_ref_at_mem(self, gcref, ofs, newvalue):
 
     @specialize.argtype(1)
     def read_float_at_mem(self, gcref, ofs, pure=False):
-        return llop.raw_load(longlong.FLOATSTORAGE, gcref, ofs, pure)
+        if pure:
+            return llop.raw_load(longlong.FLOATSTORAGE, gcref, ofs, True)
+        else:
+            return llop.raw_load(longlong.FLOATSTORAGE, gcref, ofs)
 
     @specialize.argtype(1)
     def write_float_at_mem(self, gcref, ofs, newvalue):

File rpython/jit/metainterp/blackhole.py

     def bhimpl_getarrayitem_gc_f(cpu, array, index, arraydescr):
         return cpu.bh_getarrayitem_gc_f(array, index, arraydescr)
 
-    bhimpl_getarrayitem_gc_i_pure = bhimpl_getarrayitem_gc_i
-    bhimpl_getarrayitem_gc_r_pure = bhimpl_getarrayitem_gc_r
-    bhimpl_getarrayitem_gc_f_pure = bhimpl_getarrayitem_gc_f
+    @arguments("cpu", "r", "i", "d", returns="i")
+    def bhimpl_getarrayitem_gc_i_pure(cpu, array, index, arraydescr):
+        return cpu.bh_getarrayitem_gc_i(array, index, arraydescr, pure=True)
+    @arguments("cpu", "r", "i", "d", returns="r")
+    def bhimpl_getarrayitem_gc_r_pure(cpu, array, index, arraydescr):
+        return cpu.bh_getarrayitem_gc_r(array, index, arraydescr, pure=True)
+    @arguments("cpu", "r", "i", "d", returns="f")
+    def bhimpl_getarrayitem_gc_f_pure(cpu, array, index, arraydescr):
+        return cpu.bh_getarrayitem_gc_f(array, index, arraydescr, pure=True)
 
     @arguments("cpu", "i", "i", "d", returns="i")
     def bhimpl_getarrayitem_raw_i(cpu, array, index, arraydescr):
     def bhimpl_getarrayitem_raw_f(cpu, array, index, arraydescr):
         return cpu.bh_getarrayitem_raw_f(array, index, arraydescr)
 
-    bhimpl_getarrayitem_raw_i_pure = bhimpl_getarrayitem_raw_i
-    bhimpl_getarrayitem_raw_f_pure = bhimpl_getarrayitem_raw_f
+    @arguments("cpu", "i", "i", "d", returns="i")
+    def bhimpl_getarrayitem_raw_i_pure(cpu, array, index, arraydescr):
+        return cpu.bh_getarrayitem_raw_i(array, index, arraydescr, pure=True)
+    @arguments("cpu", "i", "i", "d", returns="f")
+    def bhimpl_getarrayitem_raw_f_pure(cpu, array, index, arraydescr):
+        return cpu.bh_getarrayitem_raw_f(array, index, arraydescr, pure=True)
 
     @arguments("cpu", "r", "i", "i", "d")
     def bhimpl_setarrayitem_gc_i(cpu, array, index, newvalue, arraydescr):
     def bhimpl_getfield_gc_f(cpu, struct, fielddescr):
         return cpu.bh_getfield_gc_f(struct, fielddescr)
 
-    bhimpl_getfield_gc_i_pure = bhimpl_getfield_gc_i
-    bhimpl_getfield_gc_r_pure = bhimpl_getfield_gc_r
-    bhimpl_getfield_gc_f_pure = bhimpl_getfield_gc_f
+    @arguments("cpu", "r", "d", returns="i")
+    def bhimpl_getfield_gc_i_pure(cpu, struct, fielddescr):
+        return cpu.bh_getfield_gc_i(struct, fielddescr, pure=True)
+    @arguments("cpu", "r", "d", returns="r")
+    def bhimpl_getfield_gc_r_pure(cpu, struct, fielddescr):
+        return cpu.bh_getfield_gc_r(struct, fielddescr, pure=True)
+    @arguments("cpu", "r", "d", returns="f")
+    def bhimpl_getfield_gc_f_pure(cpu, struct, fielddescr):
+        return cpu.bh_getfield_gc_f(struct, fielddescr, pure=True)
 
     bhimpl_getfield_vable_i = bhimpl_getfield_gc_i
     bhimpl_getfield_vable_r = bhimpl_getfield_gc_r
     @arguments("cpu", "i", "d", returns="i")
     def bhimpl_getfield_raw_i(cpu, struct, fielddescr):
         return cpu.bh_getfield_raw_i(struct, fielddescr)
-    @arguments("cpu", "i", "d", returns="r")
-    def _bhimpl_getfield_raw_r(cpu, struct, fielddescr):
-        # only for 'getfield_raw_r_pure'
-        return cpu.bh_getfield_raw_r(struct, fielddescr)
     @arguments("cpu", "i", "d", returns="f")
     def bhimpl_getfield_raw_f(cpu, struct, fielddescr):
         return cpu.bh_getfield_raw_f(struct, fielddescr)
 
-    bhimpl_getfield_raw_i_pure = bhimpl_getfield_raw_i
-    bhimpl_getfield_raw_r_pure = _bhimpl_getfield_raw_r
-    bhimpl_getfield_raw_f_pure = bhimpl_getfield_raw_f
+    @arguments("cpu", "i", "d", returns="i")
+    def bhimpl_getfield_raw_i_pure(cpu, struct, fielddescr):
+        return cpu.bh_getfield_raw_i(struct, fielddescr, pure=True)
+    @arguments("cpu", "i", "d", returns="r")
+    def bhimpl_getfield_raw_r_pure(cpu, struct, fielddescr):
+        return cpu.bh_getfield_raw_r(struct, fielddescr, pure=True)
+    @arguments("cpu", "i", "d", returns="f")
+    def bhimpl_getfield_raw_f_pure(cpu, struct, fielddescr):
+        return cpu.bh_getfield_raw_f(struct, fielddescr, pure=True)
 
     @arguments("cpu", "r", "i", "d")
     def bhimpl_setfield_gc_i(cpu, struct, newvalue, fielddescr):

File rpython/translator/stm/support.py

+from rpython.flowspace.model import Constant, Variable
 
 def is_immutable(op):
     if op.opname in ('getfield', 'setfield'):