Author: Armin Rigo <[email protected]>
Branch: ppc-updated-backend
Changeset: r80257:d1c06d78b23c
Date: 2015-10-16 11:14 +0200
http://bitbucket.org/pypy/pypy/changeset/d1c06d78b23c/
Log: threadlocalref_get
diff --git a/rpython/jit/backend/ppc/opassembler.py
b/rpython/jit/backend/ppc/opassembler.py
--- a/rpython/jit/backend/ppc/opassembler.py
+++ b/rpython/jit/backend/ppc/opassembler.py
@@ -221,6 +221,25 @@
l0, res = arglocs
self.mc.fsqrt(res.value, l0.value)
+ def _emit_threadlocalref_get(self, op, arglocs, regalloc):
+ [resloc] = arglocs
+ offset = op.getarg(1).getint() # getarg(0) == 'threadlocalref_get'
+ calldescr = op.getdescr()
+ size = calldescr.get_result_size()
+ sign = calldescr.is_result_signed()
+ #
+ # This loads the stack location THREADLOCAL_OFS into a
+ # register, and then read the word at the given offset.
+ # It is only supported if 'translate_support_code' is
+ # true; otherwise, the execute_token() was done with a
+ # dummy value for the stack location THREADLOCAL_OFS
+ #
+ assert self.cpu.translate_support_code
+ assert resloc.is_reg()
+ assert _check_imm_arg(offset)
+ self.mc.ld(resloc.value, r.SP.value, THREADLOCAL_ADDR_OFFSET)
+ self._load_from_mem(resloc, resloc, imm(offset), imm(size), imm(sign))
+
emit_float_le = gen_emit_cmp_op(c.LE, fp=True)
emit_float_lt = gen_emit_cmp_op(c.LT, fp=True)
emit_float_gt = gen_emit_cmp_op(c.GT, fp=True)
@@ -584,6 +603,8 @@
oopspecindex = regalloc.get_oopspecindex(op)
if oopspecindex == EffectInfo.OS_MATH_SQRT:
return self._emit_math_sqrt(op, arglocs, regalloc)
+ if oopspecindex == EffectInfo.OS_THREADLOCALREF_GET:
+ return self._emit_threadlocalref_get(op, arglocs, regalloc)
self._emit_call(op, arglocs)
emit_call_i = _genop_call
diff --git a/rpython/jit/backend/ppc/regalloc.py
b/rpython/jit/backend/ppc/regalloc.py
--- a/rpython/jit/backend/ppc/regalloc.py
+++ b/rpython/jit/backend/ppc/regalloc.py
@@ -522,6 +522,13 @@
res = self.fprm.force_allocate_reg(op)
return [loc, res]
+ def _prepare_threadlocalref_get(self, op):
+ if self.cpu.translate_support_code:
+ res = self.force_allocate_reg(op)
+ return [res]
+ else:
+ return self._prepare_call(op)
+
def prepare_cast_float_to_int(self, op):
loc1 = self.ensure_reg(op.getarg(0))
self.free_op_vars()
@@ -918,6 +925,8 @@
oopspecindex = self.get_oopspecindex(op)
if oopspecindex == EffectInfo.OS_MATH_SQRT:
return self._prepare_math_sqrt(op)
+ if oopspecindex == EffectInfo.OS_THREADLOCALREF_GET:
+ return self._prepare_threadlocalref_get(op)
return self._prepare_call(op)
prepare_call_i = _prepare_call
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit