Author: Armin Rigo <ar...@tunes.org> Branch: stmgc-c7 Changeset: r71476:8eaaea95de1a Date: 2014-05-12 21:56 +0200 http://bitbucket.org/pypy/pypy/changeset/8eaaea95de1a/
Log: Translation fixes and more tweaks diff --git a/rpython/jit/backend/llsupport/llmodel.py b/rpython/jit/backend/llsupport/llmodel.py --- a/rpython/jit/backend/llsupport/llmodel.py +++ b/rpython/jit/backend/llsupport/llmodel.py @@ -389,10 +389,16 @@ 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: @@ -410,7 +416,10 @@ @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): @@ -419,7 +428,10 @@ @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): diff --git a/rpython/jit/metainterp/blackhole.py b/rpython/jit/metainterp/blackhole.py --- a/rpython/jit/metainterp/blackhole.py +++ b/rpython/jit/metainterp/blackhole.py @@ -1174,9 +1174,15 @@ 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): @@ -1185,8 +1191,12 @@ 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): @@ -1272,9 +1282,15 @@ 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 @@ -1287,17 +1303,19 @@ @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): diff --git a/rpython/translator/stm/support.py b/rpython/translator/stm/support.py --- a/rpython/translator/stm/support.py +++ b/rpython/translator/stm/support.py @@ -1,3 +1,4 @@ +from rpython.flowspace.model import Constant, Variable def is_immutable(op): if op.opname in ('getfield', 'setfield'): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit